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); } } } }
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); } } } }
// 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); } }