//****************** // Load Interfaces -- This loads the selected interfaces on the machine into the interfacebox //****************** private void LoadInterfaces() { string bitRate = null; string displayRow; // Sets up the multi-column box InterfaceBox.Items.Clear(); InterfaceBox.Columns.Clear(); InterfaceBox.Columns.Add("Network", 55, HorizontalAlignment.Left); InterfaceBox.Columns.Add("Type", 155, HorizontalAlignment.Left); InterfaceBox.Columns.Add("Mfg", 85, HorizontalAlignment.Left); InterfaceBox.Columns.Add("Channel", 35, HorizontalAlignment.Left); InterfaceBox.Columns.Add("BitRate", 55, HorizontalAlignment.Left); InterfaceBox.Columns.Add("Status", 75, HorizontalAlignment.Right); // Reset Interfaces in Bus Intefaces // BusInterface.ResetInterfaces(); GenericCanBus.DetectCanInterfaces(); // Find all of the LIN bus interfaces and adds to the list in busInterface // GenericLinBus.DetectLinInterfaces(); // Find all of the FlexRay bus interfaces and adds to the list in busInterface // GenericFlexRayBus.DetectFlexRayInterfaces(); // Returns the interfaces string[] interfaces = BusInterface.ReturnInterfaces(); for (int i = 0; i < interfaces.Length; i++) { bitRate = GenericCanBus.GenericCanRateReturn(interfaces[i]); // Creates the row with the message data and inserts the row in the ListView if (bitRate == null || bitRate == "" || bitRate == "0") { displayRow = ";NA;Bus Off"; } else { displayRow = ";" + bitRate + ";Bus On"; } ListViewItem item = new ListViewItem(CommonUtils.ConvertStringtoStringArray(interfaces[i] + displayRow)); InterfaceBox.Items.AddRange(new ListViewItem[] { item }); } }
//**************************** // Update Interface Boxes //**************************** private void UpdateInterfaceBox() { string bitRate = "-1"; // Populate the availabe interfaces for transmission/receiving string[] interfaces = BusInterface.ReturnInterfaces(); for (int i = 0; i < interfaces.Length; i++) { bitRate = GenericCanBus.GenericCanRateReturn(interfaces[i]); // Creates the row with the message data and inserts the row in the ListView if (bitRate != null && bitRate != "" && bitRate != "0" && bitRate != "-1") { TransmitInterfaceBox.Items.Add(interfaces[i]); } } if (TransmitInterfaceBox.Items.Count > 0) { TransmitInterfaceBox.SelectedIndex = 0; } }