예제 #1
0
파일: Form3.cs 프로젝트: zh-h/nxsharp
 public Form3()
 {
     InitializeComponent();
     textBox1.Text = Cfg.versionHEX;
     textBox2.Text = Cfg.VersionParser(Cfg.versionHEX);
     textBox3.Text = Cfg.H3C_key;
     textBox4.Text = Cfg.H3C_key;
 }
예제 #2
0
파일: Form2.cs 프로젝트: zh-h/nxsharp
 private void modeButton3_CheckedChanged(object sender, EventArgs e)
 {
     if (modeButton3.Checked)
     {
         Cfg.mode = 2;
         Cfg.Commit();
     }
 }
예제 #3
0
 static void Main()
 {
     NetworkInterfaceAvaliable.List();
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Cfg.Load();
     Application.Run(new Form1());
     RefComm.StopAuthThread();
     return;
 }
예제 #4
0
파일: Form3.cs 프로젝트: zh-h/nxsharp
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length % 2 != 0 || textBox1.Text.Length > 32 || textBox1.Text.Length < 2)
     {
         MessageBox.Show("输入版本号信息不正确!"); 
         textBox1.Text = "";
     }
     else if (textBox3.Text.Length > 20)
     {
         MessageBox.Show("输入密钥过长!");
         textBox1.Text = "";
     }
     else
     {            
         Cfg.versionHEX = textBox1.Text;
         Cfg.H3C_key = textBox3.Text;
         Cfg.Commit();
         textBox2.Text = Cfg.VersionParser(textBox1.Text);
         textBox4.Text = Cfg.H3C_key;
     }
 }
예제 #5
0
 public void button1_Click(object sender, EventArgs e)
 {
     Cfg.username = textBox1.Text;
     Cfg.password = textBox2.Text;
     Cfg.device   = comboBox1.Text;
     Cfg.store    = checkBox1.Checked;
     Cfg.auto     = checkBox2.Checked;
     if (checkBox1.Checked)
     {
         Cfg.Commit();
     }
     else
     {
         Cfg.username = null;
         Cfg.password = null;
         Cfg.store    = false;
         Cfg.auto     = false;
         Cfg.Commit();
     }
     RefComm.StartAuthThread(Cfg.username, Cfg.password, "\\Device\\NPF_" + NetworkInterfaceAvaliable.adapters_dict[Cfg.device], Cfg.VersionParser(Cfg.versionHEX), Cfg.H3C_key, Cfg.mode);
     button1.Enabled = false;
     button2.Enabled = true;
     panel1.Enabled  = false;
     textBox3.Text   = "";
     timer1.Enabled  = true;
 }
예제 #6
0
        private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e)
        {
            if (button1.Enabled == false && button2.Enabled == true) //判断是否点击登录
            {
                switch (e.Mode)
                {
                //系统挂起
                case PowerModes.Suspend:
                    RefComm.StopAuthThread();
                    textBox3.AppendText("\r\n已登出");
                    break;

                //系统恢复
                case PowerModes.Resume:
                    RefComm.StartAuthThread(Cfg.username, Cfg.password, "\\Device\\NPF_" + NetworkInterfaceAvaliable.adapters_dict[Cfg.device], Cfg.VersionParser(Cfg.versionHEX), Cfg.H3C_key, Cfg.mode);
                    break;
                }
            }
        }