コード例 #1
0
 void Service_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     switch (e.Result) {
         case (LoginResponse.Ok):
             App.Service.LoginCompleted -= Service_LoginCompleted;
             App.Service.RegisterCompleted -= Service_RegisterCompleted;
             // FIXME: use sent values
             App.UserName = NameBox.Text;
             App.Password = PasswordBox.Password;
             Cookie.SetCookie("username", App.UserName);
             Cookie.SetCookie("password", App.Password);
             SuccessfulLogin(this, null);
             break;
         case (LoginResponse.InvalidLogin):
             MessageBox.Show("Invalid user name.");
             break;
         case (LoginResponse.InvalidPassword):
             MessageBox.Show("Invalid password.");
             break;
         case (LoginResponse.Unregistered):
             MessageBox.Show("You need to register before logging in.");
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
コード例 #2
0
ファイル: Login.xaml.cs プロジェクト: asenval/LunarBase
 void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         AppCache.ApplicationViewModel.UserProfile = e.Result;
     }
 }
コード例 #3
0
        void loginCompleted(object pSender, LoginCompletedEventArgs pArgs)
        {
            Globals.IsLoggedIn = false;

            if (pArgs.Error != null)
            {
                setPageStatusLoggingFailed();
                return;
            }

            Globals.Reportcontext = pArgs.Result;
            if (Globals.Reportcontext == null || !Globals.ValidatePartners)
            {
                setPageStatusLoggingFailed();
                return;
            }

            Globals.IsLoggedIn = true;
            Globals.UserName   = UserNameTextbox.Text;
            Globals.Password   = PasswordTextbox.Password;
            Globals.UserRoles  = null;            //TODO: user.Roles.ToArray();

            //TODO:  Save the user name to isolated storage so it can be inserted next time user loads application
            //ConfigurationSettings.LastUserName = Globals.UserName;

            setPageStatusActive();
            if (NavigateRequest != null)
            {
                NavigateRequest(this, new NavigateRequestArgs(destinationPage, null));
            }
        }
コード例 #4
0
 private void HandleLoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         LoginVisibility         = Visibility.Collapsed;
         RoomNavigationVisiblity = Visibility.Visible;
     }
 }
コード例 #5
0
ファイル: ImportMock.cs プロジェクト: tweakch/TweakToolkit
        protected virtual void OnLoginCompleted(LoginCompletedEventArgs e)
        {
            var handler = LoginCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #6
0
ファイル: LoginViewBS.cs プロジェクト: dsm0709/wp
 /// <summary>
 /// 事件回调
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void loginBS_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (LoginCompleted != null)
     {
         System.Windows.Deployment.Current.Dispatcher.BeginInvoke(delegate()
         {
             LoginCompleted(this, e);
         });
     }
     RemoveBrowser();
 }
コード例 #7
0
 public void LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected)
     {
         App.Session = e.Session;
     }
     else if (e.Error != null)
     {
         MessageBox.Show("Error logging in.");
     }
 }
コード例 #8
0
 private void authClient_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         if (SkyDriveSessionChanged != null) { SkyDriveSessionChanged(e.Session); }
     }
     else
     {
         if (SkyDriveSessionChanged != null) { SkyDriveSessionChanged(null); }
     }
 }
コード例 #9
0
ファイル: SkyDrive.cs プロジェクト: ApexHAB/apex-lumia
 public void LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected)
     {
         App.Session = e.Session;
     }
     else if (e.Error != null)
     {
         MessageBox.Show("Error logging in.");
     }
 }
コード例 #10
0
 private void authClient_InitializeCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         if (SkyDriveSessionChanged != null) { SkyDriveSessionChanged(e.Session); }
     }
     else
     {
         this.authClient.LoginCompleted += authClient_LoginCompleted;
         this.authClient.LoginAsync(scopes);
     }
 }
コード例 #11
0
 private void authClient_InitializeCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         this.liveClient = new LiveConnectClient(e.Session);
     }
     else
     {
         this.authClient.LoginCompleted += authClient_LoginCompleted;
         this.authClient.LoginAsync(scopes);
     }
 }
コード例 #12
0
 private void HandleLoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Error = LoadingMessage = e.Error.Message;
     }
     else
     {
         LoadingMessage = "success!";
         _userStateListener.Start();
     }
 }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void auth_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         _session = e.Session;
         _client  = new LiveConnectClient(_session);
     }
     else if (e.Error != null)
     {
         RadMessageBox.Show("Error", MessageBoxButtons.OK, e.Error.ToString(), null, false, false, System.Windows.HorizontalAlignment.Stretch, System.Windows.VerticalAlignment.Top, null);
     }
 }
コード例 #14
0
 private void authClient_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         this.liveClient = new LiveConnectClient(e.Session);
         MessageBox.Show("Signed");
     }
     else
     {
         MessageBox.Show("Failed!");
     }
 }
コード例 #15
0
 void rrs_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Result != "")
     {
         Login1Page.StudentUniversityID  = textBoxStudentUniID.Text;
         StudentMainPage.StudentFullName = e.Result;
         NavigationService.Navigate(new Uri("/StudentMainPage.xaml", UriKind.Relative));
     }
     else
     {
         MessageBox.Show("Invalid StudentUID or Password");
     }
 }
コード例 #16
0
        static void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            lock (m_syncRoot)
            {
                MySectorServiceClient client = (MySectorServiceClient)sender;
                client.LoginCompleted -= client_LoginCompleted;

                if (e.Error != null)
                {
                    // On error, close client
                    SafeClose();
                }
            }
        }
コード例 #17
0
ファイル: MessageVM.cs プロジェクト: Kelin-Hong/Becle.Phone
        void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            if (e.Result.Message == "Error")
            {
                MessageBox.Show("UserName or PassWord Error");
                return;
            }

            (App.Current as App).UserId = e.Result.UserId;
            client.GetUserInfoAsync(e.Result.UserId);
            client.GetUserInfoCompleted += new EventHandler<GetUserInfoCompletedEventArgs>(client_GetUserInfoCompleted);
            client.GetMessgeAsync((App.Current as App).UserId);
            client.GetMessgeCompleted += new EventHandler<GetMessgeCompletedEventArgs>(client_GetMessgeCompleted);
        }
コード例 #18
0
        void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            if (e.Result.Message == "Error")
            {
                MessageBox.Show("UserName or PassWord Error");
                return;
            }

            (App.Current as App).UserId = e.Result.UserId;
            client.GetUserInfoAsync(e.Result.UserId);
            client.GetUserInfoCompleted += new EventHandler <GetUserInfoCompletedEventArgs>(client_GetUserInfoCompleted);
            client.GetMessgeAsync((App.Current as App).UserId);
            client.GetMessgeCompleted += new EventHandler <GetMessgeCompletedEventArgs>(client_GetMessgeCompleted);
        }
コード例 #19
0
 void LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Result == null)
     {
         MessageBox.Show(Texts.TextoUsuarioIncorrecto, Texts.TextoError, MessageBoxButton.OK);
         return;
     }
     MessageBox.Show(Texts.TextoBienvenida, Texts.TextoCorrecto, MessageBoxButton.OK);
     if (recuerdameToggleSwitch.IsChecked != null && recuerdameToggleSwitch.IsChecked.Value)
     {
         GuardarInfoUsuario(e.Result);
     }
     NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
 }
コード例 #20
0
 void greetUser_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         liveConnect = new LiveConnectClient(e.Session);
         liveConnect.GetCompleted +=
             new EventHandler <LiveOperationCompletedEventArgs>(greetUser_GetCompleted);
         liveConnect.GetAsync("me");
     }
     else
     {
         Debug.WriteLine("Could not finish SkyDrive login.");
         MessageBox.Show("Sorry. Could not log in to SkyDrive. Please try again.");
     }
 }
コード例 #21
0
 private void LoginCompleted_CallBack(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         isConnectSucceed = true;
         //StartConnectionServerThread();//发送心跳包
     }
     else
     {
         isConnectSucceed = false;
     }
     if (LoginCompleted != null)
     {
         LoginCompleted(sender, e);
     }
     //DebugLog("LoginCompleted_CallBack isAsync:" + isAsync);
 }
コード例 #22
0
        /// <summary>
        /// The function continues the initialization process, picking up where Initialize() left off
        /// having called OSBIDE's login service
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitStepTwo_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            string authKey = "";

            try
            {
                if (e != null)
                {
                    if (e.Result != null)
                    {
                        authKey = e.Result;
                    }
                }
            }
            catch (Exception ex)
            {
                _errorLogger.WriteToLog("Web service error: " + ex.Message, LogPriority.HighPriority);
                _hasStartupErrors = true;
                return;
            }
            if (authKey.Length <= 0)
            {
                MessageBoxResult result = MessageBox.Show("It appears as though your OSBIDE user name or password has changed since the last time you opened Visual Studio.  Would you like to log back into OSBIDE?", "Log Into OSBIDE", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    OpenLoginScreen(this, EventArgs.Empty);
                }
            }
            else
            {
                _cache[StringConstants.AuthenticationCacheKey] = authKey;
            }

            //having logged in, we can now check to make sure we're up to date
            try
            {
                _webServiceClient.LibraryVersionNumberAsync();
            }
            catch (Exception ex)
            {
                //write to the log file
                _errorLogger.WriteToLog(string.Format("LibraryVersionNumberAsync error: {0}", ex.Message), LogPriority.HighPriority);
                _hasStartupErrors = true;
            }
        }
コード例 #23
0
        void CheckPermissions_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            string message;

            if (e.Status == LiveConnectSessionStatus.Connected)
            {
                //session = e.Session;
                //client = new LiveConnectClient(e.Session);
                message              = "Signed in.";
                client.GetCompleted +=
                    new EventHandler <LiveOperationCompletedEventArgs>(CheckPermissions_GetCompleted);
                client.GetAsync("me/permissions");
            }
            else if (e.Error != null)
            {
                message = "Error signing in: " + e.Error.ToString();
            }
        }
コード例 #24
0
        private void WebserviceLoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            var asyncRequestInfo = e.UserState as AsyncRequestInfo;

            if (asyncRequestInfo == null)
            {
                throw new NullReferenceException("asyncRequestInfo (LoginCompleted)");
            }

            bool result = e.Result;

            if (result)
            {
                WebserviceState = WebserviceWrapperState.Connected;
            }

            asyncRequestInfo.Callback(new WebserviceResult(asyncRequestInfo, result));
        }
コード例 #25
0
        private void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            string loginAccepted = e.Result;


            if (loginAccepted == "1")
            {
                var intent = new Intent(this, typeof(Home));
                //intent.PutExtra("Username", editUsername.Text);
                //intent.PutExtra("Password", editPassword.Text);
                StartActivity(intent);
            }

            else
            {
                Toast.MakeText(this, "Please try again!", ToastLength.Long).Show();
            }
        }
コード例 #26
0
        /// <summary>
        ///     Event handler for InitializeCompleted, called when Initialize is completed.
        /// </summary>
        /// <param name="sender">The object that fires the event.</param>
        /// <param name="e">The event arg containing the result of Initialize.</param>
        private static void OnInitializeCompleted(object sender, LoginCompletedEventArgs e)
        {
            OperationState state = e.UserState as OperationState;
            if (state != null)
            {
                state.AuthClient.InitializeCompleted -= OnInitializeCompleted;

                var tcs = state.Tcs;
                if (e.Error != null)
                {
                    tcs.TrySetException(e.Error);
                }
                else
                {
                    tcs.TrySetResult(new LiveLoginResult(e.Status, e.Session));
                }
            }
        }
コード例 #27
0
        void ClientLogin_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            Common.CloseBusyIndicator();
            if (bool.Parse(e.Result.ToString()))
            {
                lblError.Visibility = System.Windows.Visibility.Collapsed;
                IsolatedStorageSettings.SiteSettings.Clear();
                IsolatedStorageSettings.SiteSettings.Add("UserName", txtUserName.Text);
                IsolatedStorageSettings.SiteSettings.Save();

                System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("Default.aspx", UriKind.Relative));

            }
            else
            {
                lblError.Visibility = System.Windows.Visibility.Visible;
            }
        }
コード例 #28
0
        /// <summary>
        ///     Event handler for LoginCompleted, called when Login is completed.
        /// </summary>
        /// <param name="sender">The object that fires the event.</param>
        /// <param name="e">The event arg containing the result of Login.</param>
        private static void OnLoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            OperationState state = e.UserState as OperationState;

            if (state != null)
            {
                state.AuthClient.LoginCompleted -= OnLoginCompleted;

                var tcs = state.Tcs;
                if (e.Error != null)
                {
                    tcs.TrySetException(e.Error);
                }
                else
                {
                    tcs.TrySetResult(new LiveLoginResult(e.Status, e.Session));
                }
            }
        }
コード例 #29
0
        private void LoginCompleted([NotNull] object sender, [NotNull] LoginCompletedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            if (e.Error != null)
            {
                if (DisableLoginErrorMessage)
                {
                    IsComplete = true;
                    this.Close(false);
                    return;
                }

                Dispatcher.Invoke(new Action(delegate
                {
                    var pipeline = TroubleshooterPipeline.Run().WithParameters(DataService, true, e.Error, WebService.Endpoint);

                    if (pipeline.Retry)
                    {
                        WebService.LoginAsync(Credentials);
                        return;
                    }

                    IsComplete = true;
                    this.Close(false);
                }));

                return;
            }

            if (e.Result == @"Invalid user or password.")
            {
                Dispatcher.Invoke(new Action(ShowInvalidUserNameOrPassword));
                return;
            }

            WebService.LoginCompleted -= LoginCompleted;

            DataService.WebServiceVersion = e.Result;

            Dispatcher.Invoke(new Action(CloseWindow));
        }
コード例 #30
0
 private void AuthService_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Result.Return)
     {
         EppmConnection connect = new EppmConnection();
         connect.dbType        = dbInsts[dbCmb.SelectedIndex].DatabaseType;
         connect.sessionCookie = authService.CookieContainer;
         connect.dbName        = dbCmb.Text;
         this.OnEppmConnected.Invoke(connect);
         this.Close();
     }
     else
     {
         MessageBox.Show(e.Error.Message);
         dbCmb.Enabled       = true;
         eppmLogin.Enabled   = true;
         eppmPasswd.Enabled  = true;
         eppmConnect.Enabled = true;
     }
 }
コード例 #31
0
ファイル: MainViewModel.cs プロジェクト: wojtekl/university
 private void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         user.Id         = e.Result;
         ShowRejestracja = Visibility.Collapsed;
         if (!IsolatedStorageSettings.ApplicationSettings.Contains("NotepadUserName"))
         {
             IsolatedStorageSettings.ApplicationSettings.Add("NotepadUserName", user.Name);
         }
         client.GetUserNotesAsync(user.Id);
         ShowList = Visibility.Visible;
     }
     else
     {
         ShowRejestracja = Visibility.Visible;
     }
     //NotifyPropertyChanged("ShowRejestracja");
     //NotifyPropertyChanged("ShowList");
 }
コード例 #32
0
 void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     LoginBack login= e.Result;
     if (login.Message == "Error") MessageBox.Show("UserName or PassWord Error");
     else
     {
         if (login.UserType == 0)
         {
             (App.Current as App).UserId = login.UserId;
             client.GetUserInfoCompleted += new EventHandler<GetUserInfoCompletedEventArgs>(client_GetUserInfoCompleted);
             NavigationService.Navigate(new Uri("/Views/MainPage.xaml", UriKind.Relative));
             client.GetUserInfoAsync((App.Current as App).UserId);
         }
         else
             if(login.UserType==1)
         {
             (App.Current as App).AcquirerId = login.UserId;
           
             NavigationService.Navigate(new Uri("/Views/AcquirerPage.xaml", UriKind.Relative));
         }
     }
   
 }
コード例 #33
0
ファイル: Login_renren.xaml.cs プロジェクト: dsm0709/wp
        void oauthControl_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            if (e.Error == null && back_key == 1)
            {
                NavigationService.GoBack();
            }
            // NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));



            //{
            //    back_key = -1;
            //    NavigationService.Navigate(new Uri("/Default.xaml?prepage=Login", UriKind.Relative));
            //}
            //if (e.Error == null && back_key == -1)
            //{
            //    NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            //}

            else
            {
                MessageBox.Show(e.Error.Message);
            }
        }
コード例 #34
0
        private void LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            LoadingIconVisible = false;
            ButtonsEnabled     = true;

            //hash longer than 0 means success
            try
            {
                if (e.Result.Length > 0)
                {
                    AuthenticationHash = e.Result;
                    Result             = MessageBoxResult.OK;
                    RequestClose(this, EventArgs.Empty);
                }
                else
                {
                    ErrorText = "Invalid email or password.";
                }
            }
            catch (Exception)
            {
                ErrorText = "Error processing request (http).";
            }
        }
コード例 #35
0
        //处理登陆结果
        void ShowLoginResult(object sender, LoginCompletedEventArgs e)
        {
            if (e.Result.Success)
            {
                DataManager.SetValue(DataKey.IWorld_Client_Token, e.Result.Info);

                GetSettingImport import = new GetSettingImport { Token = e.Result.Info };
                AuthorServiceClient client = (AuthorServiceClient)sender;
                client.GetSettingCompleted += ShowGetSettingResult;
                this.LoadingMessage = "加载系统设置(2/7)...";
                client.GetSettingAsync(import);
            }
            else
            {
                ShowLoginError(e.Result.Error);
            }
        }
コード例 #36
0
 private void ClientOnLoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     returnMessage = e.Result;
 }
コード例 #37
0
 /// <summary>
 /// 事件回调
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void loginBS_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (LoginCompleted != null)
     {
         System.Windows.Deployment.Current.Dispatcher.BeginInvoke(delegate()
         {
             LoginCompleted(this, e);
         });
     }
     RemoveBrowser();
 }
コード例 #38
0
 private void OnEndLogin(object sender, LoginCompletedEventArgs args)
 {
     if (args.Error == null)
     {
         if (args.Result.ErrorCode == WebResult.ErrorCodeList.SUCCESS)
         {
             Logued = true;
             User = args.Result.Value;
         }
         ErrorCode = args.Result.ErrorCode;
     }
 }
コード例 #39
0
ファイル: ShellViewModel.cs プロジェクト: unicloud/FRP
        private void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            if (!e.Result) return;
            var queryString = string.Format("GetFunctionItemsByUser?userName='******'", LoginInfo.UserName);
            _context.BeginExecute<FunctionItemDTO>(new Uri(queryString, UriKind.Relative),
                result =>
                    Deployment.Current.Dispatcher.BeginInvoke(
                        () =>
                        {
                            var context = result.AsyncState as BaseManagementData;
                            if (context == null) return;
                            var retMenu = context.EndExecute<FunctionItemDTO>(result).ToList();
                            LoadMenuItems(retMenu);
                            ModuleLoader(retMenu.Where(m => m.ParentItemId == null).ToList());
                        }), _context);

            IsLogined = true;
            StatusData.curUser = LoginInfo.UserName;
        }
コード例 #40
0
 private void OnEndLogin(object sender, LoginCompletedEventArgs args)
 {
     if (args.Error == null)
     {
         if (args.Result.ErrorCode == WebResult.ErrorCodeList.SUCCESS)
         {
             ConnectionString = args.Result.Value1;
             IsConnected = true;
             User = args.Result.Value2;
             //LoginView.Close();
         }
         else
             IsConnected = false;
         RaisePropertyChange("IsConnected");
     }
 }
コード例 #41
0
		private void OnAuthClientLoginCompleted(object sender, LoginCompletedEventArgs e)
		{
			if (e.Status == LiveConnectSessionStatus.Connected)
			{
				// We're online, get the client.
				MakeClientFromSession(e.Session);

				// Notify we're linked.
				IsLinked = true;
			}
		}
コード例 #42
0
		private void OnAuthClientInitializeCompleted(object sender, LoginCompletedEventArgs e)
		{
			if (e.Status == LiveConnectSessionStatus.Connected)
			{
				// We're online, get the client.
				MakeClientFromSession(e.Session);
			}
			else
			{
				// Checks if we need to auto login.
				bool shouldAutoLogin = false;
				lock (_syncRoot)
				{
					shouldAutoLogin = _autoLoginOnInitFail;
				}

				// If we need to auto-login, do it.
				if (shouldAutoLogin)
				{
					_authClient.LoginAsync(_Scopes);
				}
			}
		}
コード例 #43
0
 private void loginService_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     IsolatedStorageSettings.SiteSettings[WELCOME] = e.Result;
     LoggedIn(e.Result);
 }
コード例 #44
0
ファイル: LoginWindow.xaml.cs プロジェクト: ITPuppy/myRepo
        void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            ///调用结束标志加1
            end++;
            ///如果begin!=end说明 此次end已经被取消,如果等于end说明此次是最后一次调用的回调函数,再去判断IsCancel
            if (begin != end || IsCurrentCanceled)
            {

                return;
            }

            try
            {
                if (e.Error != null)
                    throw (e.Error);
                if (e.Result.Status == MessageStatus.OK)
                {
                    
                    DataUtil.Member = e.Result.Member;

                    this.IsVisibleChanged += LoginWindow_IsVisibleChanged;

                    this.Visibility = Visibility.Collapsed;

                    DataUtil.Member.password = String.Empty;
                    this.member.password = String.Empty;
                    WriteIDAndPwd();

                }
                else
                {
                    MessageBox.Show("用户名或者密码错误");
                    WaitGrid.Visibility = Visibility.Collapsed;
                    LoginGrid.Visibility = Visibility.Visible;
                }

               
            }

            catch (EndpointNotFoundException ex)
            {

                MessageBox.Show("网络出现问题");
                WaitGrid.Visibility = Visibility.Collapsed;
                LoginGrid.Visibility = Visibility.Visible;

                return;
            }

            catch (Exception ex)
            {

                MessageBox.Show("登录出现问题");
                WaitGrid.Visibility = Visibility.Collapsed;
                LoginGrid.Visibility = Visibility.Visible;

                return;
            }
            finally
            {
                DataUtil.Client.LoginCompleted -= client_LoginCompleted;
            }
        }
コード例 #45
0
 void AuthenticationClient_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         MessageBox.Show(String.Format("Login failed: {0}", e.Error.Message));
     }
 }
コード例 #46
0
 private void OnEndLogin(object sender, LoginCompletedEventArgs args)
 {
     if (!ErrorDataModel.Instance.EvalResponse(args)) return;
     if (ErrorDataModel.Instance.EvalWebResult(args.Result))
     {
         ConnectionString = args.Result.Value1;
         IsConnected = true;
         User = args.Result.Value2;
         //LoginView.Close();
     }
     else
         IsConnected = false;
     RaisePropertyChange("IsConnected");
 }
コード例 #47
0
        /// <summary>
        /// Appel une fois que l'utilisateur est connecté à Skydrive
        /// Génère et Upload le fichier XLS
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void auth_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            if (!App.IsConnected())
            {
                MessageBox.Show("Vous n'êtes pas connecté à internet");
                return;
            }

            try
            {
                List<RoadMap> _roadmaps = new List<RoadMap>();
                _roadmaps.Add(this.myRoadM);

                string filename = "rapport-planmyway-" + myRoadM.Date.ToShortDateString().Replace("/", "-") + ".xlsx";
                Debug.WriteLine(filename);
                //SaveTableur();
                SpreadSheetRoadmapGenerator.GenerateXLS(filename, _roadmaps, (double)settings["ConsoCarburant"], (double)settings["PrixCarburant"]);
                if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected)
                {
                    myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
                    fileStream = myIsolatedStorage.OpenFile(filename, FileMode.Open, FileAccess.Read);
                    reader = new StreamReader(fileStream);
                    App.Session = e.Session;
                    LiveConnectClient client = new LiveConnectClient(e.Session);
                    client.UploadCompleted += client_UploadCompleted;
                    client.UploadAsync("me/skydrive", filename, reader.BaseStream, OverwriteOption.Overwrite);

                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                MessageBox.Show(exception.Message);
                //this.enableInterface();
            }
        }
コード例 #48
0
        private void LoginCompleted(Object sender, LoginCompletedEventArgs e)
        {
            try
            {
                objLogin = e.Result;
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }
                objPerent.DataSelect((int)geWebServiceCallKbn.Login, (object)objLogin);

            }
            catch (Exception ex)
            {
                this.ProcessingDlgClose();
                ExMessageBox.Show(CLASS_NM + ".LoginCompleted" + Environment.NewLine + ex.ToString(), "エラー確認");
            }
            finally
            {
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }
            }
        }
コード例 #49
0
        private void _dataService_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            this._currentUserID = e.userID;
            this.SetAuthorized(e.Result);
            if (!e.Result)
            {
                this.ShowWaringDialog("Your account is not authorized to run the application. \nPlease check your username, password");
            }
            else
            {
                //this.InitializeWCFService();
                //this._refreshServerTimer = new System.Windows.Forms.Timer();
                //this._refreshServerTimer.Interval = 300000;
                //this._refreshServerTimer.Tick += new System.EventHandler(this._refreshServer_Tick);
                //this._refreshServerTimer.Start();
                btnSignMeIn.Enabled = true;
            }

            base.UseWaitCursor = false;
        }        
コード例 #50
0
 private void OnAuthClientInitializeCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         this.liveConnectClient = new LiveConnectClient(e.Session);
         base.MessengerInstance.Send<SessionState, URLSelectorSkydrivePage>(new SessionState() { State = SessionStateConverter.Convert(e.Status) });
     }
     else
     {
         this.liveAuthClient.LoginCompleted += OnAuthClientLoginCompleted;
         this.liveAuthClient.LoginAsync(scopes);
     }
 }
コード例 #51
0
 private void OnAuthClientLoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         this.liveConnectClient = new LiveConnectClient(e.Session);
         this.targetFolder = null;
         this.currentFolder = null;
         this.history.Clear();
         liveConnectClient.GetAsync("me/skydrive/files");
         liveConnectClient.GetCompleted += this.OnGetCompleted;
     }
     else
     {
         base.MessengerInstance.Send<ScreenLock, URLSelectorSkydrivePage>(ScreenLock.Release());
     }
     base.MessengerInstance.Send<SessionState, URLSelectorSkydrivePage>(new SessionState() { State = SessionStateConverter.Convert(e.Status) });
 }
コード例 #52
0
 private void LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     LoginComplete(e);
 }
コード例 #53
0
 void greetUser_LoginCompleted(object sender, LoginCompletedEventArgs e)
 {
     if (e.Status == LiveConnectSessionStatus.Connected)
     {
         liveConnect = new LiveConnectClient(e.Session);
         liveConnect.GetCompleted +=
             new EventHandler<LiveOperationCompletedEventArgs>(greetUser_GetCompleted);
         liveConnect.GetAsync("me");
     }
     else
     {
         Debug.WriteLine("Could not finish SkyDrive login.");
         MessageBox.Show("Sorry. Could not log in to SkyDrive. Please try again.");
     }
 }
コード例 #54
0
        //处理登陆结果
        void ShowLoginResult(object sender, LoginCompletedEventArgs e)
        {
            if (e.Result.Success)
            {
                DataManager.SetValue(DataKey.IWorld_Backstage_AdministratorInfo, e.Result.Info);
                ViewModelService.JumpTo(Page.首页);
            }
            else
            {
                this.Error = e.Result.Error;

                DataManager.RemoveValue(DataKey.IWorld_Backstage_AdministratorInfo);
                DataManager.RemoveValue(DataKey.IWorld_Backstage_RememberMe);
                this.RememberMe = false;
                IsBusy = false;
            }
        }
コード例 #55
0
        private void AuthClient_LoginCompleted( object sender, LoginCompletedEventArgs e )
        {
            if ( e.Status == LiveConnectSessionStatus.Connected )
            {
                UpdateState( "Log in completed" );
                HandleLoginCompleted( e.Session, ( string )e.UserState );
            }
            else
            {
                UpdateState( "Log in failed" );

                if ( e.Error != null )
                {
                    string msg = string.Format( AppResources.SignInFailure, e.Error.Message );
                    MessageBox.Show( msg, AppResources.SignInFailureTitle, MessageBoxButton.OK );
                }

                mLiveConnectClient = null;
            }
        }
コード例 #56
0
 private void LoginComplete(LoginCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         WriteLoginMessage("Error logging in. " + e.Error.Message);
     }
     else
     {
         if (e.Result == null)
         {
             WriteLoginMessage("Login failed.");
         }
         else
         {
             if (Authenticated != null)
             {
                 Authenticated(m_loginUsername, e.Result);
             }
         }
     }
 }
コード例 #57
0
        void ShowLoginResult(object sender, LoginCompletedEventArgs e)
        {
            string dataKeyOfUsername = DataKey.Client_Username.ToString();
            string dataKeyOfRememberMe = DataKey.Client_RememberMe.ToString();
            if (e.Result == true)
            {
                IsolatedStorageSettings.ApplicationSettings[dataKeyOfUsername] = tUsername;
                IsolatedStorageSettings.ApplicationSettings.Save();

                ViewModelService.Current.JumpTo(Page.IndexPage);
            }
            else
            {
                this.Error = "用户名/密码错误,请重试";

                IsolatedStorageSettings.ApplicationSettings.Remove(dataKeyOfUsername);
                IsolatedStorageSettings.ApplicationSettings.Remove(dataKeyOfRememberMe);
                IsolatedStorageSettings.ApplicationSettings.Save();
                this.RememberMe = false;
            }
            IsBusy = false;
        }
        private void LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            var state = (ServiceCallState <User>)e.UserState;

            state.Complete(e, () => e.Result);
        }
コード例 #59
0
        static void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            lock (m_syncRoot)
            {
                MySectorServiceClient client = (MySectorServiceClient)sender;
                client.LoginCompleted -= client_LoginCompleted;

                if (e.Error != null)
                {
                    // On error, close client
                    SafeClose();
                }
            }
        }