From 719706350b45b8961945874bd7d4c2baff01a6f0 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 23 Aug 2011 18:42:34 +0000 Subject: [PATCH] Debug output save and show Added StepRTB Closed logic to disposing Use the correct font for sections and procedures. --- PROMS/Volian.Base.Library/DebugPrint.cs | 95 +++++++++++++++++++ .../Volian.Controls.Library/DisplayHistory.cs | 10 +- .../DisplayTabControl.cs | 2 +- PROMS/Volian.Controls.Library/RTBItem.cs | 2 +- 4 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 PROMS/Volian.Base.Library/DebugPrint.cs diff --git a/PROMS/Volian.Base.Library/DebugPrint.cs b/PROMS/Volian.Base.Library/DebugPrint.cs new file mode 100644 index 00000000..72163e84 --- /dev/null +++ b/PROMS/Volian.Base.Library/DebugPrint.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace Volian.Base.Library +{ + public class DebugPrint + { + private StreamWriter _MyStreamWriter = null; + public StreamWriter MyStreamWriter + { + get { return _MyStreamWriter; } + set + { + if (_MyStreamWriter != null) + _MyStreamWriter.Close(); + _MyStreamWriter = value; + } + } + public bool IsOpen + { + get { return MyStreamWriter != null; } + } + private string _FileName = null; + public string FileName + { + get { return _FileName; } + set + { + if (IsOpen) Close(); + _FileName = value; + MyFileInfo = new FileInfo(value); + } + } + private FileInfo _MyFileInfo; + public FileInfo MyFileInfo + { + get { return _MyFileInfo; } + set { _MyFileInfo = value; } + } + public void Open(string fileName) + { + FileName = fileName; + MyStreamWriter = MyFileInfo.CreateText(); + } + public void Close() + { + MyStreamWriter = null; + } + public void Write(string format, params object[] args) + { + if (IsOpen) MyStreamWriter.Write(format, args); + } + public void WriteLine(string format, params object[] args) + { + if (IsOpen) MyStreamWriter.WriteLine(format, args); + } + public void Show() + { + Close(); + if (FileName != null) + System.Diagnostics.Process.Start(FileName); + //System.Diagnostics.Process.Start("Explorer", "/select," + FileName); + } + } + public static class DebugPagination + { + private static DebugPrint _MyDebugPrint = new DebugPrint(); + public static void Open(string fileName) + { _MyDebugPrint.Open(fileName); } + public static void Close() + { _MyDebugPrint.Close(); } + public static void Write(string format, params object[] args) + { _MyDebugPrint.Write(format, args); } + public static void WriteLine(string format, params object[] args) + { _MyDebugPrint.WriteLine(format, args); } + public static void Show() + { _MyDebugPrint.Show(); } + } + public static class DebugText + { + private static DebugPrint _MyDebugPrint = new DebugPrint(); + public static void Open(string fileName) + { _MyDebugPrint.Open(fileName); } + public static void Close() + { _MyDebugPrint.Close(); } + public static void Write(string format, params object[] args) + { _MyDebugPrint.Write(format, args); } + public static void WriteLine(string format, params object[] args) + { _MyDebugPrint.WriteLine(format, args); } + public static void Show() + { _MyDebugPrint.Show(); } + } +} diff --git a/PROMS/Volian.Controls.Library/DisplayHistory.cs b/PROMS/Volian.Controls.Library/DisplayHistory.cs index 99f649e5..c07d781b 100644 --- a/PROMS/Volian.Controls.Library/DisplayHistory.cs +++ b/PROMS/Volian.Controls.Library/DisplayHistory.cs @@ -787,7 +787,7 @@ namespace Volian.Controls.Library myVFG.Visible = false; // myRTB.Font = new Font("Arial", 12, FontStyle.Regular); // myRTB.Text = cai.Text; - myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData.Font); + myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font); } } if (tn.Tag is ItemAuditInfo) @@ -801,13 +801,7 @@ namespace Volian.Controls.Library { //myRTB.Font = new Font("Arial", 12, FontStyle.Regular); //myRTB.Text = cai.Text; - if (MyItemInfo.FormatStepData != null) - myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData.Font); - else - { - myRTB.SetupRichText(cai.Text, new VE_Font(StepRTB.MyFontFamily != null ? StepRTB.MyFontFamily.Name : "arial", 12, E_Style.None, 8)); - } - + myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font); } } } diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index 1621babc..f6a19b3a 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -540,7 +540,7 @@ namespace Volian.Controls.Library } public void HideCaret() { - if (_MyStepRTB != null && ! _MyStepRTB.Disposing) + if (_MyStepRTB != null && !_MyStepRTB.Disposing && !_MyStepRTB.Closed) { if (_MyStepRTB.SelectionLength == 0) { diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index 5e667f2a..2fd7174c 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -646,7 +646,7 @@ namespace Volian.Controls.Library public override void ItemSelect() { // Was getting an Error that _MyStepRTB was Disposed RHM 20101217 - if (!_MyStepRTB.Disposing) + if (!_MyStepRTB.Disposing && !MyStepRTB.Closed) { _MyStepRTB.Focus(); _MyStepRTB.Select(0, 0);