SourceCode/PROMS/DataLoader/frmErrors.cs
Rich 7bcfafcc8b Move frmErrors when frmLoader is moved
Shutoff SpellCheck for StepRTB
Use using for temporary StepRTB
Use using for vlnFlexGrid
Added debug output to track StepRTBs and vlnFlexGrids in memory
Limit bottom margin to 0 or above
Dispose of roImage after it is done being used
Dispose of Figure after it is done being used.
Use GetJustRODB so that images are not loaded.
Added ErrorHandler if annotation is deleted after a search
Track create, dispose and finalize
Add static variable to control if SpellCheck is used
Use using for temporary StepRTB
Lazy Load SelectionStack
Clean-up on Dispose
Track create, dispose and finalize
Make MyCopyInfo Lazy Loaded
Use using for temporary StepRTB
Add Dispose method for TableCellEditor
Cleanup on Dispose
Only kill MSWord instances that are invisible
2012-07-13 18:34:57 +00:00

100 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace DataLoader
{
public partial class frmErrors : Form
{
private Form _MyParent;
public frmErrors(Form myParent)
{
InitializeComponent();
_MyParent = myParent;
_MyParent.Move += new EventHandler(_MyParent_Move);
}
void _MyParent_Move(object sender, EventArgs e)
{
AdjustLocation();
}
private int _ErrorCount = 0;
public int ErrorCount
{
get { return _ErrorCount; }
set { _ErrorCount = value; }
}
private int _WarningCount = 0;
public int WarningCount
{
get { return _WarningCount; }
set { _WarningCount = value; }
}
private int _InfoCount = 0;
public int InfoCount
{
get { return _InfoCount; }
set { _InfoCount = value; }
}
string sep = "";
public void Add(string err, MessageType messageType)
{
switch (messageType)
{
case MessageType.Information:
_InfoCount++;
break;
case MessageType.Warning:
_WarningCount++;
break;
case MessageType.Error:
_ErrorCount++;
break;
default:
break;
}
tbErrors.SelectionStart = tbErrors.TextLength;
tbErrors.SelectedText = sep + err;
sep = "\r\n";
Show();
Application.DoEvents();
}
public void Clear()
{
tbErrors.Text = "";
sep = "";
Hide();
}
private void frmErrors_Load(object sender, EventArgs e)
{
AdjustLocation();
}
private void AdjustLocation()
{
int maxRight = Screen.GetWorkingArea(this).Right;
if (Screen.AllScreens.Length > 1)
{
foreach (Screen sc in Screen.AllScreens)
if (sc.WorkingArea.Right > maxRight) maxRight = sc.WorkingArea.Right;
}
Top = _MyParent.Top;
Left = _MyParent.Right + Width > maxRight ? maxRight - Width : _MyParent.Right;
}
public void Save(string path)
{
StreamWriter fs = new StreamWriter(path, false);
fs.Write(tbErrors.Text);
fs.Close();
}
}
public enum MessageType
{
Information,
Warning,
Error
}
}