Debug output save and show

Added StepRTB Closed logic to disposing
Use the correct font for sections and procedures.
This commit is contained in:
Rich 2011-08-23 18:42:34 +00:00
parent fab3c49244
commit 719706350b
4 changed files with 99 additions and 10 deletions

View File

@ -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(); }
}
}

View File

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

View File

@ -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)
{

View File

@ -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);