コード例 #1
0
 private void mgr_ConnectionCheckComplete(object sender, ServerConnectStatusEventArgs e)
 {
     ((CrmConnectionManager)sender).ConnectionCheckComplete      -= mgr_ConnectionCheckComplete;
     ((CrmConnectionManager)sender).ServerConnectionStatusUpdate -= mgr_ServerConnectionStatusUpdate;
     if (!e.Connected)
     {
         if (e.MultiOrgsFound)
         {
             MessageBox.Show("Unable to Login to CRM using cached credentials. Org Not found", "Login Failure");
         }
         else
         {
             MessageBox.Show("Unable to Login to CRM using cached credentials", "Login Failure");
         }
         resetUiFlag = true;
         CrmLoginCtrl.GoBackToLogin();
         Dispatcher.Invoke(DispatcherPriority.Normal,
                           new System.Action(() =>
         {
             this.Title = "Failed to Login with cached credentials.";
             MessageBox.Show(this.Title, "Notification from ConnectionManager", MessageBoxButton.OK, MessageBoxImage.Error);
             CrmLoginCtrl.IsEnabled = true;
         }
                                             ));
         resetUiFlag = false;
     }
     else
     {
         if (e.Connected && !bIsConnectedComplete)
         {
             ProcessSuccess();
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Complete Event from the Auto Login process
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mgr_ConnectionCheckComplete(object sender, ServerConnectStatusEventArgs e)
 {
     ((CrmConnectionManager)sender).ConnectionCheckComplete      -= this.mgr_ConnectionCheckComplete;
     ((CrmConnectionManager)sender).ServerConnectionStatusUpdate -= this.mgr_ServerConnectionStatusUpdate;
     if (!e.Connected)
     {
         MessageBox.Show(
             e.MultiOrgsFound
                 ? "Unable to Login to CRM using cached credentials. Org Not found"
                 : "Unable to Login to CRM using cached credentials", "Login Failure");
         this.resetUiFlag = true;
         this.CrmLoginCtrl.GoBackToLogin();
         ThreadHelper.JoinableTaskFactory.Run(async delegate {
             await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
             base.Title = "Failed to Login with cached credentials.";
             MessageBox.Show(base.Title, "Notification from CRM ConnectionManager", MessageBoxButton.OK, MessageBoxImage.Hand);
             this.CrmLoginCtrl.IsEnabled = true;
         });
         this.resetUiFlag = false;
         return;
     }
     if (e.Connected && !this.bIsConnectedComplete)
     {
         this.ProcessSuccess();
     }
 }
コード例 #3
0
 /// <summary>
 /// Updates from the Auto Login process.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mgr_ServerConnectionStatusUpdate(object sender, ServerConnectStatusEventArgs e)
 {
     ThreadHelper.JoinableTaskFactory.Run(async delegate {
         await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         this.Title = (string.IsNullOrWhiteSpace(e.StatusMessage) ? e.ErrorMessage : e.StatusMessage);
     });
 }
コード例 #4
0
 private void mgr_ServerConnectionStatusUpdate(object sender, ServerConnectStatusEventArgs e)
 {
     Dispatcher.Invoke(DispatcherPriority.Normal,
                       new System.Action(() =>
     {
         this.Title = string.IsNullOrWhiteSpace(e.StatusMessage) ? e.ErrorMessage : e.StatusMessage;
     }
                                         ));
 }
コード例 #5
0
 private void mgr_ServerConnectionStatusUpdate(object sender, ServerConnectStatusEventArgs e)
 {
     // The Status event will contain information about the current login process,  if Connected is false, then there is not yet a connection.
     // Set the updated status of the loading process.
     Dispatcher.Invoke(DispatcherPriority.Normal,
                       new Action(() =>
     {
         Title = string.IsNullOrWhiteSpace(e.StatusMessage) ? e.ErrorMessage : e.StatusMessage;
     }));
 }
コード例 #6
0
        private void mgr_ConnectionCheckComplete(object sender, ServerConnectStatusEventArgs e)
        {
            // The Status event will contain information about the current login process,  if Connected is false, then there is not yet a connection.
            // Unwire events that we are not using anymore, this prevents issues if the user uses the control after a failed login.
            ((CrmConnectionManager)sender).ConnectionCheckComplete      -= mgr_ConnectionCheckComplete;
            ((CrmConnectionManager)sender).ServerConnectionStatusUpdate -= mgr_ServerConnectionStatusUpdate;

            if (!e.Connected)
            {
                // if its not connected pop the login screen here.
                if (e.MultiOrgsFound)
                {
                    MessageBox.Show("Unable to Login to CRM using cached credentials. Org Not found", "Login Failure");
                }
                else
                {
                    MessageBox.Show("Unable to Login to CRM using cached credentials", "Login Failure");
                }

                _resetUiFlag = true;
                CrmLoginCtrl.GoBackToLogin();
                // Bad Login Get back on the UI.
                Dispatcher.Invoke(DispatcherPriority.Normal,
                                  new Action(() =>
                {
                    Title = "Failed to Login with cached credentials.";
                    MessageBox.Show(Title, "Notification from ConnectionManager", MessageBoxButton.OK, MessageBoxImage.Error);
                    CrmLoginCtrl.IsEnabled = true;
                }));

                _resetUiFlag = false;
            }
            else
            {
                // Good Login Get back on the UI
                if (e.Connected && !_bIsConnectedComplete)
                {
                    ProcessSuccess();
                }

                OutputLogger.WriteToOutputWindow(HostWindow.GetCaption(string.Empty, _mgr.CrmSvc).Substring(3), MessageType.Info);
            }
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender">The Sender</param>
        /// <param name="e">The <see cref="ServerConnectStatusEventArgs"/> instance containing the event data.</param>
        private void CrmConnectionManager_ConnectionCheckCompleted(object sender, ServerConnectStatusEventArgs e)
        {
            // The Status event will contain information about the current login process,  if Connected is false, then there is not yet a connection.
            // Unwire events that we are not using anymore, this prevents issues if the user uses the control after a failed login.
            ((CrmConnectionManager)sender).ConnectionCheckComplete      -= CrmConnectionManager_ConnectionCheckCompleted;
            ((CrmConnectionManager)sender).ServerConnectionStatusUpdate -= CrmConnectionManager_ServerConnectionStatusUpdateRaised;

            if (!e.Connected)
            {
                // if its not connected pop the login screen here.
                if (e.MultiOrgsFound)
                {
                    MessageBox.Show("Unable to Login to CRM using cached credentials. Org Not found", "Login Failure");
                }
                else
                {
                    MessageBox.Show("Unable to Login to CRM using cached credentials", "Login Failure");
                }

                resetUiFlag = true;
                this.CrmLoginControl.GoBackToLogin();

                // Bad Login Get back on the UI.
                Dispatcher.Invoke(DispatcherPriority.Normal,
                                  new System.Action(() =>
                {
                    this.Title = "Failed to Login with cached credentials.";
                    MessageBox.Show(this.Title, "Notification from ConnectionManager", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.CrmLoginControl.IsEnabled = true;
                }
                                                    ));
                this.resetUiFlag = false;
            }
            else
            {
                // Good Login Get back on the UI
                if (e.Connected && !this.connectionState)
                {
                    ProcessSuccess();
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Complete Event from the Auto Login process
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mgr_ConnectionCheckComplete(object sender, ServerConnectStatusEventArgs e)
        {
            // The Status event will contain information about the current login process,  if Connected is false, then there is not yet a connection. 
            // Unwire events that we are not using anymore, this prevents issues if the user uses the control after a failed login. 
            ((CrmConnectionManager)sender).ConnectionCheckComplete -= mgr_ConnectionCheckComplete;
            ((CrmConnectionManager)sender).ServerConnectionStatusUpdate -= mgr_ServerConnectionStatusUpdate;

            if (!e.Connected)
            {
                // if its not connected pop the login screen here. 
                if (e.MultiOrgsFound)
                    MessageBox.Show("Unable to Login to CRM using cached credentials. Org Not found", "Login Failure");
                else
                    MessageBox.Show("Unable to Login to CRM using cached credentials", "Login Failure");

                resetUiFlag = true;
                CrmLoginCtrl.GoBackToLogin();
                // Bad Login Get back on the UI. 
                Dispatcher.Invoke(DispatcherPriority.Normal,
                       new System.Action(() =>
                       {
                           this.Title = "Failed to Login with cached credentials.";
                           MessageBox.Show(this.Title, "Notification from ConnectionManager", MessageBoxButton.OK, MessageBoxImage.Error);
                           CrmLoginCtrl.IsEnabled = true;
                       }
                        ));
                resetUiFlag = false;
            }
            else
            {
                // Good Login Get back on the UI 
                if (e.Connected && !bIsConnectedComplete)
                    ProcessSuccess();
            }

        }
コード例 #9
0
        /// <summary>
        /// Updates from the Auto Login process. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mgr_ServerConnectionStatusUpdate(object sender, ServerConnectStatusEventArgs e)
        {
            // The Status event will contain information about the current login process,  if Connected is false, then there is not yet a connection. 
            // Set the updated status of the loading process. 
            Dispatcher.Invoke(DispatcherPriority.Normal,
                               new System.Action(() =>
                               {
                                   this.Title = string.IsNullOrWhiteSpace(e.StatusMessage) ? e.ErrorMessage : e.StatusMessage;
                               }
                                   ));

        }