コード例 #1
0
ファイル: Shell.cs プロジェクト: JohnThomson/BloomDesktop
        /// <summary>
        /// Display a dialog box that reports a problem to the user.
        /// </summary>
        /// <remarks>
        /// On Linux at least, displaying a dialog on a thread that is not the main GUI
        /// thread causes a crash with a segmentation violation.  So we try to display on
        /// the main thread.
        /// </remarks>
        public static void DisplayProblemToUser(string message, params object[] args)
        {
            var forms = Application.OpenForms;

            for (int i = 0; i < forms.Count; ++i)
            {
                var s = forms [i] as Bloom.Shell;
                if (s != null && s.InvokeRequired)
                {
                    var d = new Shell.NotifyTheUserOfProblem(SIL.Reporting.ErrorReport.NotifyUserOfProblem);
                    s.Invoke(d, new object[] { message, args });
                    return;
                }
            }
            SIL.Reporting.ErrorReport.NotifyUserOfProblem(message, args);
        }
コード例 #2
0
ファイル: Shell.cs プロジェクト: BloomBooks/BloomDesktop
 /// <summary>
 /// Display a dialog box that reports a problem to the user.
 /// </summary>
 /// <remarks>
 /// On Linux at least, displaying a dialog on a thread that is not the main GUI
 /// thread causes a crash with a segmentation violation.  So we try to display on
 /// the main thread.
 /// </remarks>
 public static void DisplayProblemToUser(string message, params object[] args)
 {
     var forms = Application.OpenForms;
     for (int i = 0; i < forms.Count; ++i)
     {
         var s = forms [i] as Bloom.Shell;
         if (s != null && s.InvokeRequired)
         {
             var d = new Shell.NotifyTheUserOfProblem(SIL.Reporting.ErrorReport.NotifyUserOfProblem);
             s.Invoke(d, new object[] { message, args });
             return;
         }
     }
     SIL.Reporting.ErrorReport.NotifyUserOfProblem(message, args);
 }