示例#1
0
        private async void BtnLogin_Click()
        {
            // Call Business Api
            ILoginActivity loginActivity = Activity as ILoginActivity;

            if (loginActivity == null)
            {
                return;
            }

            var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager);

            LoginStatusEnum result = LoginStatusEnum.LoginFailure;

            try
            {
                result = await LoginUtil.Instance.ValidateUserLogin(
                    etEmail.Text, etPassword.Text,
                    ConfigurationService.GetAllCountryMap()[selectCountryIndex].CountryCode);
            }
            catch (Exception ee)
            {
                // force app exit
                // The common api should not throw any exception!
                throw ee;
            }

            AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation(
                (IAsyncTaskActivity)Activity,
                a =>
            {
                SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag);
                ProcessLoginResult(result);
            });
        }
示例#2
0
        private void ProcessResetPasswordResult(PasswordChangeEnum result)
        {
            var loginActivity = Activity as ILoginActivity;

            if (loginActivity == null)
            {
                return;
            }
            switch (result)
            {
            case PasswordChangeEnum.ChangeSuccess:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ChangePasswordTitle,
                    Resource.String.ChangePasswordSucceed,
                    0,
                    -1,
                    ChangePasswordSucceedDialog);
                break;
            }

            case PasswordChangeEnum.LengthInvalid:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ChangePasswordTitle,
                    Resource.String.ChangePasswordError_LengthInvalid);
                break;
            }

            case PasswordChangeEnum.NotMatch:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ChangePasswordTitle,
                    Resource.String.ChangePasswordError_NotMatch);
                break;
            }

            case PasswordChangeEnum.ChangeFailure:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ChangePasswordTitle,
                    Resource.String.ChangePasswordError_ChangeFail);
                break;
            }

            case PasswordChangeEnum.NetDisconnected:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ChangePasswordTitle,
                    Resource.String.LoginErrorMessage_NetDisconnected);
                break;
            }
            }
        }
        private void GetPublicationListOnline(bool showWaitDialog)
        {
            var runningTask = AsyncTaskManager.INSTATNCE.FindTaskByType(typeof(Task <OnlinePublicationResult>));

            if (runningTask == null)
            {
                var task = PublicationUtil.Instance.GetPublicationOnline();
                AsyncTaskManager.INSTATNCE.RegisterTask(task);

                string dialogTag = null;
                if (showWaitDialog)
                {
                    dialogTag = DialogGenerator.ShowWaitDialog(Activity.SupportFragmentManager);
                }

                Application.SynchronizationContext.Post(async delegate
                {
                    var result = await task;
                    if (!AsyncTaskManager.INSTATNCE.UnregisterTask(task))
                    {
                        // User has logged off
                        return;
                    }

                    if (result.RequestStatus == RequestStatusEnum.Success)
                    {
                        DataCache.INSTATNCE.PublicationManager.SetPublicationList(result.Publications);
                    }

                    AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation(
                        (IAsyncTaskActivity)Activity,
                        a =>
                    {
                        if (dialogTag != null)
                        {
                            SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag);
                        }

                        if (DataCache.INSTATNCE.PublicationManager.PublicationList == null || DataCache.INSTATNCE.PublicationManager.PublicationList.Count == 0)
                        {
                            tvNoTitleMessage.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            tvNoTitleMessage.Visibility = ViewStates.Gone;
                        }

                        if (result.RequestStatus == RequestStatusEnum.Success)
                        {
                            SetFilter();
                        }
                    });
                }, null);
            }
        }
示例#4
0
 private void OnDeletePub(ObjHolder <Publication> pub)
 {
     DialogGenerator.ShowMessageDialog(
         Activity.SupportFragmentManager,
         Resource.String.OrganisePub_DeletePubWarning_Title,
         Resource.String.OrganisePub_DeletePubWarning_Message,
         Resource.String.Delete,
         0,
         OrganisePublicationsFragment.DeletePubWarningDialog,
         pub.Value.BookId.ToString());
 }
 void OnDeleteClicked(object sender, EventArgs e)
 {
     // raise a dialog;
     DialogGenerator.ShowMessageDialog(
         ((DraggablePublicationListAdapter)adapter).Activity.SupportFragmentManager,
         Resource.String.OrganisePub_DeletePubWarning_Title,
         Resource.String.OrganisePub_DeletePubWarning_Message,
         Resource.String.Delete,
         0,
         OrganisePublicationsFragment.DeletePubWarningDialog,
         Publication.Value.BookId.ToString());
 }
示例#6
0
        public void ProcessDownloadResult(DownloadResult result, int bookId)
        {
            var dialogTag = SimpleDialogFragment.FindFragmentTagByExtraTag(
                this,
                (extTagKey, extTag) =>
                extTagKey == PublicationExtInfo.CANCELDOWNLOAD_CONFIRM_DIALOG_EXTRATAG &&
                Int32.Parse(extTag) == bookId);

            if (dialogTag != null)
            {
                SimpleDialogFragment.DismissDialog(this, dialogTag);
            }

            switch (result.DownloadStatus)
            {
            case DownLoadEnum.Success:
                // need not do any thing.
                break;

            case DownLoadEnum.Canceled:
                // need not do any thing.
                break;

            case DownLoadEnum.Failure:
                DialogGenerator.ShowMessageDialog(
                    SupportFragmentManager,
                    Resource.String.DetailInfo_InstallError_Title,
                    Resource.String.DetailInfo_InstallError_Message);
                break;

            case DownLoadEnum.OverLimitation:
                // raise a dialog;
                DialogGenerator.ShowMessageDialog(
                    this.SupportFragmentManager,
                    Resource.String.NetworkFlow_Warning_Title,
                    Resource.String.NetworkFlow_Warning_Message,
                    Resource.String.NetworkFlow_Warning_Download,
                    0,
                    NetworkFlowOverLimitationDialog);
                break;

            case DownLoadEnum.NetDisconnected:
                DialogGenerator.ShowMessageDialog(
                    SupportFragmentManager,
                    Resource.String.DownloadFailded_NetDisconnected_Title,
                    Resource.String.DownloadFailded_NetDisconnected_Message);
                break;
            }

            this.UpdatePublicationDownloadingProgress(bookId);
            this.UpdatePublicationDetailInfo(bookId);
        }
示例#7
0
        public void ShowPleaseWaitDialog()
        {
            LogHelper.Debug("dbg", "RotateWait::Try to find wait");
            var dialogTag = SimpleDialogFragment.FindFragmentTagByExtraTag(
                this,
                (extTagKey, extTag) =>
                extTagKey == WebViewManager.PleaseWaitPageLoadDialogExtTagKey);

            if (dialogTag == null)
            {
                LogHelper.Debug("dbg", "RotateWait::Not found Wait");
                DialogGenerator.ShowWaitDialog(
                    SupportFragmentManager,
                    0,
                    WebViewManager.PleaseWaitPageLoadDialogExtTagKey);
            }
            LogHelper.Debug("dbg", "RotateWait::The Wait is shown here.");
        }
示例#8
0
        private async void ProcessSend()
        {
            ILoginActivity loginActivity = Activity as ILoginActivity;

            if (loginActivity == null)
            {
                return;
            }

            var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager);

            var result = await LoginUtil.Instance.ChangePassword(etNewPassword.Text, etRetypeNewPassword.Text);

            AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation(
                (IAsyncTaskActivity)Activity,
                a =>
            {
                SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag);
                ProcessResetPasswordResult(result);
            });
        }
示例#9
0
        private void OnMouseUp()
        {
            isMoving        = false;
            sizingDirection = SizingDirection.None;

            Point topLeft = PointToScreen(new Point(control.Left, control.Top));

            topLeft = Parent.PointToClient(topLeft);

            wixFiles.UndoManager.BeginNewCommandRange();

            AssignIfChanged(xmlNode.Attributes["Width"], DialogGenerator.PixelsToDialogUnitsWidth(control.Width));
            AssignIfChanged(xmlNode.Attributes["X"], DialogGenerator.PixelsToDialogUnitsWidth(topLeft.X));
            AssignIfChanged(xmlNode.Attributes["Height"], DialogGenerator.PixelsToDialogUnitsHeight(control.Height));
            AssignIfChanged(xmlNode.Attributes["Y"], DialogGenerator.PixelsToDialogUnitsHeight(topLeft.Y));

            if (ItemChanged != null)
            {
                ItemChanged(xmlNode);
            }
        }
示例#10
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddBot <MyBot>(options =>
            {
                // Create a storage to persist our values
                IStorage dataStore = new MemoryStorage();

                // Store ConverstationState (for current conversation) and UserState (for tracking user interaction)
                var conversationState = new ConversationState(dataStore);
                var userState         = new UserState(dataStore);

                options.CredentialProvider = new ConfigurationCredentialProvider(configuration);

                // Add the State to the bot
                options.State.Add(conversationState);
                options.State.Add(userState);
            });

            DialogGenerator dialogGenerator = new DialogGenerator();

            dialogGenerator.InitializeDialogGenerator(services, Path.GetFullPath("generator/luisDialog.json"));
        }
示例#11
0
        private async void processReminderPassword()
        {
            ILoginActivity loginActivity = Activity as ILoginActivity;

            if (loginActivity == null)
            {
                return;
            }

            var dialogTag = DialogGenerator.ShowWaitDialog(FragmentManager);

            var result = await LoginUtil.Instance.ResetPassword(
                etEmail.Text,
                ConfigurationService.GetAllCountryMap()[selectCountryIndex].CountryCode);

            AsyncUIOperationRepeater.INSTATNCE.SubmitAsyncUIOperation(
                (IAsyncTaskActivity)Activity,
                a =>
            {
                SimpleDialogFragment.DismissDialog(((FragmentActivity)a), dialogTag);
                ProcessResetPasswordResult(result);
            });
        }
示例#12
0
 public MyBot(DialogLibAccessors accessors, DialogGenerator dialogGenerator)
 {
     _accessors       = accessors ?? throw new System.ArgumentNullException(nameof(accessors));
     _dialogGenerator = dialogGenerator ?? throw new System.ArgumentNullException(nameof(dialogGenerator));
 }
示例#13
0
        private void ProcessResetPasswordResult(PasswordResetEnum result)
        {
            switch (result)
            {
            case PasswordResetEnum.EmailNotExist:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPasswordError);
                break;
            }

            case PasswordResetEnum.ResetSuccess:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordTitle,
                    Resource.String.ReminderPasswordSucceed,
                    0,
                    -1,
                    ReminderPasswordSucceedDialog
                    );
                break;
            }

            case PasswordResetEnum.InvalidEmail:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPassword_ErrorTitleErrorMessage,
                    Resource.String.ReminderPassword_InvalidEmail);
                break;
            }

            case PasswordResetEnum.DeviceIdNotMatched:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPassword_DeviceIdNotMatched);
                break;
            }

            case PasswordResetEnum.SelectCountry:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.LoginErrorMessage_SelectCountry);
                break;
            }

            case PasswordResetEnum.NetDisconnected:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.LoginErrorMessage_NetDisconnected);
                break;
            }

            case PasswordResetEnum.ResetFailure:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPassword_ResetFailure);
                break;
            }
            }

            return;
        }
示例#14
0
        private void ProcessLoginResult(LoginStatusEnum result)
        {
            var loginActivity = Activity as ILoginActivity;

            if (loginActivity == null)
            {
                return;
            }

            switch (result)
            {
            case LoginStatusEnum.LoginSuccess:
            {
                if (GlobalAccess.Instance.CurrentUserInfo.NeedChangePassword)
                {
                    ResetPasswordDialogFragment resetPasswordDialogFragment = new ResetPasswordDialogFragment();
                    resetPasswordDialogFragment.Show(FragmentManager.BeginTransaction(), "resetPasswordDialogFragment");
                }
                else
                {
                    loginActivity.LoginSucceed();
                }
                break;
            }

            case LoginStatusEnum.NetDisconnected:
            {
                // 2
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.LoginErrorMessage_NetDisconnected_Title,
                    Resource.String.LoginErrorMessage_NetDisconnected);
                break;
            }

            case LoginStatusEnum.InvalidemailAndValidPwd:
            {
                // 7
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_InvalidemailAndValidPwd));
                break;
            }

            case LoginStatusEnum.ValidemailAndInvalidPwd:
            {
                // 8
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_ValidemailAndInvalidPwd));
                break;
            }

            case LoginStatusEnum.InvalidemailAndInvalidPwd:
            {
                // 9
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_InvalidemailAndInvalidPwd));
                break;
            }

            case LoginStatusEnum.ValidemailAndEmptyPwd:
            {
                // 10
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_ValidemailAndEmptyPwd));
                break;
            }

            case LoginStatusEnum.EmptyemailAndValidPwd:
            {
                // 11
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_EmptyemailAndValidPwd));
                break;
            }

            case LoginStatusEnum.InvalidemailAndEmptyPwd:
            {
                // 12
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_InvalidemailAndEmptyPwd));
                break;
            }

            case LoginStatusEnum.SelectCountry:
            {
                // 13
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_SelectCountry));
                break;
            }

            case LoginStatusEnum.EmailOrPwdError:
            {
                // may be 7
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_EmailOrPwdError));
                break;
            }

            case LoginStatusEnum.AccountNotExist:
            {
                // 19
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.LoginErrorMessage_AccountNotExistTitle,
                    Resource.String.LoginErrorMessage_AccountNotExist);
                break;
            }

            case LoginStatusEnum.EmptyEmailAndEmptyPwd:
            {
                // may be 11
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_EmptyEmailAndEmptyPwd));
                break;
            }

            case LoginStatusEnum.DeviceLimit:
            {
                // Not provide
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_DeviceLimit));
                break;
            }

            case LoginStatusEnum.LoginFailure:
            {
                // Not provide
                SetLoginWaringMessage(
                    Activity.Resources.GetString(Resource.String.LoginErrorMessage_LoginFailure));
                break;
            }
            }
        }