private void rebuildConfigList() { int oldIndex = ConfigList.SelectedIndex; ConfigList.Items.Clear(); configFiles = configFinder.FindConfigFiles(); foreach (var c in configFiles) { ConfigList.Items.Add(MyroConfigGUI.MakeListItem(c)); } if (oldIndex < ConfigList.Items.Count) { ConfigList.SelectedIndex = oldIndex; } }
private List <MenuItem> makeConfigMenuItems() { var ret = new List <MenuItem>(); var finder = new MyroConfigFinder(Myro.Utilities.Params.ConfigPath); foreach (var config in finder.FindConfigFiles()) { MenuItem menuitem = new MenuItem() { Header = MyroConfigGUI.MakeListItem(config), }; var myConfig = config; menuitem.Click += delegate { RobotChange.Invoke(this, new RobotChangeEventArgs() { ConfigFiles = myConfig }); }; ret.Add(menuitem); } return(ret); }
private void displayJewelRobotChooser() { if (robotChooserMenu == null || robotChooserMenu.IsOpen == false) { JewelButton.SetValue(CheckBox.IsCheckedProperty, true); robotChooserMenu = new ContextMenu() { PlacementTarget = JewelButton, Placement = PlacementMode.Relative, VerticalOffset = JewelButton.ActualHeight }; robotChooserMenu.Closed += delegate { robotChooserMenu = null; JewelButton.SetValue(CheckBox.IsCheckedProperty, false); }; var finder = new MyroConfigFinder(Myro.Utilities.Params.ConfigPath); foreach (var config in finder.FindConfigFiles()) { MenuItem menuitem = new MenuItem() { Header = finder.MakeListItem(config), }; var myConfig = config; menuitem.Click += delegate { CurrentConfig = myConfig; }; robotChooserMenu.Items.Add(menuitem); } robotChooserMenu.IsOpen = true; } else { robotChooserMenu.IsOpen = false; } }