Shows non-fatal errors to user or displays them somehow else, depends on implementation.
Inheritance: FirstFloor.ModernUI.Presentation.NotifyPropertyChanged
コード例 #1
0
ファイル: ClipboardHelper.cs プロジェクト: windygu/actools
        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);
        }
コード例 #2
0
ファイル: ClipboardHelper.cs プロジェクト: tankyx/actools
        /*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);
            });
        }
コード例 #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);
            }
        }