SourceCode/PROMS/DataLoader/frmErrors.cs
2010-03-31 16:46:46 +00:00

59 lines
1.2 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;
}
private List<string> _MyErrors = new List<string>();
public List<string> MyErrors
{
get { return _MyErrors; }
}
string sep = "";
public void Add(string err)
{
_MyErrors.Add(err);
tbErrors.Text += sep + err;
tbErrors.SelectionStart = tbErrors.TextLength;
sep = "\r\n";
Show();
Application.DoEvents();
}
public void Clear()
{
tbErrors.Text = "";
sep = "";
Hide();
}
private void frmErrors_Load(object sender, EventArgs e)
{
Rectangle rec = Screen.GetWorkingArea(this);
Top = _MyParent.Top;
Left = _MyParent.Right + Width > rec.Right ? rec.Right - Width : _MyParent.Right;
}
public void Save(string path)
{
StreamWriter fs = new StreamWriter(path,false);
foreach (string txt in MyErrors)
fs.WriteLine(txt);
fs.Close();
}
public int ItemCount()
{
return MyErrors.Count;
}
}
}