Example #1
0
        public async Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag, string doNotShowAgainCustomText)
        {
            string[] stringButtons = GetStringButtons(buttons);
            string   popupResult   = await ShowAsync(stringButtons, title, message, dontShowAgainFlag, doNotShowAgainCustomText);

            return(GetPopupResult(popupResult));
        }
Example #2
0
        private string[] GetStringButtons(PopupButtons buttons)
        {
            switch (buttons)
            {
            case PopupButtons.Ok:
                return(new string[] { Texts.ButtonOkText });

            case PopupButtons.Cancel:
                return(new string[] { Texts.ButtonCancelText });

            case PopupButtons.Exit:
                return(new string[] { Texts.ButtonExitText });

            case PopupButtons.OkCancel:
                return(new string[] { Texts.ButtonOkText, Texts.ButtonCancelText });

            case PopupButtons.OkExit:
                return(new string[] { Texts.ButtonOkText, Texts.ButtonExitText });

            case PopupButtons.OkCancelExit:
                return(new string[] { Texts.ButtonOkText, Texts.ButtonCancelText, Texts.ButtonExitText });

            default:
                throw new InvalidOperationException($"Unexpected popup buttons {buttons}.");
            }
        }
Example #3
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="infoMessage">The info message of the popup.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(Icon popupIcon, string title, string infoMessage, PopupButtons buttons)
        {
            var popupWindow = new PopupDialog
            {
                PopupIcon = popupIcon,
                Title = title,
                InfoMessage = infoMessage,
                Buttons = buttons,
                StartPosition = FormStartPosition.CenterParent
            };

            return popupWindow.ShowDialog();
        }
Example #4
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="owner">The owner of the modal popup dialog.</param>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="infoMessage">The info message of the popup.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(IWin32Window owner, Icon popupIcon, string title, string infoMessage,
                                             PopupButtons buttons)
        {
            var popupWindow = new PopupDialog
            {
                PopupIcon     = popupIcon,
                Title         = title,
                InfoMessage   = infoMessage,
                Buttons       = buttons,
                StartPosition = FormStartPosition.CenterParent
            };

            return(popupWindow.ShowDialog(owner));
        }
Example #5
0
        public PopupJs(string title, string content, PopupButtons buttons, int?width, int?height, int maxWidth, int maxHeight, bool autoOpen, bool resizable, bool modal)
        {
            Name = "popup_" + _count++;

            this.Title                    = title;
            this.Content                  = content;
            this.PopupButtons             = buttons;
            this.Width                    = width;
            this.Height                   = height;
            this.MaxWidth                 = maxWidth;
            this.MaxHeight                = maxHeight;
            this.AutoOpen                 = autoOpen;
            this.Resizable                = resizable;
            this.Modal                    = modal;
            this.JsVariableForContentName = null;
        }
Example #6
0
        public SourcedControl()
        {
            Button settings = new Button();

            settings.Click += Settings_Click;
            BitmapImage gear = new BitmapImage();

            gear.BeginInit();
            gear.UriSource = new Uri(@"pack://application:,,,/StealthRobotics.Dashboard.API;component/assets/gear.png");
            gear.EndInit();
            Image i = new Image
            {
                Source = gear
            };

            settings.Content = i;
            PopupButtons.Add(settings);

            Button close = new Button();

            close.Click += Close_Click;
            Path x = new Path()
            {
                //same color as the gear
                Stroke          = new SolidColorBrush(Color.FromRgb(51, 51, 51)),
                Data            = Geometry.Parse("M 3 3 L 13 13 M 3 13 L 13 3"),
                StrokeThickness = 3,
                Width           = 16,
                Height          = 16
            };

            close.Content = x;
            PopupButtons.Add(close);

            TextBlock label = new TextBlock();

            adorner.Children.Add(label);
            label.Margin = new Thickness(24, 2, 24, 2);
            label.SetBinding(TextBlock.TextProperty, this, "Label");
            label.SetBinding(TextBlock.HorizontalAlignmentProperty, this, "LabelHorizontalAlignment");
            label.SetBinding(TextBlock.VerticalAlignmentProperty, this, "LabelVerticalAlignment");
            label.SetBinding(TextBlock.VisibilityProperty, this, "LabelVisibility");

            AllowDrop = true;
            DragOver += SourcedControl_DragOver;
            Drop     += SourcedControl_Drop;
        }
Example #7
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="owner">The owner of the modal popup dialog.</param>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="exception">The exception to handle in the popup-information.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(IWin32Window owner, Icon popupIcon, string title, Exception exception,
                                             PopupButtons buttons)
        {
            if (LoggedIntoEventlog(popupIcon, exception.ToString()))
            {
                return(DialogResult.OK);
            }
            var popupWindow = new PopupDialog
            {
                PopupIcon     = popupIcon,
                Title         = title,
                InfoMessage   = exception.Message,
                StartPosition = FormStartPosition.CenterParent,
                Buttons       = buttons,
                Exception     = exception
            };

            return(popupWindow.ShowDialog());
        }
        private async Task <AccountStatus> VerifyAccountOnline()
        {
            if (!await IsVerified())
            {
                return(AccountStatus.Unverified);
            }

            if (AlreadyVerified)
            {
                AlreadyVerified = false;
                await New <IPopup>().ShowAsync(PopupButtons.Ok, Texts.InformationTitle, Texts.AlreadyVerifiedInfo);
            }

            PopupButtons result = await New <IPopup>().ShowAsync(PopupButtons.OkCancel, Texts.WelcomeToAxCryptTitle, Texts.ResourceManager.GetString(_welcomeMessage.Name));

            if (result == PopupButtons.Ok)
            {
                New <IBrowser>().OpenUri(new Uri(Texts.LinkToGettingStarted));
            }
            return(AccountStatus.Verified);
        }
Example #9
0
        private async Task <bool> NewVersionAvailablePopupAsync(bool alwaysDisplay, DownloadVersion downloadVersion)
        {
            Version version = downloadVersion.Version;

            if (New <IVersion>().Current >= version)
            {
                return(false);
            }

            if (!alwaysDisplay && New <UserSettings>().MostRecentVersionInformed == version.ToString())
            {
                return(false);
            }
            New <UserSettings>().MostRecentVersionInformed = version.ToString();

            PopupButtons result = await New <IPopup>().ShowAsync(PopupButtons.OkCancel, Texts.InformationTitle, Texts.NewVersionIsAvailableText.InvariantFormat(version));

            if (result == PopupButtons.Ok)
            {
                New <IBrowser>().OpenUri(Resolve.UserSettings.UpdateUrl);
            }

            return(true);
        }
Example #10
0
        public async Task LocalSignInWarningPopUpAsync(bool isLoggedOn)
        {
            if (New <AxCryptOnlineState>().IsOffline)
            {
                return;
            }

            if (!isLoggedOn)
            {
                return;
            }

            if (!await IsAccountSourceLocal())
            {
                return;
            }

            PopupButtons click = await New <IPopup>().ShowAsync(PopupButtons.OkCancel, Texts.InformationTitle, Texts.LocalSignInWarningPopUpText);

            if (click == PopupButtons.Ok)
            {
                New <IBrowser>().OpenUri(New <UserSettings>().AccountWebUrl);
            }
        }
Example #11
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="infoMessage">The info message of the popup.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(Icon popupIcon, string title, string infoMessage, PopupButtons buttons)
        {
            if (LoggedIntoEventlog(popupIcon, infoMessage))
            {
                return(DialogResult.OK);
            }


            var popupWindow = new PopupDialog
            {
                PopupIcon     = popupIcon,
                Title         = title,
                InfoMessage   = infoMessage,
                Buttons       = buttons,
                StartPosition = FormStartPosition.CenterParent
            };

            return(popupWindow.ShowDialog());
        }
Example #12
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="owner">The owner of the modal popup dialog.</param>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="exception">The exception to handle in the popup-information.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(IWin32Window owner, Icon popupIcon, string title, Exception exception,
            PopupButtons buttons)
        {
            var popupWindow = new PopupDialog
            {
                PopupIcon = popupIcon,
                Title = title,
                InfoMessage = exception.Message,
                StartPosition = FormStartPosition.CenterParent,
                Buttons = buttons,
                Exception = exception
            };

            return popupWindow.ShowDialog();
        }
Example #13
0
 /// <summary>
 /// Create the popup
 /// </summary>
 /// <param name="title">Title header</param>
 /// <param name="content">Html content</param>
 /// <param name="buttons">Buttons to show</param>
 public PopupJs(string title, string content, PopupButtons buttons)
     : this(title, content, buttons, null, null, 1500, 1000, true, true, false)
 {
 }
Example #14
0
 public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message)
 {
     return(Task.FromResult(PopupButtons.Ok));
 }
Example #15
0
 public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions doNotShowAgainOption, string doNotShowAgainCustomText)
 {
     return(Task.FromResult(PopupButtons.Ok));
 }
Example #16
0
        /// <summary>
        ///     Shows a new popup-window.
        /// </summary>
        /// <param name="popupIcon">The icons of the popup.</param>
        /// <param name="title">The title of the popup.</param>
        /// <param name="ex">The exception to handle in the popup-information.</param>
        /// <param name="buttons">The buttons to show for the user-interaction.</param>
        public static DialogResult ShowPopup(Icon popupIcon, string title, Exception ex, PopupButtons buttons)
        {
            var popupWindow = new PopupDialog
            {
                PopupIcon     = popupIcon,
                Title         = title,
                InfoMessage   = ex.Message,
                Buttons       = buttons,
                StartPosition = FormStartPosition.CenterParent,
                Exception     = ex
            };

            return(popupWindow.ShowDialog());
        }
Example #17
0
 public Task <PopupButtons> ShowAsync(PopupButtons buttons, string title, string message, DoNotShowAgainOptions dontShowAgainFlag)
 {
     return(ShowAsync(buttons, title, message, dontShowAgainFlag, null));
 }