private void CommitHooks() { try { RegistryKey voodooRoot = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\VoodooShader", RegistryKeyPermissionCheck.ReadWriteSubTree); if (voodooRoot != null) { if (voodooRoot.OpenSubKey("Hooks") != null) { voodooRoot.DeleteSubKeyTree("Hooks"); } } else { voodooRoot = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\VoodooShader"); } GlobalRegistry.Write(m_Hooks, voodooRoot); voodooRoot.Close(); } catch (System.Exception exc) { System.Windows.Forms.MessageBox.Show(exc.Message, "Error Writing Hooks", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void comboBoxEmptyCarton_SelectedIndexChanged(object sender, EventArgs e) { try { GlobalVariables.IgnoreEmptyCarton = this.comboBoxEmptyCarton.ComboBox.SelectedIndex == 0; GlobalRegistry.Write("IgnoreEmptyCarton", GlobalVariables.IgnoreEmptyCarton ? "1" : "0"); } catch { } }
private void buttonOK_Click(object sender, EventArgs e) { try { GlobalRegistry.Write("ServerName", this.textBoxServerName.Text); GlobalRegistry.Write("DatabaseName", this.textBoxDatabaseName.Text); GlobalMsADO.ServerName = this.textBoxServerName.Text; GlobalMsADO.DatabaseName = this.textBoxDatabaseName.Text; return; //http://www.codeproject.com/Articles/11967/Adding-custom-dialogs-to-your-applications } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(this, ex); } }
private void buttonOK_Click(object sender, EventArgs e) { try { if (this.comboBoxEmployeeID.SelectedIndex < 0 || this.EmployeeID < 0) { throw new System.ArgumentException("Vui lòng chọn tên người sử dụng!"); } if (!this.commonMetaList.CheckPasswordSuccessful(this.EmployeeID, this.textBoxPassword.Text)) { throw new System.ArgumentException("Sai mật khẩu! Vui lòng kiểm tra lại trước khi tiếp tục."); } GlobalVariables.GlobalUserInformation = new UserInformation(this.EmployeeID, 1, this.comboBoxEmployeeID.Text); if (sender.Equals(this.buttonListEmployee)) { CommonMDI commonMDI = new CommonMDI(GlobalEnum.TaskID.ListEmployee); if (commonMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK || true) { this.comboBoxEmployeeID.DataSource = this.commonMetaList.GetListEmployee(); } commonMDI.Dispose(); } if (sender.Equals(this.buttonOK)) { GlobalRegistry.Write("EmployeeID", "string" + this.EmployeeID); if (this.comboBoxImageS8PortName.SelectedIndex < 0 || this.comboBoxAutonicsPortName.SelectedIndex < 0) { throw new System.ArgumentException("Vui lòng chọn cổng COM!"); } if (this.comboBoxImageS8PortName.DataSource == null || this.comboBoxAutonicsPortName.DataSource == null) { GlobalVariables.ImageS8PortName = "COM 0"; GlobalVariables.AutonicsPortName = "COM 0"; } else { SQLDatabase.ExecuteNonQuery("UPDATE PublicPrinterProperties SET ImageS8PortName = N'" + (string)this.comboBoxImageS8PortName.SelectedValue + "', AutonicsPortName = N'" + (string)this.comboBoxAutonicsPortName.SelectedValue + "' "); GlobalVariables.ImageS8PortName = (string)this.comboBoxImageS8PortName.SelectedValue; GlobalVariables.AutonicsPortName = (string)this.comboBoxAutonicsPortName.SelectedValue; } } if (sender.Equals(this.labelChangePassword)) { PublicAuthenticationPassword publicAuthenticationPassword = new PublicAuthenticationPassword(); publicAuthenticationPassword.ShowDialog(); publicAuthenticationPassword.Dispose(); } } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); this.DialogResult = DialogResult.None; } }