I want to initial panel which locate on the left panel.
Because export ‘IDockableScreen’ is hard to control its initialization, I define a interface. However I define the property ‘PaneLocation’ as ‘DesiredPaneLocation.DockedLeft’, define the property ‘ContextFilter’ as ‘Configure,Process’ can’t solve.
For this particular case your IDockableScreen.TabGroupId needs to be “Vc_L_TabGroup”.
Order relative to other tabs can be controlled with IDockableScreen.DesiredPanePosition.
Also note that after you have changed your code, you probably need to reset the UI layout (using “Restore Windows” from the ribbon) to see the effect.
I have defined, but it dosen’t work.When I click “Restore Windows” it is located as a left ribbon but not in the “Left Ribbon Family” .
Beacause of export ‘IDockPanel’ can’t be controlled arbitrarily, which can’t control that initial a window by clicking a button (‘Visible’ of window is out of control), so I control by exporting a ‘IViewModel’ and creating by ‘ShowFloatingWindow’ which seems to can’t define some UI configuration like these. Maybe have a better way?
public interface IPLMTreeViewModel
{
void Create();
}
[Export(typeof(IPlugin))]
[Export(typeof(IActionItem))]
public class PPRTreeActionItem : ActionItem, IPlugin, IHandle<ManipulationModeChangedMessage>
{
public PPRTreeActionItem() : base("PPR_TREE_ID", Translator.Get("PPR_TREE"), Environment.CurrentDirectory + Method.GetResxByName("ICON") + "PPR_TREE.svg", null, MenuTools.ButtonTool, false, true)
{
ActionID = Id;
CanExecute = true;
ToolTipContent = Translator.Get("PPR_TREE");
AttachTo = "[Event Click] = [Action Execute]";
}
public override void Execute()
{
IPLMTreeViewModel instance = IoC.Get<IPLMTreeViewModel>();
instance.Create();
}
}
[Export(typeof(IPLMTreeViewModel))]
class PLMTreeViewModel : DockableScreen, IHandle<PLMTreeMessageFromPERT>, IPLMTreeViewModel
{
#region 实现界面接口
[Import]
private Lazy<IDockAwareWindowManager> _dockAwareWindowManager { get; set; }
public void Create()
{
_dockAwareWindowManager.Value.ShowFloatingWindow("PPR_TREE", this, new Size(Width, Height), null, true, true);//需要加Size,否则初始化数值不会应用。
}
}
This is wrong. Like I said you need to set TabGroupId = “Vc_L_TabGroup”, have a unique PanelId, and also uncomment that PaneLocation line.
You can show and hide your panel with IDockAwareWindowManager.SetScreenVisibility method.
Thanks for your quickly reply!
It doesn’t work. Because I export as ‘IViewModel’ it is not registered in the display list, when I create it and click ‘Restore Windows’, it will set its position in the unique left ribbon.
I control by ‘SetScreenVisibility’ firstly but it just work after you switch all tab for initialization. When firstly switch tab it will automatcally set Visiblity ‘True’ even set it ‘False’ by code.
Actually, the “Restore Windows” command is not enough since it restores to a state saved when each context is first opened.
To truly reset the panels you need to go to folder similar to:
%LOCALAPPDATA%\Visual Components\Visual Components Premium 4.2\AppConfig\4.2.2
and delete all the .xml files, which store the panel configurations. By looking into the files you can also kind of debug these issues.
Thank you.
Now wherever I put it it will not change its position after clicking ‘Restore Window’.
However, because I export as ‘IViewModel’ and create window by ‘ShowFloatingWindow’, it just can display as a floating window. I think maybe it can set some property deliveried by parameters of the method ‘ShowFloatingWindow’ to define its positon.