Пример #1
0
 private void rbtnSet2_CheckedChanged(object sender, EventArgs e)
 {
     if (rbtnSet2.Checked)
     {
         RWconfig.SetAppSettings("machineType", "1");
     }
 }
Пример #2
0
        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;
            }
        }
Пример #3
0
 private void tsBtnSave_Click(object sender, EventArgs e)
 {
     RWconfig.SetAppSettings("Y1", this.tscbY1.SelectedIndex.ToString());
     RWconfig.SetAppSettings("Y2", this.tscbY2.SelectedIndex.ToString());
     RWconfig.SetAppSettings("X1", this.tscbX1.SelectedIndex.ToString());
     RWconfig.SetAppSettings("X2", this.tscbX2.SelectedIndex.ToString());
 }
Пример #4
0
 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"));
 }
Пример #5
0
 private void btnSaveBXZengyi_Click(object sender, EventArgs e)
 {
     if (txtBXZengyi.Text != string.Empty)
     {
         if (double.Parse(txtBXZengyi.Text.Trim()) != 0)
         {
             RWconfig.SetAppSettings("BXZengyi", txtBXZengyi.Text);
             MessageBox.Show("保存成功!");
         }
         else
         {
             MessageBox.Show("请输入不为0数字");
         }
     }
     else
     {
         MessageBox.Show("请输入数字");
     }
 }
Пример #6
0
        // 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));
        }
Пример #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtMinLoad.Text))
     {
         try
         {
             float minload = float.Parse(txtMinLoad.Text);
             if (minload < 0.05 || minload > 2)
             {
                 MessageBox.Show("请输入 0.05 - 2 之间的数值,已恢复默认值!");
                 return;
             }
             else
             {
                 RWconfig.SetAppSettings("minLoad", txtMinLoad.Text);
                 MessageBox.Show("保存成功!");
             }
         }
         catch
         {
             MessageBox.Show("输入不正确,已恢复成默认值!");
         }
     }
 }
Пример #8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     RWconfig.SetAppSettings("ShowY", this.cmbYr.SelectedIndex.ToString());
     RWconfig.SetAppSettings("ShowX", this.cmbXr.SelectedIndex.ToString());
 }