예제 #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            UpdateSoftware();

            if (txt_name.Texts.Trim().Length == 0)
            {
                MsgBox.Show(this, "CSS&IM", "用户名不能为空!", MessageBoxButtons.OK);
                txt_name.Focus();
                return;
            }

            if (txt_pswd.Texts.Trim().Length == 0)
            {
                MsgBox.Show(this, "CSS&IM", "密码不能为空!", MessageBoxButtons.OK);
                txt_pswd.Focus();
                return;
            }

            try
            {
                //Program.IsLogin = false;
                timer1.Enabled = false;
                User user = new User();
                user.UserName = txt_name.Texts.Trim();
                user.PassWord = txt_pswd.Texts.Trim();
                user.Save = chb_save.Checked;
                user.Auto = chb_autu.Checked;
                //SaveSettings();
                if (Login_Event != null)
                    Login_Event(user);
                this.Close();
            }
            catch (Exception)
            {

            }
        }
예제 #2
0
        /// <summary>
        /// 登录窗体登录返回事件
        /// </summary>
        /// <param name="user"></param>
        private void login_Login_Event(User user)
        {
            XmppCon.Username = user.UserName;
            XmppCon.Password = user.PassWord;

            waiting = new LoginWaiting();
            try
            {
                waiting.Show();
            }
            catch (Exception)
            {

            }

            Document doc_login = new Document();
            Settings.Verify settings = new Settings.Verify();
            doc_login.LoadFile(CSS.IM.UI.Util.Path.SettingsFilename);
            Settings.ServerInfo serverInfo = serverInfo = doc_login.RootElement.SelectSingleElement(typeof(Settings.ServerInfo)) as Settings.ServerInfo;

            if (serverInfo.ServerPort == null || serverInfo.ServerIP == null)
            {
                MsgBox.Show(waiting, "CSS&IM", "服务器地址错误!", MessageBoxButtons.OK);
                waiting.Hide();
                LogOut(false, false);
                return;
            }

            XmppCon.Port = int.Parse(serverInfo.ServerPort.ToString());
            XmppCon.Server = serverInfo.ServerIP;
            this.Hide();
            this.ShowInTaskbar = false;
            new Thread(new ThreadStart(OpenSocket)).Start();
        }
예제 #3
0
        /// <summary>
        /// 登录窗体登录返回事件
        /// </summary>
        /// <param name="user"></param>
        private void login_Login_Event(User user)
        {
            login_user = user;//保存登陆成功后的用户
            XmppCon.Username = user.UserName;
            XmppCon.Password = user.PassWord;
            waiting = new LoginWaiting();
            try
            {
                waiting.Show();
            }
            catch (Exception)
            {

            }

            if (Program.ServerIP == null || Program.Port == null)
            {
                MsgBox.Show(waiting, "CSS&IM", "服务器地址错误!", MessageBoxButtons.OK);
                waiting.Hide();
                LogOut(false, false);
                return;
            }

            XmppCon.Port = int.Parse(Program.Port);
            XmppCon.Server =Program.ServerIP;
            this.Hide();
            this.ShowInTaskbar = false;
            new Thread(new ThreadStart(OpenSocket)).Start();
        }