private void MainForm_Load(object sender, EventArgs e) { this._adcs_start_height = this.btnADCsCount.Top + this.btnADCsCount.Height + 20; this._custom_params_start_height = this.btnEditCustomParams.Top + this.btnEditCustomParams.Height + 20; try { this.Settings = CSettings.Load(this._settings_file_name); this.Log.PostHead("Emulator", "Settings loaded successfully"); } catch (Exception) { this.Log.PostHead("Emulator", "Cannot load settings"); this.Settings = new CSettings(); } // Two fixed servers this._servers.Add(new ServerInfo("193.193.165.165", 20332, "Wialon Hosting", true)); this._servers.Add(new ServerInfo("193.193.165.166", 20332, "GPS Trace Orange", true)); // Load servers this._servers.AddRange(this.Settings.Servers); this.cbServer.Items.AddRange(this._servers.ToArray()); this.cbServer.SelectedIndex = 0; // Load devices this._devices.AddRange(this.Settings.Devices); this.cbDevice.Items.AddRange(this._devices.ToArray()); if (this.cbDevice.Items.Count > 0) { this.cbDevice.SelectedIndex = 0; } if (this.Settings.SelectedServer >= 0 && this.cbServer.Items.Count > this.Settings.SelectedServer) { this.cbServer.SelectedIndex = this.Settings.SelectedServer; } if (this.Settings.SelectedDevice >= 0 && this.cbDevice.Items.Count > this.Settings.SelectedDevice) { this.cbDevice.SelectedIndex = this.Settings.SelectedDevice; } this.UpdateSettingsValues(); this.ActivateConnectControls(true); this.UpdateAutoSendOptions(cbAutoSend.Checked); this._autosend_sec = (int)this.numAutoSendInterval.Value; this.UpdateParametersEnabled(); this.Log.PostHead("Emulator", "Ready"); }
private void MainForm_Load(object sender, EventArgs e) { this._adcs_start_height = this.btnADCsCount.Top + this.btnADCsCount.Height + 20; this._custom_params_start_height = this.btnEditCustomParams.Top + this.btnEditCustomParams.Height + 20; try { this.Settings = CSettings.Load(this._settings_file_name); this.Log.PostHead("Emulator", "Settings loaded successfully"); } catch (Exception) { this.Log.PostHead("Emulator", "Cannot load settings"); this.Settings = new CSettings(); } // Two fixed servers this._servers.Add(new ServerInfo("193.193.165.165", 20332, "Wialon Hosting", true)); this._servers.Add(new ServerInfo("193.193.165.166", 20332, "GPS Trace Orange", true)); // Load servers this._servers.AddRange(this.Settings.Servers); this.cbServer.Items.AddRange(this._servers.ToArray()); this.cbServer.SelectedIndex = 0; // Load devices this._devices.AddRange(this.Settings.Devices); this.cbDevice.Items.AddRange(this._devices.ToArray()); if (this.cbDevice.Items.Count > 0) this.cbDevice.SelectedIndex = 0; if (this.Settings.SelectedServer >= 0 && this.cbServer.Items.Count > this.Settings.SelectedServer) this.cbServer.SelectedIndex = this.Settings.SelectedServer; if (this.Settings.SelectedDevice >= 0 && this.cbDevice.Items.Count > this.Settings.SelectedDevice) this.cbDevice.SelectedIndex = this.Settings.SelectedDevice; this.UpdateSettingsValues(); this.ActivateConnectControls(true); this.UpdateAutoSendOptions(cbAutoSend.Checked); this._autosend_sec = (int)this.numAutoSendInterval.Value; this.UpdateParametersEnabled(); this.Log.PostHead("Emulator", "Ready"); }
public SettingsForm(CSettings settings) { this._settings = settings; InitializeComponent(); }