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; } }
public static void ShowBox(Window parent) { TerminatorDataSelector win = new TerminatorDataSelector(parent); win.ShowDialog(); }