Example #1
0
 public void Run()
 {
     while (Quit == false)
     {
         try {
             PollIdle(OS.ReadMonotonicTime() + 100);
         }
         catch (OS.ErrorException ex)
         {
             Reporter.WriteLine("{0}", ex.Message);
             string[] lines = ex.StackTrace.Split(new char[] { '\n' });
             foreach (string s in lines)
             {
                 Reporter.WriteLine("{0}", s);
             }
             Wimp.ReportError(Wimp.ErrorBoxFlags.OKIcon,
                              "TBTemplate",
                              ex.OSError.Number,
                              ex.OSError.Message);
         }
         catch (Exception ex)
         {
             Reporter.WriteLine("{0}", ex.Message);
             string[] lines = ex.StackTrace.Split(new char[] { '\n' });
             foreach (string s in lines)
             {
                 Reporter.WriteLine("{0}", s);
             }
         }
     }
 }
Example #2
0
 void Run()
 {
     while (Quit == false)
     {
         try {
             PollIdle(OS.ReadMonotonicTime() + 100);
         }
         catch (OS.ErrorException ex)
         {
             Wimp.ReportError(Wimp.ErrorBoxFlags.OKIcon,
                              "MonoTestApp",
                              ex.OSError.Number,
                              ex.OSError.Message);
         }
         catch (Exception ex)
         {
             Reporter.WriteLine(ex.Message);
             // Split the stacktrace into individual lines and feed each one to
             // Reporter.
             string[] lines = ex.StackTrace.Split(new char[] { '\n' });
             foreach (string s in lines)
             {
                 Reporter.WriteLine(s);
             }
         }
     }
 }
Example #3
0
            // Type 2 client
            // Client participates in disc save.
            void save_data(object sender, Toolbox.SaveAsDialogue.SaveToFileEventArgs e)
            {
                try
                {
                    var saveas = (DocumentSaveAs)sender;

                    // The SaveAs dialogue is a shared toolbox object, so check that this is the
                    // intended target of the event.
                    if (this.Equals(saveas.GetAncestor <TextDocument>()))
                    {
                        FileName = e.Filename;
                        System.IO.File.WriteAllText(e.Filename, Text);
                        saveas.FileSaveCompleted(e.Filename, true);
                    }
                }
                catch (Exception ex)
                {
                    Wimp.ReportError(Wimp.ErrorBoxFlags.OKIcon,
                                     "MonoTestTB",
                                     0,
                                     ex.Message);
                }
            }