More CoverTest, avoid interference with DataEntry forms, 'bypass' logging.

This commit is contained in:
Milan Hanajik
2017-05-05 22:25:45 +02:00
parent f0140e2bd1
commit 01ad1993f1
6 changed files with 40 additions and 14 deletions
@@ -13,6 +13,8 @@ namespace TBF.BenchControl.Elde.CoverTest
public class CoverTest : ComponentBase, IOperation, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(CoverTest));
private static readonly ILog bypassLog = LogManager.GetLogger("BypassLog");
public override string ToString() { return string.Format("CoverTest({0})", Cfg.ToString(1)); }
readonly CoverTestCfg coverTestCfg;
@@ -75,7 +77,7 @@ namespace TBF.BenchControl.Elde.CoverTest
///
void OpenFormDlg(CoverTest myRef)
{
myRef.modelessDlg = new CoverTestForm(message, bypassLevel);
myRef.modelessDlg = new CoverTestForm(message, bypassLevel, bypassLog);
modelessDlg.Show();
}
@@ -127,7 +129,7 @@ namespace TBF.BenchControl.Elde.CoverTest
{
if (modelessDlg is GenericDevices.IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
UiBridge.Bridge.OnCloseQandAForm(this, null);
modelessDlg = null;
}
}
@@ -4,27 +4,33 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Elde.CoverTest
{
public partial class CoverTestForm : Form, GenericDevices.IHasCompleted
{
ILog bypassLog;
string message;
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
Users.Grp.GID bypassLevel;
public CoverTestForm(string message, Users.Grp.GID bypassLevel)
public CoverTestForm(string message, Users.Grp.GID bypassLevel, ILog bypassLog)
{
InitializeComponent();
ControlBox = false;
this.message = message;
this.bypassLevel = bypassLevel;
this.bypassLog = bypassLog;
Localize();
messageLabel.Text = message;
messageLabel.Text = this.message;
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(messageLabel.Text, messageLabel.Font).Width;
int rqrdFormWidth = (int)textWidth + 80; /// Form width calculated from the text width
@@ -50,11 +56,17 @@ namespace TBF.BenchControl.Elde.CoverTest
{
if (!Users.GlobalData.CurrentUser.IsMemberOf(bypassLevel))
{
if ((new Users.Forms.LoginDlg(bypassLevel)).ShowDialog() != DialogResult.OK)
return;
if ((new Users.Forms.LoginDlg(bypassLevel)).ShowDialog() != DialogResult.OK)
{
return;
}
else
{
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
}
}
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
bypassLog.InfoFormat("{0} bypassed by {1}", message, Users.GlobalData.CurrentUser.UserName);
completed = true;
Close();
@@ -64,7 +76,7 @@ namespace TBF.BenchControl.Elde.CoverTest
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
UiBridge.Bridge.CloseQandAFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
@@ -39,9 +39,9 @@ namespace TBF.BenchControl.Elde.CoverTest
//
this.bypassButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.bypassButton.ForeColor = System.Drawing.Color.Black;
this.bypassButton.Location = new System.Drawing.Point(177, 99);
this.bypassButton.Location = new System.Drawing.Point(126, 99);
this.bypassButton.Name = "bypassButton";
this.bypassButton.Size = new System.Drawing.Size(98, 63);
this.bypassButton.Size = new System.Drawing.Size(200, 63);
this.bypassButton.TabIndex = 1;
this.bypassButton.Text = "Bypass";
this.bypassButton.UseVisualStyleBackColor = true;
@@ -61,7 +61,7 @@ namespace TBF.BenchControl.Elde.CoverTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Goldenrod;
this.BackColor = System.Drawing.Color.DarkOrange;
this.ClientSize = new System.Drawing.Size(454, 201);
this.Controls.Add(this.messageLabel);
this.Controls.Add(this.bypassButton);