private void UserControlSelectChangedMessageAction(UserControlSelectChangedMessage message) { if (message == null) { return; } if (message.TabItemModel == null) //没有TabItem项,清除选择 { var selectTreeViewItem = this.tvNavigation.SelectedItem as TreeViewItem; if (selectTreeViewItem != null) { selectTreeViewItem.IsSelected = false; } } else { var treeViewItem = message.TabItemModel.TreeViewItem; if (treeViewItem == null) { return; } WindowTool.ExpandParentNodes(treeViewItem); treeViewItem.IsSelected = true; } }
public async Task <ButtonResult> Open() { var showDialog = ShowDialog(WindowTool.GetMainWindow()); Cancel.Focus(); await showDialog; return(_result); }
private void TreeView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { TreeViewItem clickNode = WindowTool.VisualUpwardSearch <TreeViewItem>(e.OriginalSource as DependencyObject) as TreeViewItem; if (clickNode == null) { return; } var tag = clickNode.Tag; if (tag == null || string.IsNullOrWhiteSpace(tag.ToString())) { return; } var control = WindowTool.CreateTabItemControl(tag.ToString()); if (control == null) { return; } var title = string.Empty; var image = clickNode.GetChildOfType <Image>() as Image; var imageSource = string.Empty; if (image != null) { imageSource = image.Source.ToString(); } var stackPanel = clickNode.GetChildOfType <StackPanel>() as StackPanel; if (stackPanel != null && stackPanel.Tag is AbisDeviceSimple) { //设备跟踪 var abisDeviceSimple = stackPanel.Tag as AbisDeviceSimple; ((MainViewModel)this.DataContext).AddTabDeviceTrack(clickNode, imageSource, tag.ToString(), control, abisDeviceSimple); } else { //常规导航 var textBlock = clickNode.GetChildOfType <TextBlock>() as TextBlock; if (textBlock != null) { title = textBlock.Text; } ((MainViewModel)this.DataContext).AddTabItemControl(clickNode, title, imageSource, tag.ToString(), control); } }
static void Init() { WindowTool tool = (WindowTool)EditorWindow.GetWindow(typeof(WindowTool)); tool.titleContent.text = "OBJ Exporter"; tool.titleContent.image = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Textures/tool-icon.png", typeof(Texture2D)); tool.Show(); toolSettings.allScene = false; toolSettings.name = "scene"; toolSettings.path = "Example: D:/Documents/Unity/projects/unity-project/Assets/"; }
public ButtonDialog(ButtonEnum type, string title, string text) { Icon = WindowTool.LoadIconAsWindowIcon(); WindowStartupLocation = WindowStartupLocation.CenterOwner; InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif Type = type; Title = title; Text.Text = text; }
public static void ShowWindow() { WindowTool.CreateInstance <WindowTool>().Show(); }
public static void OpenEditorWindow() { WindowTool tool = (WindowTool)EditorWindow.GetWindow(typeof(WindowTool)); tool.Show(); }