コード例 #1
0
ファイル: FormMain.cs プロジェクト: digshock/Examples
        public FormMain()
        {
            InitializeComponent();

            _instance = this;
            NetworkAPI.Requester.Initialize();
            NetworkAPI.Requester.NetworkStatusChanged += OnNetworkStatusChanged;
            this.CreateTimer(10, () =>
            {
                NetworkAPI.Requester.Update();
            }).Start();

            UIViews.Initialize(this, _panel);
            UIViews.ChangeView<FormLogin>();

            SetMessageReady();
        }
コード例 #2
0
ファイル: FormLogin.cs プロジェクト: hoxily/Wuziqi
 private void InvokeOnMessage(Message msg)
 {
     switch(msg.Command)
     {
         case "verify":
             if (msg.Parameters.Length == 1 && msg.Parameters[0] == "yes")
             {
                 GameClient.State = ClientState.Verified;
             }
             else
             {
                 ShowTips("客户端版本不是最新版,需要升级");
                 VerifyFail = true;
             }
             break;
         case "login":
             if (msg.Parameters.Length >= 1 && msg.Parameters[0] == "yes" && msg.Prefix != null && msg.Prefix == textBoxLoginName.Text)
             {
                 GameClient.State = ClientState.Logined;
                 GameClient.ID = textBoxLoginName.Text;
                 FormMain main = new FormMain();
                 main.LoginForm = this;
                 main.GameClient = GameClient;
                 this.Hide();
                 main.Show();
             }
             else if (msg.Parameters.Length >= 1 && msg.Parameters[0] == "no")
             {
                 ShowTips("该昵称正在使用中,试试看换个昵称吧");
             }
             break;
     }
 }