Exemplo n.º 1
0
        private void ThreadDisplayError(PatcherError error, CancellationToken cancellationToken)
        {
            try
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0}...", error));

                ErrorDialog.Display(error, cancellationToken);

                DebugLogger.Log(string.Format("Patcher error {0} displayed.", error));
            }
            catch (OperationCanceledException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} cancelled.", _userDecision));
            }
            catch (ThreadInterruptedException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} interrupted: thread has been interrupted. Rethrowing exception.", error));
                throw;
            }
            catch (ThreadAbortException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} aborted: thread has been aborted. Rethrowing exception.", error));
                throw;
            }
            catch (Exception)
            {
                DebugLogger.LogWarning(string.Format("Error while displaying patcher error {0}: an exception has occured. Rethrowing exception.", error));
                throw;
            }
        }
Exemplo n.º 2
0
        private void ThreadDisplayError(PatcherErrorMessage error, CancellationToken cancellationToken)
        {
            PatcherStatistics.DispatchSendEvent(PatcherStatistics.Event.PatcherFailed);

            try
            {
                _state.Value = PatcherState.DisplayingError;

                DebugLogger.Log(string.Format("Displaying patcher error {0}...", error.Message));

                ErrorDialog.Display(error, cancellationToken);

                DebugLogger.Log(string.Format("Patcher error {0} displayed.", error.Message));
            }
            catch (OperationCanceledException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} cancelled.", _userDecision));
            }
            catch (ThreadInterruptedException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} interrupted: thread has been interrupted. Rethrowing exception.", error.Message));
                throw;
            }
            catch (ThreadAbortException)
            {
                DebugLogger.Log(string.Format("Displaying patcher error {0} aborted: thread has been aborted. Rethrowing exception.", error.Message));
                throw;
            }
            catch (Exception)
            {
                DebugLogger.LogWarning(string.Format("Error while displaying patcher error {}: an exception has occured. Rethrowing exception.", error.Message));
                throw;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Process the result. Starts the next activity or shows an error dialog.
        /// </summary>
        private void ProcessResult(int result)
        {
            switch (result)
            {
            case CredentialsProvider.NoError:
                if (_saveLoginCheckBox.Checked)
                {
                    _prefsEditor.PutBoolean("saveLogin", true);
                    _prefsEditor.PutString("username", _username);
                    _prefsEditor.PutString("password", _password);
                    _prefsEditor.Apply();
                }
                else
                {
                    _prefsEditor.Clear();
                    _prefsEditor.Apply();
                }


                StartActivity(new Intent(ApplicationContext, typeof(ChooseTeamActivity)));
                Finish();
                break;

            case CredentialsProvider.NoCredentials:
            {
                var dialog = new ErrorDialog(this, Resource.String.dlg_no_credentials_title, Resource.String.dlg_no_credentials);
                dialog.Display();
                break;
            }

            case CredentialsProvider.NoUsername:
            {
                var dialog = new ErrorDialog(this, Resource.String.dlg_no_username_title, Resource.String.dlg_no_username);
                dialog.Display();
                break;
            }

            case CredentialsProvider.NoPassword:
            {
                var dialog = new ErrorDialog(this, Resource.String.dlg_no_password_title, Resource.String.dlg_no_password);
                dialog.Display();
                break;
            }

            case CredentialsProvider.WrongCredentials:
            {
                var dialog = new ErrorDialog(this, Resource.String.dlg_bad_credentials_title, Resource.String.dlg_bad_credentials);
                dialog.Display();
                break;
            }

            case CredentialsProvider.DatabaseConnectionError:
            {
                var dialog = new ErrorDialog(this, Resource.String.dlg_database_error_title, Resource.String.dlg_database_error);
                dialog.Display();
                break;
            }
            }
        }