Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                mClient.mServerIP   = IniHelper.ProfileReadValue("CloudBlackboardSetting", "ServerIP", mConfigPath);
                mClient.mServerPort = Convert.ToInt32(IniHelper.ProfileReadValue("CloudBlackboardSetting", "ServerPort", mConfigPath));
            }
            catch
            {
                MessageBox.Show("错误:配置文件不可用!");
                System.Environment.Exit(0);
            }

            if (mClient.mServerIP == "" ||
                mClient.mServerPort == 0
                )
            {
                MessageBox.Show("错误:配置文件不可用!");
                System.Environment.Exit(0);
            }

            Form_Logon form_logon = new Form_Logon();

            if (form_logon.ShowDialog() == DialogResult.Cancel)
            {
                System.Environment.Exit(0);
            }

            Thread thread = new Thread(new ThreadStart(ThreadGetNewNotes))
            {
                IsBackground = true
            };

            thread.Start();
        }
Esempio n. 2
0
 private void Form_Logon_Load(object sender, EventArgs e)
 {
     try
     {
         textBox_User.Text = IniHelper.ProfileReadValue("CloudBlackboardSetting", "User", mConfigPath);
         textBox_PIN.Text  = IniHelper.ProfileReadValue("CloudBlackboardSetting", "PIN", mConfigPath);
         if (textBox_PIN.Text != "")
         {
             mPinLoaded        = true;
             checkBox1.Checked = true;
         }
     }
     catch
     {
         mPinLoaded        = false;
         checkBox1.Checked = false;
     }
 }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string pin_base64 = "";

            if (mPinLoaded)
            {
                pin_base64 = textBox_PIN.Text;
            }
            else
            {
                //计算pin的hash
                SHA256 sha256 = new SHA256Managed();
                byte[] hash   = sha256.ComputeHash(System.Text.Encoding.UTF8.GetBytes(textBox_PIN.Text));
                sha256.Clear();
                //Base64
                pin_base64 = Convert.ToBase64String(hash);
            }

            try
            {
                IniHelper.ProfileWriteValue("CloudBlackboardSetting", "User", textBox_User.Text, mConfigPath);

                if (!checkBox1.Checked)
                {
                    IniHelper.ProfileWriteValue("CloudBlackboardSetting", "PIN", "", mConfigPath);
                }
                else
                {
                    IniHelper.ProfileWriteValue("CloudBlackboardSetting", "PIN", pin_base64, mConfigPath);
                }
            }
            catch
            {
            }

            Form1.mUser      = textBox_User.Text;
            Form1.mPINBase64 = pin_base64;
        }