private void frmMachineSet_Load(object sender, EventArgs e) { CreateSensorArray(); CreateSensorsTable(this.listViewShow); CreateSensorsTable(this.listViewCtlFH); CreateSensorsTable(this.listViewCtlWY); CreateSensorsTable(this.listViewCtlBX); this.listViewCtlFH.Height = this.listViewCtlBX.Height = this.listViewCtlWY.Height = (this.btnSendSetControl.Bottom - this.listViewCtlFH.Top) / 3 - 3; this.listViewCtlWY.Top = this.listViewCtlFH.Height + this.listViewCtlFH.Top + 2; this.listViewCtlBX.Top = this.listViewCtlWY.Height + this.listViewCtlWY.Top + 2; this.panel3.Left = (this.groupBox3.Width - this.panel3.Width) / 2; this.panel3.Top = (this.groupBox3.Height - this.panel3.Height) / 2; this.panel4.Left = (this.groupBox4.Width - this.panel4.Width) / 2; this.panel4.Top = (this.groupBox4.Height - this.panel4.Height) / 2; this.palBXZengyi.Left = (this.panel5.Width - this.palBXZengyi.Width) / 2; this.palBXZengyi.Top = (this.panel5.Height - this.palBXZengyi.Height) / 2; string machinetype = RWconfig.GetAppSettings("machineType"); this.txtMinLoad.Text = RWconfig.GetAppSettings("minLoad"); this.txtBXZengyi.Text = RWconfig.GetAppSettings("BXZengyi"); if (machinetype == "0") { this.rbtnSet1.Checked = true; } else { this.rbtnSet2.Checked = true; } }
private void frmSetRealtimeCurve_Load(object sender, EventArgs e) { this.tscbX1.SelectedIndex = int.Parse(RWconfig.GetAppSettings("X1")); this.tscbX2.SelectedIndex = int.Parse(RWconfig.GetAppSettings("X2")); this.tscbY1.SelectedIndex = int.Parse(RWconfig.GetAppSettings("Y1")); this.tscbY2.SelectedIndex = int.Parse(RWconfig.GetAppSettings("Y2")); //this.cmbYr.SelectedIndex = int.Parse(RWconfig.GetAppSettings("ShowY")); //this.cmbXr.SelectedIndex = int.Parse(RWconfig.GetAppSettings("ShowX")); }
// Function to Generate a 64 bits Key. /// <summary> /// 创建加密 /// </summary> /// <returns></returns> public static string GenerateKey() { // Create an instance of Symetric Algorithm. Key and IV is generated automatically. DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create(); //string curveName = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\key.txt"; //StreamWriter sw = new StreamWriter(curveName); if (string.IsNullOrEmpty(RWconfig.GetAppSettings("code"))) { string ss = BitConverter.ToString(desCrypto.Key); RWconfig.SetAppSettings("code", ss.ToString()); } //sw.WriteLine(BitConverter.ToString(desCrypto.Key)); //sw.Close(); //sw.Dispose(); //RWconfig.SetAppSettings("code",BitConverter.ToString(desCrypto.Key)); // Use the Automatically generated key for Encryption. return(ASCIIEncoding.ASCII.GetString(desCrypto.Key)); }