Пример #1
0
 private async void TapBackToDetailPage(object sender, System.EventArgs e)
 {
     await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
     {
         await Navigation.PopPopupAsync();
     });
 }
Пример #2
0
        public async Task <ConfirmPopup> Show(string title            = null, string message = null, string closeButtonText = null,
                                              ICommand closeCommand   = null, object closeCommandParameter = null,
                                              string acceptButtonText = null, ICommand acceptCommand       = null, object acceptCommandParameter = null,
                                              bool isAutoClose        = false, uint duration = 2000)
        {
            // Close Loading Popup if it is showing
            await LoadingPopup.Instance.Hide();

            await DeviceExtension.BeginInvokeOnMainThreadAsync(() =>
            {
                if (title != null)
                {
                    LabelConfirmTitle.Text = title;
                }

                if (message != null)
                {
                    LabelConfirmMessage.Text = message;
                }

                if (closeButtonText != null)
                {
                    ButtonConfirmClose.Text = closeButtonText;
                }

                ClosedPopupCommand          = closeCommand;
                ClosedPopupCommandParameter = closeCommandParameter;

                if (acceptButtonText != null)
                {
                    ButtonConfirmAccept.Text = acceptButtonText;
                }

                AcceptCommand          = acceptCommand;
                AcceptCommandParameter = acceptCommandParameter;

                IsAutoClose = isAutoClose;
                Duration    = duration;
            });

            if (IsClosed)
            {
                IsClosed = false;

                if (isAutoClose && duration > 0)
                {
                    AutoClosedPopupAfter(duration);
                }

                await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
                {
                    await Application.Current.MainPage.Navigation.PushPopupAsync(this);
                });
            }

            return(this);
        }
Пример #3
0
 private async void BackToDetailPageExe()
 {
     if (ViewImagePopUp.Scale == 1)
     {
         await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
         {
             await Navigation.PopPopupAsync();
         });
     }
 }
Пример #4
0
        public async Task <MessagePopup> Show(string message        = null, string closeButtonText = null,
                                              ICommand closeCommand = null, object closeCommandParameter = null, string textBackgroundColor = null,
                                              bool isAutoClose      = false, uint duration = 2000)
        {
            // Close Loading Popup if it is showing
            await LoadingPopup.Instance.Hide();

            await DeviceExtension.BeginInvokeOnMainThreadAsync(() =>
            {
                if (textBackgroundColor != null)
                {
                    LayoutButton.BackgroundColor = Color.FromHex(textBackgroundColor);
                }
                else
                {
                    LayoutButton.BackgroundColor = backGroundDefault;
                }

                if (message != null)
                {
                    LabelMessageContent.Text = message;
                }

                if (closeButtonText != null)
                {
                    ButtonMessageClose.Text = closeButtonText;
                }

                ClosedPopupCommand          = closeCommand;
                ClosedPopupCommandParameter = closeCommandParameter;

                IsAutoClose = isAutoClose;
                Duration    = duration;
            });

            if (IsClosed)
            {
                IsClosed = false;

                if (isAutoClose && duration > 0)
                {
                    AutoClosedPopupAfter(duration);
                }

                await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
                {
                    await Application.Current.MainPage.Navigation.PushPopupAsync(this);
                });
            }

            return(this);
        }
Пример #5
0
        private async void LogoutExecute()
        {
            await CheckBusy(async() =>
            {
                SqLiteService.DeleteAll <UserModel>();

                // Navigate to Login page
                await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
                {
                    await Navigation.NavigateAsync(new Uri($"{ManagerPage.NavigationHomeUri}/{ManagerPage.LoginPage}"));
                });
            });
        }
Пример #6
0
        public async Task Hide()
        {
            if (IsLoading)
            {
                await Task.Delay(200);

                IsLoading = false;

                await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
                {
                    Indicator.IsRunning = false;
                    await Navigation.PopPopupAsync();
                });
            }
        }
Пример #7
0
        private async void AcceptPopupEvent(object sender, EventArgs e)
        {
            await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
            {
                await Navigation.PopPopupAsync();
            });

            // waiting for close animation finished
            await Task.Delay(300);

            AcceptCommand?.Execute(AcceptCommandParameter);

            //_popupId++;
            IsClosed = true;
        }
Пример #8
0
        public async Task <QRCodePopup> Show(string qrCodeValue,
                                             ICommand closeCommand = null, object closeCommandParameter = null,
                                             bool isAutoClose      = false, uint duration = 2000)
        {
            IsClosed = false;

            if (qrCodeValue == null)
            {
                Debug.WriteLine("[Error][Exception]: QRCodePopup cannot be shown because of null QR code value");
                return(null);
            }
            else
            {
                QRCodeView.BarcodeValue = qrCodeValue;
            }

            if (closeCommand != null)
            {
                ClosePopupCommand = closeCommand;
            }

            if (closeCommandParameter != null)
            {
                ClosePopupCommandParameter = closeCommandParameter;
            }

            IsAutoClose = isAutoClose;
            Duration    = duration;

            if (isAutoClose && duration > 0)
            {
                AutoClosePopupAfter(duration);
            }

            await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
            {
                await App.Current.MainPage.Navigation.PushPopupAsync(this);
            });

            return(this);
        }
Пример #9
0
        public async Task Show(string loadingMessage = null)
        {
            await DeviceExtension.BeginInvokeOnMainThreadAsync(() =>
            {
                LabelMessage.Text = !string.IsNullOrWhiteSpace(loadingMessage)
                    ? loadingMessage : TranslateExtension.Get("Loading");
            });

            if (IsLoading)
            {
                return;
            }

            IsLoading = true;

            await DeviceExtension.BeginInvokeOnMainThreadAsync(async() =>
            {
                Indicator.IsRunning = true;
                await Application.Current.MainPage.Navigation.PushPopupAsync(this);
            });
        }