Shows non-fatal errors to user or displays them somehow else, depends on implementation.
Inheritance: FirstFloor.ModernUI.Presentation.NotifyPropertyChanged
Ejemplo n.º 1
0
        public static void SetText(string text)
        {
            Exception exception = null;

            for (var i = 0; i < 5; i++)
            {
                try {
                    Clipboard.SetText(text);
                    return;
                } catch (Exception e) {
                    Thread.Sleep(10);
                    exception = e;
                }
            }

            NonfatalError.Notify("Can’t copy text", "No access to clipboard.", exception);
        }
Ejemplo n.º 2
0
        /*public static bool SetText(string text) {
         *  if (!OpenClipboard(IntPtr.Zero)) {
         *      return false;
         *  }
         *
         *  var global = Marshal.StringToHGlobalUni(text);
         *  SetClipboardData(CF_UNICODETEXT, global);
         *  CloseClipboard();
         *  return true;
         * }*/

        public static void SetText(string text)
        {
            ActionExtension.InvokeInMainThreadAsync(() => {
                Exception exception = null;
                for (var i = 0; i < 5; i++)
                {
                    try {
                        Clipboard.SetText(text);
                        return;
                    } catch (Exception e) {
                        Thread.Sleep(10);
                        exception = e;
                    }
                }

                NonfatalError.NotifyBackground("Can’t copy text", "No access to clipboard.", exception);
            });
        }
Ejemplo n.º 3
0
        protected override async Task ExecuteInner()
        {
            try {
                using (var waiting = new WaitingDialog()) {
                    waiting.Report("Solving the issue…");
                    await _execute(waiting.CancellationToken);
                }
            } catch (TaskCanceledException) {
                return;
            } catch (Exception e) {
                NonfatalError.Notify("Can’t solve the issue", e);
                return;
            }

            Solved = true;

            if (_entry != null)
            {
                NonfatalError.Instance.Errors.Remove(_entry);
            }
        }