public void Reset() { try { this.tmp_listObject = new Settings(); this.tmp_listObject.ServerIdentifier = "KIASU"; this.tmp_listObject.DataBase = new SettingsDataBase(); this.tmp_listObject.DataBase.DataSource = "10.160.40.160"; this.tmp_listObject.DataBase.InitialCatalog = "nurba"; this.tmp_listObject.DataBase.UserID = "sa"; this.tmp_listObject.DataBase.Password = "******"Nlg8XmM"; this.tmp_listObject.OPCServers = new System.Collections.Generic.List <SettingsOPCServer>(); SettingsOPCServer settingsOPCServer = new SettingsOPCServer(); settingsOPCServer.IpAddressServer = "192.168.10.10"; settingsOPCServer.NameServer = "OPCServer.WinCC"; this.tmp_listObject.OPCServers.Add(settingsOPCServer); settingsOPCServer = new SettingsOPCServer(); settingsOPCServer.IpAddressServer = "192.168.10.20"; settingsOPCServer.NameServer = "OPCServer.WinCC"; this.tmp_listObject.OPCServers.Add(settingsOPCServer); settingsOPCServer = new SettingsOPCServer(); settingsOPCServer.IpAddressServer = "192.168.10.40"; settingsOPCServer.NameServer = "OPCServer.WinCC"; this.tmp_listObject.OPCServers.Add(settingsOPCServer); this.tmp_listObject.DefaultOPCServer.IpAddressServer = "192.168.10.10"; this.tmp_listObject.DefaultOPCServer.NameServer = "OPCServer.WinCC"; } catch (System.Exception ex) { Program.showErrorMessage("ResetOptions: " + ex.Message); } }
private void button3_Click(object sender, System.EventArgs e) { if (this.dataGridView1.CurrentRow != null) { try { SettingsOPCServer settingsOPCServer = Program.sL.tmp_listObject.OPCServers[this.dataGridView1.CurrentRow.Index]; Program.sL.tmp_listObject.DefaultOPCServer = new SettingsDefaultOPCServer(); Program.sL.tmp_listObject.DefaultOPCServer.IpAddressServer = settingsOPCServer.IpAddressServer; Program.sL.tmp_listObject.DefaultOPCServer.NameServer = settingsOPCServer.NameServer; Program.sL.Save(); this.Bind(); } catch (System.Exception e2) { Program.showErrorMessage(e2, this); } } }
private void btn_Add_Click(object sender, System.EventArgs e) { EditOPCServerForm editOPCServerForm = new EditOPCServerForm(); editOPCServerForm.tb_NameServer.Text = "OPCServer.WinCC"; if (editOPCServerForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SettingsOPCServer settingsOPCServer = new SettingsOPCServer(); settingsOPCServer.IpAddressServer = editOPCServerForm.tb_IPAddrServer.Text; settingsOPCServer.NameServer = editOPCServerForm.tb_NameServer.Text; Program.sL.tmp_listObject.OPCServers.Add(settingsOPCServer); if (Program.sL.tmp_listObject.DefaultOPCServer == null) { Program.sL.tmp_listObject.DefaultOPCServer = new SettingsDefaultOPCServer(); Program.sL.tmp_listObject.DefaultOPCServer.IpAddressServer = settingsOPCServer.IpAddressServer; Program.sL.tmp_listObject.DefaultOPCServer.NameServer = settingsOPCServer.NameServer; } Program.sL.Save(); this.Bind(); } }
private void btn_Edit_Click(object sender, System.EventArgs e) { if (this.dataGridView1.CurrentRow != null) { try { EditOPCServerForm editOPCServerForm = new EditOPCServerForm(); SettingsOPCServer settingsOPCServer = Program.sL.tmp_listObject.OPCServers[this.dataGridView1.CurrentRow.Index]; editOPCServerForm.tb_IPAddrServer.Text = settingsOPCServer.IpAddressServer; editOPCServerForm.tb_NameServer.Text = settingsOPCServer.NameServer; if (editOPCServerForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { settingsOPCServer.IpAddressServer = editOPCServerForm.tb_IPAddrServer.Text; settingsOPCServer.NameServer = editOPCServerForm.tb_NameServer.Text; Program.sL.Save(); this.Bind(); } } catch (System.Exception e2) { Program.showErrorMessage(e2, this); } } }