private void OnInitialized(object sender, EventArgs e) { try { jewelAnimation = (Storyboard)JewelButton.FindResource("JewelGlow"); jewelAnimation.Begin(JewelButton, true); } catch (Exception err) { GUIUtilities.ReportUnexpectedException(err); } }
private void displayJewelRobotChooser() { //Console.WriteLine(robotChooserMenu); if (robotChooserMenu == null) { 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); }; // Use the cached menu the first time - speeds up the first // time the user clicks the menu because files are read from // disk. Rebuild it from scratch after the first time though, // so that new configs are read. List <MenuItem> menuitems; if (cachedConfigMenu != null) { Console.WriteLine("Using cached menu items"); menuitems = cachedConfigMenu; cachedConfigMenu = null; } else { menuitems = makeConfigMenuItems(); } foreach (var menuitem in menuitems) { robotChooserMenu.Items.Add(menuitem); } robotChooserMenu.IsOpen = true; } //else // robotChooserMenu.IsOpen = false; }
private void OnInitialized(object sender, EventArgs e) { try { Robot.RobotStateChangeEvent += OnRobotStateChange; jewelAnimation = (Storyboard)JewelButton.FindResource("JewelGlow"); jewelAnimation.Begin(JewelButton, true); } catch (Exception err) { GUIUtilities.ReportUnexpectedException(err); } try { cachedConfigMenu = makeConfigMenuItems(); } catch (Exception) { } }
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; } }
private void OnInitialized(object sender, EventArgs e) { jewelAnimation = (Storyboard)JewelButton.FindResource("JewelGlow"); jewelAnimation.Begin(JewelButton, true); }