예제 #1
0
        // ReSharper disable once UnusedMethodReturnValue.Local
        private async Task SignInRemotelyAsync()
        {
            RemoteSignInResult result;

            using (ActivityIndicator.Start(indicator)) {
                try {
                    result = await ServiceContainer
                             .Resolve <ISignIn>()
                             .SignInRemotelyAsync(username.Text, password.Text);
                } catch (InvalidSettingsException) {
                    WarnAboutInvalidSettings();
                    return;
                }
            }

            switch (result)
            {
            case RemoteSignInResult.Success:
                OnCompletion(new Result(true));
                break;

            case RemoteSignInResult.Unreachable:
                WarnAboutNoConnectivity();
                break;

            case RemoteSignInResult.BadCredentials:
                WarnAboutBadCredentials();
                break;
            }
        }
예제 #2
0
        private async void SignInLocallyAsync()
        {
            LocalSignInResult result;

            using (ActivityIndicator.Start(indicator)) {
                try {
                    result = await ServiceContainer
                             .Resolve <ISignIn>()
                             .SignInLocallyAsync();
                } catch (InvalidSettingsException) {
                    // If he have no settings, we'll consider
                    // the login as expired so the user has a
                    // chance to change them in a new sign in.
                    result = LocalSignInResult.Expired;
                }
            }

            switch (result)
            {
            case LocalSignInResult.Expired:
                ShowSignInForm();
                return;

            case LocalSignInResult.Success:
                NavigateToHome();
                break;
            }
        }
예제 #3
0
        public async Task <bool> SaveAsync()
        {
            if (null == _dataMap)
            {
                return(false);
            }

            using (ActivityIndicator.Start(View)) {
                if (false == _compositeController.Commit())
                {
                    ShowSegmentImpl(0);
                    return(false);
                }

                // TODO: should we reload the table view
                // to refresh data potentially changed by
                // the OnBeforeSave pipeline?
                await new DataRepository().SaveAsync(_dataMap);

                // Refresh our form to update validation
                // status, commands availability, ...
                _compositeController.OnSave();

                SimpleEventBus.Publish(new DataMapSaved(_dataMap.Composite));
            }

            return(true);
        }
예제 #4
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            using (ActivityIndicator.Start(View)) {
                Show();
            }
        }
예제 #5
0
        private async Task SynchronizeAsyncImpl()
        {
            SynchronizationResult result;

            using (ActivityIndicator.Start(View)) {
                result = await new SynchronizationFacade().Synchronize();
                SimpleEventBus.Publish(new DataSynchronized());
            }

            ShowSynchronizationResultMessage(result);
        }
예제 #6
0
        // ReSharper disable once UnusedMember.Local
        // ReSharper disable once UnusedParameter.Local
        partial void Done(UIBarButtonItem sender)
        {
            using (ActivityIndicator.Start(View))
            {
                if (false == _formController.Commit())
                {
                    return;
                }

                // TODO: we're not firing OnSave in the child
                // controller because the changes will only
                // hit the database when the parent controller
                // decides to do it.
                // _formController.OnSave();

                OnCompletion(true);
            }
        }