FrmToolbox: Dynamic tools initialization.

This commit is contained in:
2019-05-26 17:53:53 +02:00
parent eac18b2e78
commit 14353a0ef8
9 changed files with 230 additions and 334 deletions

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace VAR.Toolbox.Code
{
public static class ReflectionUtils
{
public static IEnumerable<Type> GetTypesOfInterface(Type interfaceType)
{
return AppDomain.CurrentDomain
.GetAssemblies()
.SelectMany(x => x.GetTypes())
.Where(x =>
x.IsAbstract == false &&
x.IsInterface == false &&
interfaceType.IsAssignableFrom(x) &&
true);
}
}
}

View File

@@ -1,217 +0,0 @@
namespace VAR.Toolbox.UI
{
partial class FrmToolbox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCoder = new System.Windows.Forms.Button();
this.btnProxyCmd = new System.Windows.Forms.Button();
this.btnWebcam = new System.Windows.Forms.Button();
this.btnTunnelTCP = new System.Windows.Forms.Button();
this.lblToolbox = new System.Windows.Forms.Label();
this.pnlSuspension1 = new VAR.Toolbox.UI.PnlSuspension();
this.pnlCover1 = new VAR.Toolbox.UI.PnlCover();
this.btnExit = new System.Windows.Forms.Button();
this.btnTestWebService = new System.Windows.Forms.Button();
this.btnScreenshooter = new System.Windows.Forms.Button();
this.btnIPScan = new System.Windows.Forms.Button();
this.btnNetworkInfo = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnCoder
//
this.btnCoder.Location = new System.Drawing.Point(9, 52);
this.btnCoder.Name = "btnCoder";
this.btnCoder.Size = new System.Drawing.Size(165, 34);
this.btnCoder.TabIndex = 0;
this.btnCoder.Text = "Coder";
this.btnCoder.UseVisualStyleBackColor = true;
this.btnCoder.Click += new System.EventHandler(this.BtnCoder_Click);
//
// btnProxyCmd
//
this.btnProxyCmd.Location = new System.Drawing.Point(9, 92);
this.btnProxyCmd.Name = "btnProxyCmd";
this.btnProxyCmd.Size = new System.Drawing.Size(165, 36);
this.btnProxyCmd.TabIndex = 1;
this.btnProxyCmd.Text = "ProxyCmd";
this.btnProxyCmd.UseVisualStyleBackColor = true;
this.btnProxyCmd.Click += new System.EventHandler(this.BtnProxyCmd_Click);
//
// btnWebcam
//
this.btnWebcam.Location = new System.Drawing.Point(9, 135);
this.btnWebcam.Name = "btnWebcam";
this.btnWebcam.Size = new System.Drawing.Size(165, 36);
this.btnWebcam.TabIndex = 2;
this.btnWebcam.Text = "Webcam";
this.btnWebcam.UseVisualStyleBackColor = true;
this.btnWebcam.Click += new System.EventHandler(this.BtnWebcam_Click);
//
// btnTunnelTCP
//
this.btnTunnelTCP.Location = new System.Drawing.Point(8, 176);
this.btnTunnelTCP.Margin = new System.Windows.Forms.Padding(2);
this.btnTunnelTCP.Name = "btnTunnelTCP";
this.btnTunnelTCP.Size = new System.Drawing.Size(165, 36);
this.btnTunnelTCP.TabIndex = 5;
this.btnTunnelTCP.Text = "TunnelTCP";
this.btnTunnelTCP.UseVisualStyleBackColor = true;
this.btnTunnelTCP.Click += new System.EventHandler(this.BtnTunnelTCP_Click);
//
// lblToolbox
//
this.lblToolbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblToolbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblToolbox.Location = new System.Drawing.Point(9, 9);
this.lblToolbox.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblToolbox.Name = "lblToolbox";
this.lblToolbox.Size = new System.Drawing.Size(336, 40);
this.lblToolbox.TabIndex = 6;
this.lblToolbox.Text = "Toolbox";
this.lblToolbox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlSuspension1
//
this.pnlSuspension1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pnlSuspension1.Location = new System.Drawing.Point(180, 230);
this.pnlSuspension1.Margin = new System.Windows.Forms.Padding(1);
this.pnlSuspension1.Name = "pnlSuspension1";
this.pnlSuspension1.Size = new System.Drawing.Size(165, 125);
this.pnlSuspension1.TabIndex = 4;
//
// pnlCover1
//
this.pnlCover1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pnlCover1.Location = new System.Drawing.Point(12, 230);
this.pnlCover1.Margin = new System.Windows.Forms.Padding(1);
this.pnlCover1.Name = "pnlCover1";
this.pnlCover1.Size = new System.Drawing.Size(162, 125);
this.pnlCover1.TabIndex = 3;
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(12, 359);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(333, 29);
this.btnExit.TabIndex = 7;
this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.BtnExit_Click);
//
// btnTestWebService
//
this.btnTestWebService.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnTestWebService.Location = new System.Drawing.Point(180, 52);
this.btnTestWebService.Name = "btnTestWebService";
this.btnTestWebService.Size = new System.Drawing.Size(165, 34);
this.btnTestWebService.TabIndex = 8;
this.btnTestWebService.Text = "TestWebService";
this.btnTestWebService.UseVisualStyleBackColor = true;
this.btnTestWebService.Click += new System.EventHandler(this.BtnTestWebService_Click);
//
// btnScreenshooter
//
this.btnScreenshooter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnScreenshooter.Location = new System.Drawing.Point(180, 135);
this.btnScreenshooter.Name = "btnScreenshooter";
this.btnScreenshooter.Size = new System.Drawing.Size(165, 36);
this.btnScreenshooter.TabIndex = 10;
this.btnScreenshooter.Text = "Screenshooter";
this.btnScreenshooter.UseVisualStyleBackColor = true;
this.btnScreenshooter.Click += new System.EventHandler(this.BtnScreenshooter_Click);
//
// btnIPScan
//
this.btnIPScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnIPScan.Location = new System.Drawing.Point(180, 176);
this.btnIPScan.Name = "btnIPScan";
this.btnIPScan.Size = new System.Drawing.Size(165, 36);
this.btnIPScan.TabIndex = 11;
this.btnIPScan.Text = "IPScan";
this.btnIPScan.UseVisualStyleBackColor = true;
this.btnIPScan.Click += new System.EventHandler(this.BtnIPScan_Click);
//
// btnNetworkInfo
//
this.btnNetworkInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnNetworkInfo.Location = new System.Drawing.Point(180, 92);
this.btnNetworkInfo.Name = "btnNetworkInfo";
this.btnNetworkInfo.Size = new System.Drawing.Size(165, 34);
this.btnNetworkInfo.TabIndex = 12;
this.btnNetworkInfo.Text = "NetworkInfo";
this.btnNetworkInfo.UseVisualStyleBackColor = true;
this.btnNetworkInfo.MouseClick += new System.Windows.Forms.MouseEventHandler(this.BtnNetworkInfo_MouseClick);
//
// FrmToolbox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(352, 400);
this.Controls.Add(this.btnNetworkInfo);
this.Controls.Add(this.btnIPScan);
this.Controls.Add(this.btnScreenshooter);
this.Controls.Add(this.btnTestWebService);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.lblToolbox);
this.Controls.Add(this.btnTunnelTCP);
this.Controls.Add(this.pnlSuspension1);
this.Controls.Add(this.pnlCover1);
this.Controls.Add(this.btnWebcam);
this.Controls.Add(this.btnProxyCmd);
this.Controls.Add(this.btnCoder);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.Name = "FrmToolbox";
this.Text = "Toolbox";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmToolbox_FormClosing);
this.Load += new System.EventHandler(this.FrmToolbox_Load);
this.Resize += new System.EventHandler(this.FrmToolbox_Resize);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnCoder;
private System.Windows.Forms.Button btnProxyCmd;
private System.Windows.Forms.Button btnWebcam;
private PnlCover pnlCover1;
private PnlSuspension pnlSuspension1;
private System.Windows.Forms.Button btnTunnelTCP;
private System.Windows.Forms.Label lblToolbox;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnTestWebService;
private System.Windows.Forms.Button btnScreenshooter;
private System.Windows.Forms.Button btnIPScan;
private System.Windows.Forms.Button btnNetworkInfo;
}
}

View File

@@ -3,17 +3,22 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using VAR.Toolbox.Code;
using VAR.Toolbox.Code.Windows; using VAR.Toolbox.Code.Windows;
namespace VAR.Toolbox.UI namespace VAR.Toolbox.UI
{ {
public partial class FrmToolbox : Form public class FrmToolbox : Form
{ {
#region Declarations #region Declarations
private bool _closing = false; private bool _closing = false;
private Label lblToolbox;
private Button btnExit;
private NotifyIcon niTray = null; private NotifyIcon niTray = null;
private static FrmToolbox _currentInstance = null; private static FrmToolbox _currentInstance = null;
@@ -25,23 +30,11 @@ namespace VAR.Toolbox.UI
public FrmToolbox() public FrmToolbox()
{ {
InitializeComponent(); InitializeComponent();
InitializeCustomControls();
MouseDown += DragWindow_MouseDown;
lblToolbox.MouseDown += DragWindow_MouseDown;
_currentInstance = this; _currentInstance = this;
} }
private void InitializeCustomControls() private void InitializeCustomControls()
{ {
niTray = new NotifyIcon
{
Text = "VAR.Toolbox",
Visible = true
};
niTray.MouseClick += NiTray_MouseClick;
} }
private void FrmToolbox_Load(object sender, EventArgs e) private void FrmToolbox_Load(object sender, EventArgs e)
@@ -68,7 +61,7 @@ namespace VAR.Toolbox.UI
#region UI events #region UI events
private void DragWindow_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) private void DragWindow_MouseDown(object sender, MouseEventArgs e)
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
@@ -104,48 +97,143 @@ namespace VAR.Toolbox.UI
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;
} }
private void BtnCoder_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmCoder));
}
private void BtnProxyCmd_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmProxyCmd));
}
private void BtnWebcam_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmWebcam));
}
private void BtnTunnelTCP_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmTunnelTCP));
}
private void BtnTestWebService_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmTestWebService));
}
private void BtnScreenshooter_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmScreenshooter));
}
private void BtnIPScan_Click(object sender, EventArgs e)
{
CreateWindow(typeof(FrmIPScan));
}
private void BtnNetworkInfo_MouseClick(object sender, MouseEventArgs e)
{
CreateWindow(typeof(FrmNetworkInfo));
}
#endregion UI events #endregion UI events
#region Dynamic layout
private void InitializeComponent()
{
SuspendLayout();
const int toolSpacing = 5;
const int toolWidth = 200;
const int windowSpacing = 10;
int nextYLocation = 0;
// Get list of ToolForms
Type iToolForm = typeof(IToolForm);
IEnumerable<Type> toolFormTypes = ReflectionUtils.GetTypesOfInterface(iToolForm);
Dictionary<string, Type> dictToolFormTypes = toolFormTypes.ToDictionary(t =>
{
IToolForm toolForm = System.Runtime.Serialization.FormatterServices.GetUninitializedObject(t) as IToolForm;
return toolForm.ToolName;
});
// Get list of ToolPanels
Type iToolPanel = typeof(IToolPanel);
IEnumerable<Type> toolPanelTypes = ReflectionUtils.GetTypesOfInterface(iToolPanel);
// lblToolbox
lblToolbox = new Label
{
Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right),
Font = new Font("Microsoft Sans Serif", 27.75F, FontStyle.Bold, GraphicsUnit.Point, 0),
Location = new Point(windowSpacing, windowSpacing),
Margin = new Padding(0, 0, 0, 0),
Name = "lblToolbox",
Size = new Size(toolWidth * 2 + toolSpacing, 50),
TabIndex = 6,
Text = "Toolbox",
TextAlign = ContentAlignment.MiddleCenter
};
lblToolbox.MouseDown += DragWindow_MouseDown;
nextYLocation = lblToolbox.Location.Y + lblToolbox.Size.Height + windowSpacing;
// Tool buttons
int idxButton = 0;
int xStartButtons = windowSpacing;
int xStepButtons = toolWidth + toolSpacing;
int yStartButtons = nextYLocation;
int yStepButtons = 40 + toolSpacing;
IEnumerable<KeyValuePair<string, Type>> sortedToolForms = dictToolFormTypes.OrderBy(p => p.Key);
foreach (KeyValuePair<string, Type> p in sortedToolForms)
{
int x = xStartButtons + (idxButton % 2) * xStepButtons;
int y = yStartButtons + (idxButton / 2) * yStepButtons;
Button btn = new Button
{
Location = new Point(x, y),
Name = string.Format("btn{0}", p.Key),
Size = new Size(toolWidth, 40),
TabIndex = idxButton,
Text = p.Key,
UseVisualStyleBackColor = true
};
btn.Click += (s, e) => { CreateWindow(p.Value); };
Controls.Add(btn);
nextYLocation = btn.Location.Y + btn.Size.Height + windowSpacing;
idxButton++;
}
// Tool panels
int idxPanel = 0;
int yStartPanels = nextYLocation;
int xStartPanels = windowSpacing;
int xNextPanels = xStartPanels;
foreach (Type t in toolPanelTypes)
{
ContainerControl pnl = Activator.CreateInstance(t) as ContainerControl;
if (pnl == null) { continue; }
pnl.Location = new Point(xNextPanels, yStartPanels);
Controls.Add(pnl);
int tempNextYLocation = pnl.Location.Y + pnl.Size.Height + windowSpacing;
if (nextYLocation < tempNextYLocation)
{
nextYLocation = tempNextYLocation;
}
xNextPanels = pnl.Location.X + pnl.Size.Width + toolSpacing;
if ((idxPanel % 2) == 1)
{
yStartPanels = nextYLocation;
xNextPanels = xStartPanels;
}
idxPanel++;
}
// btnExit
btnExit = new Button
{
Anchor = ((AnchorStyles.Bottom | AnchorStyles.Left)
| AnchorStyles.Right),
Location = new Point(windowSpacing, nextYLocation),
Name = "btnExit",
Size = new Size(toolWidth * 2 + toolSpacing, 40),
TabIndex = 7,
Text = "Exit",
UseVisualStyleBackColor = true
};
btnExit.Click += BtnExit_Click;
nextYLocation = btnExit.Location.Y + btnExit.Size.Height + windowSpacing;
// FrmToolbox
AutoScaleMode = AutoScaleMode.None;
ClientSize = new Size(425, nextYLocation);
Controls.Add(btnExit);
Controls.Add(lblToolbox);
FormBorderStyle = FormBorderStyle.Fixed3D;
MaximizeBox = false;
Name = "FrmToolbox";
Text = "Toolbox";
FormClosing += FrmToolbox_FormClosing;
Load += FrmToolbox_Load;
Resize += FrmToolbox_Resize;
MouseDown += DragWindow_MouseDown;
ResumeLayout(false);
// niTray
niTray = new NotifyIcon
{
Text = "VAR.Toolbox",
Visible = true
};
niTray.MouseClick += NiTray_MouseClick;
}
#endregion Dynamic layout
#region Window handling #region Window handling
private Form CreateWindow(Type type) private Form CreateWindow(Type type)

View File

@@ -9,8 +9,12 @@ using System.Xml;
namespace VAR.Toolbox.UI namespace VAR.Toolbox.UI
{ {
public partial class FrmTestWebService : Form public partial class FrmTestWebService : Form, IToolForm
{ {
public string ToolName { get { return "TestWebService"; } }
public bool HasIcon { get { return false; } }
public FrmTestWebService() public FrmTestWebService()
{ {
InitializeComponent(); InitializeComponent();

View File

@@ -47,29 +47,29 @@
this.grpCover.Controls.Add(this.chkAutoCover); this.grpCover.Controls.Add(this.chkAutoCover);
this.grpCover.Dock = System.Windows.Forms.DockStyle.Fill; this.grpCover.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpCover.Location = new System.Drawing.Point(0, 0); this.grpCover.Location = new System.Drawing.Point(0, 0);
this.grpCover.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grpCover.Margin = new System.Windows.Forms.Padding(4);
this.grpCover.Name = "grpCover"; this.grpCover.Name = "grpCover";
this.grpCover.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grpCover.Padding = new System.Windows.Forms.Padding(4);
this.grpCover.Size = new System.Drawing.Size(262, 160); this.grpCover.Size = new System.Drawing.Size(200, 123);
this.grpCover.TabIndex = 14; this.grpCover.TabIndex = 14;
this.grpCover.TabStop = false; this.grpCover.TabStop = false;
this.grpCover.Text = "Cover"; this.grpCover.Text = "Cover";
// //
// btnCover // btnCover
// //
this.btnCover.Location = new System.Drawing.Point(8, 83); this.btnCover.Location = new System.Drawing.Point(7, 66);
this.btnCover.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnCover.Margin = new System.Windows.Forms.Padding(4);
this.btnCover.Name = "btnCover"; this.btnCover.Name = "btnCover";
this.btnCover.Size = new System.Drawing.Size(181, 35); this.btnCover.Size = new System.Drawing.Size(161, 28);
this.btnCover.TabIndex = 7; this.btnCover.TabIndex = 7;
this.btnCover.Text = "Cover"; this.btnCover.Text = "Cover";
this.btnCover.UseVisualStyleBackColor = true; this.btnCover.UseVisualStyleBackColor = true;
this.btnCover.Click += new System.EventHandler(this.btnCover_Click); this.btnCover.Click += new System.EventHandler(this.BtnCover_Click);
// //
// numInactive // numInactive
// //
this.numInactive.Location = new System.Drawing.Point(131, 27); this.numInactive.Location = new System.Drawing.Point(116, 22);
this.numInactive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.numInactive.Margin = new System.Windows.Forms.Padding(4);
this.numInactive.Maximum = new decimal(new int[] { this.numInactive.Maximum = new decimal(new int[] {
300, 300,
0, 0,
@@ -81,7 +81,7 @@
0, 0,
0}); 0});
this.numInactive.Name = "numInactive"; this.numInactive.Name = "numInactive";
this.numInactive.Size = new System.Drawing.Size(58, 26); this.numInactive.Size = new System.Drawing.Size(52, 22);
this.numInactive.TabIndex = 10; this.numInactive.TabIndex = 10;
this.numInactive.Value = new decimal(new int[] { this.numInactive.Value = new decimal(new int[] {
180, 180,
@@ -92,10 +92,10 @@
// lblInactive // lblInactive
// //
this.lblInactive.AutoSize = true; this.lblInactive.AutoSize = true;
this.lblInactive.Location = new System.Drawing.Point(8, 58); this.lblInactive.Location = new System.Drawing.Point(7, 46);
this.lblInactive.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblInactive.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblInactive.Name = "lblInactive"; this.lblInactive.Name = "lblInactive";
this.lblInactive.Size = new System.Drawing.Size(79, 20); this.lblInactive.Size = new System.Drawing.Size(70, 17);
this.lblInactive.TabIndex = 8; this.lblInactive.TabIndex = 8;
this.lblInactive.Text = "lblInactive"; this.lblInactive.Text = "lblInactive";
// //
@@ -104,10 +104,10 @@
this.chkAutoCover.AutoSize = true; this.chkAutoCover.AutoSize = true;
this.chkAutoCover.Checked = true; this.chkAutoCover.Checked = true;
this.chkAutoCover.CheckState = System.Windows.Forms.CheckState.Checked; this.chkAutoCover.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkAutoCover.Location = new System.Drawing.Point(8, 29); this.chkAutoCover.Location = new System.Drawing.Point(7, 23);
this.chkAutoCover.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.chkAutoCover.Margin = new System.Windows.Forms.Padding(4);
this.chkAutoCover.Name = "chkAutoCover"; this.chkAutoCover.Name = "chkAutoCover";
this.chkAutoCover.Size = new System.Drawing.Size(110, 24); this.chkAutoCover.Size = new System.Drawing.Size(96, 21);
this.chkAutoCover.TabIndex = 9; this.chkAutoCover.TabIndex = 9;
this.chkAutoCover.Text = "AutoCover"; this.chkAutoCover.Text = "AutoCover";
this.chkAutoCover.UseVisualStyleBackColor = true; this.chkAutoCover.UseVisualStyleBackColor = true;
@@ -115,15 +115,15 @@
// timTicker // timTicker
// //
this.timTicker.Enabled = true; this.timTicker.Enabled = true;
this.timTicker.Tick += new System.EventHandler(this.timTicker_Tick); this.timTicker.Tick += new System.EventHandler(this.TimTicker_Tick);
// //
// PnlCover // PnlCover
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpCover); this.Controls.Add(this.grpCover);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "PnlCover"; this.Name = "PnlCover";
this.Size = new System.Drawing.Size(262, 160); this.Size = new System.Drawing.Size(200, 123);
this.grpCover.ResumeLayout(false); this.grpCover.ResumeLayout(false);
this.grpCover.PerformLayout(); this.grpCover.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numInactive)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numInactive)).EndInit();

View File

@@ -11,7 +11,7 @@ namespace VAR.Toolbox.UI
InitializeComponent(); InitializeComponent();
} }
private void timTicker_Tick(object sender, EventArgs e) private void TimTicker_Tick(object sender, EventArgs e)
{ {
if (DesignMode) { return; } if (DesignMode) { return; }
timTicker.Stop(); timTicker.Stop();
@@ -35,7 +35,7 @@ namespace VAR.Toolbox.UI
timTicker.Start(); timTicker.Start();
} }
private void btnCover_Click(object sender, EventArgs e) private void BtnCover_Click(object sender, EventArgs e)
{ {
CoverScreen(); CoverScreen();
} }
@@ -60,5 +60,6 @@ namespace VAR.Toolbox.UI
frmParent.WindowState = FormWindowState.Minimized; frmParent.WindowState = FormWindowState.Minimized;
} }
} }
} }
} }

View File

@@ -46,18 +46,18 @@
// chkSuspendAtCustom // chkSuspendAtCustom
// //
this.chkSuspendAtCustom.AutoSize = true; this.chkSuspendAtCustom.AutoSize = true;
this.chkSuspendAtCustom.Location = new System.Drawing.Point(8, 29); this.chkSuspendAtCustom.Location = new System.Drawing.Point(7, 23);
this.chkSuspendAtCustom.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.chkSuspendAtCustom.Margin = new System.Windows.Forms.Padding(4);
this.chkSuspendAtCustom.Name = "chkSuspendAtCustom"; this.chkSuspendAtCustom.Name = "chkSuspendAtCustom";
this.chkSuspendAtCustom.Size = new System.Drawing.Size(170, 24); this.chkSuspendAtCustom.Size = new System.Drawing.Size(146, 21);
this.chkSuspendAtCustom.TabIndex = 5; this.chkSuspendAtCustom.TabIndex = 5;
this.chkSuspendAtCustom.Text = "SuspendAtCustom"; this.chkSuspendAtCustom.Text = "SuspendAtCustom";
this.chkSuspendAtCustom.UseVisualStyleBackColor = true; this.chkSuspendAtCustom.UseVisualStyleBackColor = true;
// //
// numOffset // numOffset
// //
this.numOffset.Location = new System.Drawing.Point(90, 101); this.numOffset.Location = new System.Drawing.Point(80, 81);
this.numOffset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.numOffset.Margin = new System.Windows.Forms.Padding(4);
this.numOffset.Maximum = new decimal(new int[] { this.numOffset.Maximum = new decimal(new int[] {
600, 600,
0, 0,
@@ -69,7 +69,7 @@
0, 0,
0}); 0});
this.numOffset.Name = "numOffset"; this.numOffset.Name = "numOffset";
this.numOffset.Size = new System.Drawing.Size(58, 26); this.numOffset.Size = new System.Drawing.Size(52, 22);
this.numOffset.TabIndex = 11; this.numOffset.TabIndex = 11;
this.numOffset.Value = new decimal(new int[] { this.numOffset.Value = new decimal(new int[] {
180, 180,
@@ -79,54 +79,54 @@
// //
// btnRandOffset // btnRandOffset
// //
this.btnRandOffset.Location = new System.Drawing.Point(8, 101); this.btnRandOffset.Location = new System.Drawing.Point(7, 81);
this.btnRandOffset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnRandOffset.Margin = new System.Windows.Forms.Padding(4);
this.btnRandOffset.Name = "btnRandOffset"; this.btnRandOffset.Name = "btnRandOffset";
this.btnRandOffset.Size = new System.Drawing.Size(74, 35); this.btnRandOffset.Size = new System.Drawing.Size(66, 28);
this.btnRandOffset.TabIndex = 12; this.btnRandOffset.TabIndex = 12;
this.btnRandOffset.Text = "Rand"; this.btnRandOffset.Text = "Rand";
this.btnRandOffset.UseVisualStyleBackColor = true; this.btnRandOffset.UseVisualStyleBackColor = true;
this.btnRandOffset.Click += new System.EventHandler(this.btnRandOffset_Click); this.btnRandOffset.Click += new System.EventHandler(this.BtnRandOffset_Click);
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(158, 108); this.label1.Location = new System.Drawing.Point(140, 86);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 20); this.label1.Size = new System.Drawing.Size(43, 17);
this.label1.TabIndex = 12; this.label1.TabIndex = 12;
this.label1.Text = "Secs."; this.label1.Text = "Secs.";
// //
// btnCustomSuspenedNow // btnCustomSuspenedNow
// //
this.btnCustomSuspenedNow.Location = new System.Drawing.Point(181, 60); this.btnCustomSuspenedNow.Location = new System.Drawing.Point(161, 48);
this.btnCustomSuspenedNow.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.btnCustomSuspenedNow.Margin = new System.Windows.Forms.Padding(4);
this.btnCustomSuspenedNow.Name = "btnCustomSuspenedNow"; this.btnCustomSuspenedNow.Name = "btnCustomSuspenedNow";
this.btnCustomSuspenedNow.Size = new System.Drawing.Size(34, 35); this.btnCustomSuspenedNow.Size = new System.Drawing.Size(30, 28);
this.btnCustomSuspenedNow.TabIndex = 13; this.btnCustomSuspenedNow.TabIndex = 13;
this.btnCustomSuspenedNow.Text = "N"; this.btnCustomSuspenedNow.Text = "N";
this.btnCustomSuspenedNow.UseVisualStyleBackColor = true; this.btnCustomSuspenedNow.UseVisualStyleBackColor = true;
this.btnCustomSuspenedNow.Click += new System.EventHandler(this.btnCustomSuspenedNow_Click); this.btnCustomSuspenedNow.Click += new System.EventHandler(this.BtnCustomSuspenedNow_Click);
// //
// ddlCustomHour // ddlCustomHour
// //
this.ddlCustomHour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ddlCustomHour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlCustomHour.FormattingEnabled = true; this.ddlCustomHour.FormattingEnabled = true;
this.ddlCustomHour.Location = new System.Drawing.Point(37, 63); this.ddlCustomHour.Location = new System.Drawing.Point(33, 50);
this.ddlCustomHour.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ddlCustomHour.Margin = new System.Windows.Forms.Padding(4);
this.ddlCustomHour.Name = "ddlCustomHour"; this.ddlCustomHour.Name = "ddlCustomHour";
this.ddlCustomHour.Size = new System.Drawing.Size(61, 28); this.ddlCustomHour.Size = new System.Drawing.Size(55, 24);
this.ddlCustomHour.TabIndex = 14; this.ddlCustomHour.TabIndex = 14;
// //
// ddlCustomMinute // ddlCustomMinute
// //
this.ddlCustomMinute.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ddlCustomMinute.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlCustomMinute.FormattingEnabled = true; this.ddlCustomMinute.FormattingEnabled = true;
this.ddlCustomMinute.Location = new System.Drawing.Point(109, 63); this.ddlCustomMinute.Location = new System.Drawing.Point(97, 50);
this.ddlCustomMinute.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ddlCustomMinute.Margin = new System.Windows.Forms.Padding(4);
this.ddlCustomMinute.Name = "ddlCustomMinute"; this.ddlCustomMinute.Name = "ddlCustomMinute";
this.ddlCustomMinute.Size = new System.Drawing.Size(61, 28); this.ddlCustomMinute.Size = new System.Drawing.Size(55, 24);
this.ddlCustomMinute.TabIndex = 15; this.ddlCustomMinute.TabIndex = 15;
// //
// grpSuspension // grpSuspension
@@ -141,10 +141,10 @@
this.grpSuspension.Controls.Add(this.chkSuspendAtCustom); this.grpSuspension.Controls.Add(this.chkSuspendAtCustom);
this.grpSuspension.Dock = System.Windows.Forms.DockStyle.Fill; this.grpSuspension.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpSuspension.Location = new System.Drawing.Point(0, 0); this.grpSuspension.Location = new System.Drawing.Point(0, 0);
this.grpSuspension.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grpSuspension.Margin = new System.Windows.Forms.Padding(4);
this.grpSuspension.Name = "grpSuspension"; this.grpSuspension.Name = "grpSuspension";
this.grpSuspension.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); this.grpSuspension.Padding = new System.Windows.Forms.Padding(4);
this.grpSuspension.Size = new System.Drawing.Size(261, 213); this.grpSuspension.Size = new System.Drawing.Size(200, 167);
this.grpSuspension.TabIndex = 12; this.grpSuspension.TabIndex = 12;
this.grpSuspension.TabStop = false; this.grpSuspension.TabStop = false;
this.grpSuspension.Text = "Suspension"; this.grpSuspension.Text = "Suspension";
@@ -154,25 +154,25 @@
this.lblCountdown.AutoSize = true; this.lblCountdown.AutoSize = true;
this.lblCountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblCountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCountdown.ForeColor = System.Drawing.SystemColors.ControlDark; this.lblCountdown.ForeColor = System.Drawing.SystemColors.ControlDark;
this.lblCountdown.Location = new System.Drawing.Point(8, 141); this.lblCountdown.Location = new System.Drawing.Point(7, 113);
this.lblCountdown.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblCountdown.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblCountdown.Name = "lblCountdown"; this.lblCountdown.Name = "lblCountdown";
this.lblCountdown.Size = new System.Drawing.Size(199, 37); this.lblCountdown.Size = new System.Drawing.Size(169, 31);
this.lblCountdown.TabIndex = 16; this.lblCountdown.TabIndex = 16;
this.lblCountdown.Text = "00:00:00:00"; this.lblCountdown.Text = "00:00:00:00";
// //
// timTicker // timTicker
// //
this.timTicker.Enabled = true; this.timTicker.Enabled = true;
this.timTicker.Tick += new System.EventHandler(this.timTicker_Tick); this.timTicker.Tick += new System.EventHandler(this.TimTicker_Tick);
// //
// PnlSuspension // PnlSuspension
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpSuspension); this.Controls.Add(this.grpSuspension);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "PnlSuspension"; this.Name = "PnlSuspension";
this.Size = new System.Drawing.Size(261, 213); this.Size = new System.Drawing.Size(200, 167);
this.Load += new System.EventHandler(this.PnlSuspension_Load); this.Load += new System.EventHandler(this.PnlSuspension_Load);
((System.ComponentModel.ISupportInitialize)(this.numOffset)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numOffset)).EndInit();
this.grpSuspension.ResumeLayout(false); this.grpSuspension.ResumeLayout(false);

View File

@@ -15,22 +15,22 @@ namespace VAR.Toolbox.UI
private void PnlSuspension_Load(object sender, EventArgs e) private void PnlSuspension_Load(object sender, EventArgs e)
{ {
ddlCustomHour_Load(); DdlCustomHour_Load();
ddlCustomMinute_Load(); DdlCustomMinute_Load();
RandomizeOffset(); RandomizeOffset();
} }
private void btnCustomSuspenedNow_Click(object sender, EventArgs e) private void BtnCustomSuspenedNow_Click(object sender, EventArgs e)
{ {
CustomHourMinute_SetNow(); CustomHourMinute_SetNow();
} }
private void btnRandOffset_Click(object sender, EventArgs e) private void BtnRandOffset_Click(object sender, EventArgs e)
{ {
RandomizeOffset(); RandomizeOffset();
} }
private void timTicker_Tick(object sender, EventArgs e) private void TimTicker_Tick(object sender, EventArgs e)
{ {
if (DesignMode) { return; } if (DesignMode) { return; }
ResetCountdown(); ResetCountdown();
@@ -73,7 +73,7 @@ namespace VAR.Toolbox.UI
} }
private void ddlCustomHour_Load() private void DdlCustomHour_Load()
{ {
for (int i = 0; i < 24; i++) for (int i = 0; i < 24; i++)
{ {
@@ -81,7 +81,7 @@ namespace VAR.Toolbox.UI
} }
} }
private void ddlCustomMinute_Load() private void DdlCustomMinute_Load()
{ {
for (int i = 0; i < 60; i++) for (int i = 0; i < 60; i++)
{ {

View File

@@ -75,6 +75,7 @@
</Compile> </Compile>
<Compile Include="Code\HexUtils.cs" /> <Compile Include="Code\HexUtils.cs" />
<Compile Include="Code\ProxyCmdExecutorWMIC.cs" /> <Compile Include="Code\ProxyCmdExecutorWMIC.cs" />
<Compile Include="Code\ReflectionUtils.cs" />
<Compile Include="Code\TextCoderBase64Utf8.cs" /> <Compile Include="Code\TextCoderBase64Utf8.cs" />
<Compile Include="Code\TextCoderBase64Ascii.cs" /> <Compile Include="Code\TextCoderBase64Ascii.cs" />
<Compile Include="Code\DirectShow\CameraControlProperty.cs" /> <Compile Include="Code\DirectShow\CameraControlProperty.cs" />
@@ -183,9 +184,6 @@
<Compile Include="UI\FrmToolbox.cs"> <Compile Include="UI\FrmToolbox.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="UI\FrmToolbox.Designer.cs">
<DependentUpon>FrmToolbox.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\Tools\FrmWebcam.cs"> <Compile Include="UI\Tools\FrmWebcam.cs">