Пример #1
0
 private void LoginNow()
 {
     if (go)
     {
         go = false;
         if (Login.QLogin(uid, pwd))
         {
             ShareDate.ThisUser    = uid;
             this.Text             = "QQ:" + uid;
             this.notifyIcon1.Text = "QQ:" + uid;
             this.pLogin.Visible   = false;
             this.pFriend.Visible  = true;
             this.pGroup.Visible   = false;
             UserInf check = new UserInf();
             check.UserNumber = uid;
             check.isHaveFriendInf();
             if (!check.CheckResult)
             {
                 check.CreateUserDir(Application.StartupPath);
                 check.CreateFile(Application.StartupPath);
                 check.CreateOnlineFile(Application.StartupPath);
                 Login.SendMsgToGetFriendInf(uid);
             }
             while (!Login.SendMsgToGetOnlineInf())
             {
             }
             Server    = new MessageServer();
             Server.Co = this;
             if (!Server.IniServer(uid))
             {
                 MessageBox.Show("服务启动错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Application.Exit();
             }
             FillTreefriend();
             UserInf.TellMyFriendIOnLine(uid);
         }
         else
         {
             MessageBox.Show("登陆失败!失败原因:用户名或密码错误", "登陆失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Visible = false;
             Form1 show = new Form1();
             show.ShowDialog();
         }
         this.timer2.Stop();
         this.ShowIconModel(1);
     }
 }