public void getPortList(NWGUI Browser) { _SerialPorts.Clear(); a_SerialPorts = SerialPort.GetPortNames(); SerialPort testPort; foreach (string port in a_SerialPorts) { try { testPort = new SerialPort(port); testPort.Open(); _SerialPorts.Add(new SerialPortEntry { s_PortName = port, s_Status = "ON" }); testPort.Close(); } catch (IOException e) { _SerialPorts.Add(new SerialPortEntry { s_PortName = port, s_Status = "OFF" }); } } for (int i = 0; i < Browser.listView.Items.Count; i++) { if (s_PrevSelectedSerialPort == ((SerialPortEntry)Browser.listView.Items[i]).s_PortName) { Browser.listView.SelectedIndex = i; break; } } }
public SerialPortSelector(string s_PrevSelectedSerialPort, RoutedEventHandler extOkButtonClickedEvent, NWGUI Browser) { Browser.openButton.Click += extOkButtonClickedEvent; this.s_PrevSelectedSerialPort = s_PrevSelectedSerialPort; getPortList(Browser); }
public ChannelSelector(ref MidiInfo midiInfo, int i_Channel, RoutedEventHandler extOkButtonClickedEvent, NWGUI Browser) { Browser.okButton.Click += extOkButtonClickedEvent; for (int i = 0; i < midiInfo.a_UsedChannels.Length; i++) { if (midiInfo.a_UsedChannels[i]) { _Channels.Add(new Channel { i_ChannelNumber = i, s_Instrument = midiInfo.a_ChannelInstrumentNames[i] }); } } if (i_Channel >= 0) { for (int i = 0; i < Browser.listView.Items.Count; i++) { if (i_Channel == ((Channel)Browser.listView.Items[i]).i_ChannelNumber) { Browser.listView.SelectedIndex = i; break; } } } }
public int getSelectedChannel(NWGUI Browser) { if (Browser.listView.SelectedIndex >= 0) return ((Channel)Browser.listView.Items[Browser.listView.SelectedIndex]).i_ChannelNumber; return -1; }
public string getSelectedSerialPort(NWGUI Browser) { if (Browser.listView.SelectedIndex >= 0) { return ((SerialPortEntry)Browser.listView.Items[Browser.listView.SelectedIndex]).s_PortName; } return string.Empty; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.window = ((Symphonary.NWGUI)(target)); #line 7 "..\..\..\..\NWGUI\NWGUI.xaml" this.window.KeyDown += new System.Windows.Input.KeyEventHandler(this.NWGUI_KeyDown); #line default #line hidden #line 9 "..\..\..\..\NWGUI\NWGUI.xaml" this.window.Closing += new System.ComponentModel.CancelEventHandler(this.WindowClosing); #line default #line hidden #line 9 "..\..\..\..\NWGUI\NWGUI.xaml" this.window.LayoutUpdated += new System.EventHandler(this.Layout_Updated); #line default #line hidden #line 9 "..\..\..\..\NWGUI\NWGUI.xaml" this.window.SizeChanged += new System.Windows.SizeChangedEventHandler(this.Size_Changed); #line default #line hidden return; case 2: this.grid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.MenuBar = ((System.Windows.Controls.Menu)(target)); return; case 4: this.Stop = ((System.Windows.Controls.MenuItem)(target)); #line 30 "..\..\..\..\NWGUI\NWGUI.xaml" this.Stop.Click += new System.Windows.RoutedEventHandler(this.Stop_Clicked); #line default #line hidden return; case 5: this.muteSelectedChannel = ((System.Windows.Controls.MenuItem)(target)); #line 32 "..\..\..\..\NWGUI\NWGUI.xaml" this.muteSelectedChannel.Click += new System.Windows.RoutedEventHandler(this.MuteSelectedChannel_Clicked); #line default #line hidden return; case 6: this.pause = ((System.Windows.Controls.MenuItem)(target)); #line 33 "..\..\..\..\NWGUI\NWGUI.xaml" this.pause.Click += new System.Windows.RoutedEventHandler(this.Pause_Clicked); #line default #line hidden return; case 7: this.Instruments = ((System.Windows.Controls.MenuItem)(target)); return; case 8: #line 35 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Instrument_Clicked); #line default #line hidden return; case 9: #line 36 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Instrument_Clicked); #line default #line hidden return; case 10: #line 37 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Instrument_Clicked); #line default #line hidden return; case 11: #line 38 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.Instrument_Clicked); #line default #line hidden return; case 12: this.FPS = ((System.Windows.Controls.MenuItem)(target)); return; case 13: this.Console = ((System.Windows.Controls.MenuItem)(target)); #line 41 "..\..\..\..\NWGUI\NWGUI.xaml" this.Console.Click += new System.Windows.RoutedEventHandler(this.Debug_Clicked); #line default #line hidden return; case 14: this.FullScreen = ((System.Windows.Controls.MenuItem)(target)); #line 42 "..\..\..\..\NWGUI\NWGUI.xaml" this.FullScreen.Click += new System.Windows.RoutedEventHandler(this.Fullscreen_Clicked); #line default #line hidden return; case 15: this.ScoreDisplay = ((System.Windows.Controls.MenuItem)(target)); return; case 16: this.listViewGrid = ((System.Windows.Controls.Grid)(target)); return; case 17: this.tb_listViewTitle = ((System.Windows.Controls.TextBlock)(target)); return; case 18: this.listViewContent = ((System.Windows.Controls.Grid)(target)); return; case 19: this.channelsListView = ((System.Windows.Controls.ListView)(target)); return; case 20: this.serialPortsListView = ((System.Windows.Controls.ListView)(target)); return; case 21: #line 80 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Back_Clicked); #line default #line hidden return; case 22: this.previewChannelButton = ((System.Windows.Controls.Button)(target)); #line 81 "..\..\..\..\NWGUI\NWGUI.xaml" this.previewChannelButton.Click += new System.Windows.RoutedEventHandler(this.PreviewChannel_Clicked); #line default #line hidden return; case 23: this.listViewGridDoneButton = ((System.Windows.Controls.Button)(target)); #line 82 "..\..\..\..\NWGUI\NWGUI.xaml" this.listViewGridDoneButton.Click += new System.Windows.RoutedEventHandler(this.ListViewGridDone_Clicked); #line default #line hidden return; case 24: this.selectorError = ((System.Windows.Controls.TextBlock)(target)); return; case 25: this.loadingScreen = ((System.Windows.Controls.Grid)(target)); return; case 26: this.progressBar = ((System.Windows.Controls.Border)(target)); return; case 27: this.aboutScreen = ((System.Windows.Controls.Grid)(target)); return; case 28: #line 107 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.About_Clicked); #line default #line hidden return; case 29: this.normal = ((System.Windows.Controls.Grid)(target)); return; case 30: this.normalLogo = ((System.Windows.Controls.Image)(target)); return; case 31: #line 117 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Open_Clicked); #line default #line hidden return; case 32: #line 118 "..\..\..\..\NWGUI\NWGUI.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.About_Clicked); #line default #line hidden return; case 33: this.Background = ((System.Windows.Controls.Grid)(target)); return; case 34: this.canv = ((System.Windows.Controls.Canvas)(target)); return; case 35: this.keyLine = ((System.Windows.Shapes.Rectangle)(target)); return; case 36: this.gridlines = ((System.Windows.Controls.Canvas)(target)); return; case 37: this.subcanv = ((System.Windows.Controls.Canvas)(target)); return; case 38: this.Overlay = ((System.Windows.Controls.Grid)(target)); return; case 39: this.BottomGradient = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }