Beispiel #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            btnLogin.Enabled = false;
            btnLogin.Text    = "登录中...";

            string  user_name = txtLoginUserName.Text.Trim();
            string  pwd       = EncryptUtils.EncryptString(txtLoginPwd.Text.Trim());
            CPUInfo cpuInfo   = new CPUInfo();

            cpuInfo.GetCPUInfo();
            string   cpu    = cpuInfo.CPUName;
            string   osname = OSVersionInfo.SystemName;
            Computer cp     = Computer.Instance();
            string   mem    = cp.TotalPhysicalMemory;

            DianCheWebService.EntityUser user = ws.UserLogin(user_name, pwd, cpu, mem, osname);
            if (user != null)
            {
                this.Hide();
                FrmMain.CurrentUser = user;
                FrmMain frmMain = new FrmMain();
                frmMain.Show();
            }
            else
            {
                MessageBox.Show("登录失败,请检查用户名密码!");
                btnLogin.Enabled = true;
                btnLogin.Text    = "登录";
            }
        }
        public MonitorOutput GetSystemInfo()
        {
            MonitorOutput monitorOutput = new MonitorOutput()
            {
                CPUInfo  = CPUInfo.GetCPUInfo(),
                MemInfo  = MemoryInfo.GetMemInfo(),
                TCPCount = TCPInfo.GetTCPCount()
            };

            return(monitorOutput);
        }
Beispiel #3
0
        public void GetMonitorInfo()
        {
            MonitorOutput monitorOutput = new MonitorOutput()
            {
                CPUInfo     = CPUInfo.GetCPUInfo(),
                MemInfo     = MemoryInfo.GetMemInfo(),
                TCPCount    = TCPInfo.GetTCPCount(),
                OnlineCount = OnlineInfo.GetOnlineCount()
            };

            Clients.All.getMonitorInfo(monitorOutput);
        }
Beispiel #4
0
        private void btnReg_Click(object sender, EventArgs e)
        {
            if (txtRegUserName.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入用户名!");
                return;
            }

            if (txtRegPwd.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入密码!");
                return;
            }

            if (txtRegPwd.Text.Trim().Length < 6)
            {
                MessageBox.Show("密码长度不能小于6位!");
                return;
            }

            if (txtRegPwd.Text.Trim() != txtRegPwdConfirm.Text.Trim())
            {
                MessageBox.Show("两次输入的密码不一致,请重新输入密码,并且两次的密码一致!");
                return;
            }

            btnReg.Enabled = false;
            btnReg.Text    = "注册中...";

            string mac_address = Common.Helper.GetMacAddress();

            if (ws.IsExistMac(mac_address))
            {
                MessageBox.Show("该机器已经被注册过,请直接登录!");
                btnReg.Enabled = true;
                btnReg.Text    = "注册";
                return;
            }


            string user_name = txtRegUserName.Text.Trim();

            if (ws.IsExistUser(user_name))
            {
                MessageBox.Show("该用户名已经被使用过,请换一个!");
                btnReg.Enabled = true;
                btnReg.Text    = "注册";
                return;
            }


            string  pwd     = EncryptUtils.EncryptString(txtRegPwd.Text.Trim());
            string  phone   = txtRegPhone.Text.Trim();
            string  email   = txtRegEmail.Text.Trim();
            CPUInfo cpuInfo = new CPUInfo();

            cpuInfo.GetCPUInfo();
            string   cpu    = cpuInfo.CPUName;
            string   osname = OSVersionInfo.SystemName;
            Computer cp     = Computer.Instance();
            string   mem    = cp.TotalPhysicalMemory;

            DianCheWebService.EntityUser user = ws.RegUser(user_name, pwd, phone, email, mac_address, cpu, mem, osname);
            if (user != null)
            {
                this.Hide();
                FrmMain.CurrentUser = user;
                FrmMain frmMain = new FrmMain();
                frmMain.Show();
            }
            else
            {
                MessageBox.Show("注册失败!");
                btnReg.Enabled = true;
                btnReg.Text    = "注册";
            }
        }