Ejemplo n.º 1
0
        public bool DisplayWarning(Window sender, bool dispatcher = false)
        {
            if (State != PortWarningType.Show)
            {
                return(false);
            }

            State = PortWarningType.Done;

            Action DisplayMessage = async() => {
                if (await MessageWindow.Create(message, new string[] { action, "OK" }, sender) == action)
                {
                    App.URL(url);
                }

                Launchpad.DisplayWarnings(sender);
            };

            if (dispatcher)
            {
                Dispatcher.UIThread.Post(DisplayMessage, DispatcherPriority.MinValue);
            }
            else
            {
                DisplayMessage.Invoke();
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool DisplayWarning(Window sender, bool dispatcher = false)
        {
            if (State != PortWarningType.Show)
            {
                return(false);
            }

            State = PortWarningType.Done;

            Action DisplayMessage = async() => {
                string[] actions = options.Select(i => i.action).ToArray();
                int      result;

                if ((result = Array.IndexOf(actions, await MessageWindow.Create(message, actions.Append("Ignore").ToArray(), sender))) != -1)
                {
                    App.URL(options[result].url);
                }

                Launchpad.DisplayWarnings(sender);
            };

            if (dispatcher)
            {
                Dispatcher.UIThread.Post(DisplayMessage, DispatcherPriority.MinValue);
            }
            else
            {
                DisplayMessage.Invoke();
            }

            return(true);
        }
Ejemplo n.º 3
0
        public void Set()
        {
            if (State == PortWarningType.None)
            {
                State = PortWarningType.Show;

                if (Application.Current != null && App.MainWindow != null)
                {
                    DisplayWarning(null, true);
                }
            }
        }