private void frmPanel_Load(object sender, EventArgs e) { ///خواندن رشته اتصال از رجیستری string RegisteryConnectionString = ""; string RegisteryPortConnectionString = ""; RegistryKey ConnectionString = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Sepehr_QC"); var RegTest = ConnectionString.GetValue("ConnectionForTester"); var RegPort = ConnectionString.GetValue("ConnectionForPortSerial"); try { if (RegTest == null || RegPort == null) { DevExpress.XtraEditors.XtraMessageBox.Show("This application is installed for the first time on this computer. Enter communication settings ", "Communication error", MessageBoxButtons.OK, MessageBoxIcon.Warning); frmCommication _frmComm = new frmCommication(); _frmComm.ShowDialog(); //simpleButton1.Visible = true; } else { RegisteryConnectionString = ConnectionString.GetValue("ConnectionForTester").ToString(); RegisteryPortConnectionString = ConnectionString.GetValue("ConnectionForPortSerial").ToString(); PublicVar.MainConnectionString = Crypto.DecryptTextUsingUTF8(RegisteryConnectionString); PublicVar.ConnPortWieght = Crypto.DecryptTextUsingUTF8(RegisteryPortConnectionString); } } catch { // simpleButton1.Visible = true; DevExpress.XtraEditors.XtraMessageBox.Show("No connection to the server", " Communication error", MessageBoxButtons.OK, MessageBoxIcon.Warning); frmCommication _frmComm = new frmCommication(); _frmComm.ShowDialog(); } }
private void btnSetting_Click(object sender, EventArgs e) { frmCommication _Comm = new frmCommication(); _Comm.ShowDialog(); }