Exemplo n.º 1
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var user = await Models.User.Login(PhoneTextBox.Text, CodePasswordBox.Password);

                if (user != null)
                {
                    LoginSucceed?.Invoke(this, new LoginEventArgs()
                    {
                        user = user, isSuccess = true
                    });                                                                                //把按钮自身作为参数传递
                }
                else
                {
                    LoginFailed?.Invoke(this, new LoginEventArgs()
                    {
                        isSuccess = false
                    });
                }
            }
            catch (Exception excep)
            {
                LoginFailed?.Invoke(this, new LoginEventArgs()
                {
                    isSuccess = false, message = excep.Message
                });
            }
        }
        private void OnClick_btnLogin()
        {
            bool succeedLogin = LoginService.LoadUser(Address, Password);

            if (succeedLogin)
            {
                LoginSucceed?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                LoginFailed?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 3
0
        private async void Timer_Tick(object sender, object e)
        {
            var Mysender = sender as DispatcherTimer;
            var sta      = await qRCode.GetAuthstatus();

            if (Mysender == null || sta != null)
            {
                Mysender.Stop();
                LoginSucceed?.Invoke(this, new LoginEventArgs()
                {
                    user = sta
                });                                                             //把按钮自身作为参数传递
            }
        }
Exemplo n.º 4
0
        public void Login()
        {
            string homepageResponse = httpManager.Get("http://www.darkorbit.com/");
            Match  match            = Regex.Match(homepageResponse, "class=\"bgcdw_login_form\" action=\"(.*)\">");

            if (!match.Success)
            {
                LoginFailed?.Invoke(this, EventArgs.Empty);
                return;
            }

            string loginResponse = httpManager.Post(WebUtility.HtmlDecode(match.Groups[1].ToString()), $"username={Username}&password={Password}");

            match = Regex.Match(httpManager.lastURL, "https://(.*).darkorbit.bigpoint.com");

            if (!match.Success)
            {
                match = Regex.Match(httpManager.lastURL, "https://(.*).darkorbit.com");
            }
            if (!match.Success)
            {
                LoginFailed?.Invoke(this, EventArgs.Empty);
                return;
            }

            Server = match.Groups[1].ToString();

            string mapResponse = httpManager.Get($"{match.Value}/indexInternal.es?action=internalMapRevolution");

            match = Regex.Match(mapResponse, "{\"pid\":([0-9]+),\"uid\":([0-9]+)[\\w,\":]+sid\":\"([0-9a-z]+)\"");

            Match pid = Regex.Match(mapResponse, "basePath\": \"spacemap\",\"pid\": \"([0-9]+)");

            if (!match.Success || !pid.Success)
            {
                LoginFailed?.Invoke(this, EventArgs.Empty);
                return;
            }

            InstanceID = int.Parse(pid.Groups[1].ToString());
            UserID     = int.Parse(match.Groups[2].ToString());
            SID        = match.Groups[3].ToString();
            match      = Regex.Match(mapResponse, "mapID\": \"([0-9]*)\"");
            Map        = int.Parse(match.Groups[1].ToString());

            LoginSucceed?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 5
0
 public void InvokeLoginSucceed()
 {
     LoginSucceed?.Invoke();
 }
Exemplo n.º 6
0
 public void NotifyLoginSucceed()
 {
     LoginSucceed?.Invoke(this, EventArgs.Empty);
 }