private void menuItemsSelectionChanged(object sender, SelectionChangedEventArgs args) { MenuItemDataModel item = this.lvMenuItems.SelectedItem as MenuItemDataModel; if (item != null) { this.Hide(); switch (item.Code) { case MenuCode.Language: LanguageSelector.ShowBox(this.mainWindow, DI.W.Languages); break; case MenuCode.Dashboards: DashboardConfigSelect.ShowBox(this); break; case MenuCode.Ethernet: //this.runPageManager.Open(typeof(EthernetRun)); break; case MenuCode.Usb: //this.runPageManager.Open(typeof(SerialRun)); break; case MenuCode.Wifi: //this.runPageManager.Open(typeof(WifiRun)); break; case MenuCode.Bluetooth: //this.runPageManager.Open(typeof(BTRun)); RunBT win = new RunBT(); win.ShowDialog(); break; case MenuCode.BLE: //this.runPageManager.Open(typeof(BLE_Full)); break; case MenuCode.CodeSamples: CodeSelectWin.ShowBox(this.mainWindow); break; case MenuCode.Settings: //MainSettings.ShowBox(this.mainWindow); break; default: // Not supported break; } this.lvMenuItems.SelectionChanged -= this.menuItemsSelectionChanged; this.Hide(); this.lvMenuItems.UnselectAll(); this.lvMenuItems.SelectionChanged += this.menuItemsSelectionChanged; } }
private void AddItem(MenuCode menuCode, string display, UIIcon uIIcon, string padding) { MenuItemDataModel dataModel = new MenuItemDataModel() { Code = menuCode, Display = display, IconSource = IconBinder.Source(uIIcon), Padding = padding, }; this.items.Add(dataModel); }
private void lbxMenuItems_SelectionChanged(object sender, SelectionChangedEventArgs args) { MenuItemDataModel item = this.lbxMenuItems.SelectedItem as MenuItemDataModel; if (item != null) { this.Hide(); switch (item.Code) { case MenuCode.Language: LanguageSelector.ShowBox(this.mainWindow); break; case MenuCode.Terminators: TerminatorDataSelector.ShowBox(this.mainWindow); break; case MenuCode.Commands: Commands cmds = new Commands(this.mainWindow); cmds.ShowDialog(); break; case MenuCode.Ethernet: this.runPageManager.Open(typeof(EthernetRun)); break; case MenuCode.Usb: this.runPageManager.Open(typeof(SerialRun)); break; case MenuCode.Wifi: this.runPageManager.Open(typeof(WifiRun)); break; case MenuCode.Bluetooth: this.runPageManager.Open(typeof(BTRun)); break; case MenuCode.BLE: this.runPageManager.Open(typeof(BLE_Full)); break; case MenuCode.CodeSamples: Help_CommunicationMediums cm = new Help_CommunicationMediums(this.mainWindow); cm.ShowDialog(); break; case MenuCode.Settings: MainSettings.ShowBox(this.mainWindow); break; default: // Not supported break; } this.lbxMenuItems.SelectionChanged -= this.lbxMenuItems_SelectionChanged; this.Hide(); this.lbxMenuItems.UnselectAll(); lbxMenuItems.SelectionChanged += this.lbxMenuItems_SelectionChanged; } }