public void SetupCustomUIElements(dynNodeView nodeUI) { _watchTree = new WatchTree(); // MAGN-2446: Fixes the maximum width/height of watch node so it won't // go too crazy on us. Note that this is only applied to regular watch // node so it won't be limiting the size of image/3D watch nodes. // nodeUI.PresentationGrid.MaxWidth = Configurations.MaxWatchNodeWidth; nodeUI.PresentationGrid.MaxHeight = Configurations.MaxWatchNodeHeight; nodeUI.PresentationGrid.Children.Add(_watchTree); nodeUI.PresentationGrid.Visibility = Visibility.Visible; if (Root == null) { Root = new WatchViewModel(); } _watchTree.DataContext = Root; RequestBindingUnhook += delegate { BindingOperations.ClearAllBindings(_watchTree.treeView1); }; RequestBindingRehook += delegate { var sourceBinding = new Binding("Children") { Mode = BindingMode.TwoWay, Source = Root, }; _watchTree.treeView1.SetBinding(ItemsControl.ItemsSourceProperty, sourceBinding); }; var checkedBinding = new Binding("ShowRawData") { Mode = BindingMode.TwoWay, Source = Root }; var rawDataMenuItem = new System.Windows.Controls.MenuItem { Header = "Show Raw Data", IsCheckable = true, }; rawDataMenuItem.SetBinding(System.Windows.Controls.MenuItem.IsCheckedProperty, checkedBinding); nodeUI.MainContextMenu.Items.Add(rawDataMenuItem); ((PreferenceSettings)dynSettings.Controller.PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged; Root.PropertyChanged += Root_PropertyChanged; }
public static void ManiaMenuLanguageChanged(object sender, RoutedEventArgs e) { System.Windows.Controls.MenuItem menuItem = sender as System.Windows.Controls.MenuItem; Methods.Solution.SolutionState.Main.CurrentManiaUILanguage = menuItem.Tag.ToString(); var allLangItems = Instance.MenuBar.menuLanguageToolStripMenuItem.Items.Cast <System.Windows.Controls.MenuItem>().ToArray(); foreach (var item in allLangItems) { if (item.Tag.ToString() != menuItem.Tag.ToString()) { item.IsChecked = false; } else if (item.Tag.ToString() == menuItem.Tag.ToString()) { item.IsChecked = true; } } }
public void SetupCustomUIElements(dynNodeView nodeUI) { nodeUI.MainContextMenu.Items.Add(new System.Windows.Controls.Separator()); // edit contents var editItem = new System.Windows.Controls.MenuItem { Header = "Edit Custom Node...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editItem); editItem.Click += (sender, args) => GoToWorkspace(nodeUI.ViewModel); // edit properties var editPropertiesItem = new System.Windows.Controls.MenuItem { Header = "Edit Custom Node Properties...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editPropertiesItem); editPropertiesItem.Click += (sender, args) => EditCustomNodeProperties(); // publish var publishCustomNodeItem = new System.Windows.Controls.MenuItem { Header = "Publish This Custom Node...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(publishCustomNodeItem); publishCustomNodeItem.Click += (sender, args) => { GoToWorkspace(nodeUI.ViewModel); if (dynSettings.Controller.DynamoViewModel.PublishCurrentWorkspaceCommand.CanExecute(null)) { dynSettings.Controller.DynamoViewModel.PublishCurrentWorkspaceCommand.Execute(null); } }; nodeUI.UpdateLayout(); }
public static void SetManiaMenuInputType(object sender, RoutedEventArgs e) { System.Windows.Controls.MenuItem menuItem = sender as System.Windows.Controls.MenuItem; if (menuItem != null) { if (menuItem.Tag != null) { string tag = menuItem.Tag.ToString(); var allItems = Instance.MenuBar.menuButtonsToolStripMenuItem.Items.Cast <System.Windows.Controls.MenuItem>().ToArray(); foreach (System.Windows.Controls.MenuItem item in allItems) { if (item.Tag == null || item.Tag.ToString() != menuItem.Tag.ToString()) { item.IsChecked = false; } else if (item.Tag.ToString() == menuItem.Tag.ToString()) { item.IsChecked = true; } var allSubItems = Instance.MenuBar.menuButtonsToolStripMenuItem.Items.Cast <System.Windows.Controls.MenuItem>().ToArray(); foreach (System.Windows.Controls.MenuItem subItem in allSubItems) { if (subItem.Tag == null || subItem.Tag.ToString() != menuItem.Tag.ToString()) { subItem.IsChecked = false; } else if (subItem.Tag.ToString() == menuItem.Tag.ToString()) { subItem.IsChecked = true; } } } switch (tag) { case "Xbox": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 2; break; case "Switch": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 4; break; case "PS4": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 3; break; case "Saturn Black": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 5; break; case "Saturn White": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 6; break; case "Switch Joy L": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 7; break; case "Switch Joy R": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 8; break; case "PC EN/JP": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 1; break; case "PC FR": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 9; break; case "PC IT": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 10; break; case "PC GE": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 11; break; case "PC SP": Methods.Solution.SolutionState.Main.CurrentManiaUIControllerType = 12; break; } menuItem.IsChecked = true; } } }