public VehicleInformationPanel() { // Load the Dashboard Items in Order and Show the ones Selected in the Application Settings foreach (String nextHandlerName in ((String)Properties.ApplicationSettings.Default[Variables.SETTINGS_VEHICLEINFORMATION_HANDLERS]).Split(Variables.SETTINGS_SEPARATOR)) { String actualHandlerName = String.Copy(nextHandlerName); if (actualHandlerName.Length > 0) { if (actualHandlerName[0] == '+') { actualHandlerName = actualHandlerName.Substring(1); for (int i = 0; i < ELM327Connection.LoadedHandlerTypes.Count; i++) { Type nextHandlerType = ELM327Connection.LoadedHandlerTypes[i]; if (nextHandlerType.Name.Equals(actualHandlerName)) { DataItem newDashboardItem = new DataItem(nextHandlerType); newDashboardItem.Position = _dataItems.Count; _dataItems.Add(newDashboardItem); } } } } } ELM327Connection.ConnectionEstablishedEvent += StartMonitoring; ELM327Connection.ConnectionClosingEvent += StopMonitoring; InitializeComponent(); }
/// <summary> /// Create a new Dashboard Panel. /// </summary> public DashboardPanel() { InitializeComponent(); // Load the Dashboard Items in Order and Show the ones Selected in the Application Settings foreach (String nextHandlerName in ((String)Properties.ApplicationSettings.Default[Variables.SETTINGS_DASHBOARD_HANDLERS]).Split(Variables.SETTINGS_SEPARATOR)) { String actualHandlerName = String.Copy(nextHandlerName); if (actualHandlerName.Length > 0) { if (actualHandlerName[0] == '+') { actualHandlerName = actualHandlerName.Substring(1); for (int i = 0; i < ELM327Connection.LoadedHandlerTypes.Count; i++) { Type nextHandlerType = ELM327Connection.LoadedHandlerTypes[i]; if (nextHandlerType.Name.Equals(actualHandlerName)) { DataItem newDashboardItem = new DataItem(nextHandlerType); newDashboardItem.Position = _dashboardItems.Count; _dashboardItems.Add(newDashboardItem); } } } } } // Set the Columns Property based on Application Settings Columns = (int)Properties.ApplicationSettings.Default[Variables.SETTINGS_DASHBOARD_COLUMNS]; // Set the Rows Property Rows = (int)(Math.Ceiling((double)_dashboardItems.Count / (double)Columns)); ELM327Connection.ConnectionEstablishedEvent += StartMonitoring; ELM327Connection.ConnectionClosingEvent += StopMonitoring; }