From 14353a0ef8d922e5910cb3546f382c08cbe5cff4 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Sun, 26 May 2019 17:53:53 +0200 Subject: [PATCH] FrmToolbox: Dynamic tools initialization. --- VAR.Toolbox/Code/ReflectionUtils.cs | 22 ++ VAR.Toolbox/UI/FrmToolbox.Designer.cs | 217 ------------------ VAR.Toolbox/UI/FrmToolbox.cs | 196 +++++++++++----- VAR.Toolbox/UI/Tools/FrmTestWebService.cs | 6 +- VAR.Toolbox/UI/Tools/PnlCover.Designer.cs | 38 +-- VAR.Toolbox/UI/Tools/PnlCover.cs | 5 +- .../UI/Tools/PnlSuspension.Designer.cs | 62 ++--- VAR.Toolbox/UI/Tools/PnlSuspension.cs | 14 +- VAR.Toolbox/VAR.Toolbox.csproj | 4 +- 9 files changed, 230 insertions(+), 334 deletions(-) create mode 100644 VAR.Toolbox/Code/ReflectionUtils.cs delete mode 100644 VAR.Toolbox/UI/FrmToolbox.Designer.cs diff --git a/VAR.Toolbox/Code/ReflectionUtils.cs b/VAR.Toolbox/Code/ReflectionUtils.cs new file mode 100644 index 0000000..711de6c --- /dev/null +++ b/VAR.Toolbox/Code/ReflectionUtils.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace VAR.Toolbox.Code +{ + public static class ReflectionUtils + { + public static IEnumerable GetTypesOfInterface(Type interfaceType) + { + return AppDomain.CurrentDomain + .GetAssemblies() + .SelectMany(x => x.GetTypes()) + .Where(x => + x.IsAbstract == false && + x.IsInterface == false && + interfaceType.IsAssignableFrom(x) && + true); + } + + } +} diff --git a/VAR.Toolbox/UI/FrmToolbox.Designer.cs b/VAR.Toolbox/UI/FrmToolbox.Designer.cs deleted file mode 100644 index 993e9f4..0000000 --- a/VAR.Toolbox/UI/FrmToolbox.Designer.cs +++ /dev/null @@ -1,217 +0,0 @@ -namespace VAR.Toolbox.UI -{ - partial class FrmToolbox - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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; - } -} - diff --git a/VAR.Toolbox/UI/FrmToolbox.cs b/VAR.Toolbox/UI/FrmToolbox.cs index 05d1216..5728a37 100644 --- a/VAR.Toolbox/UI/FrmToolbox.cs +++ b/VAR.Toolbox/UI/FrmToolbox.cs @@ -3,17 +3,22 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; +using VAR.Toolbox.Code; using VAR.Toolbox.Code.Windows; namespace VAR.Toolbox.UI { - public partial class FrmToolbox : Form + public class FrmToolbox : Form { #region Declarations private bool _closing = false; + private Label lblToolbox; + private Button btnExit; + private NotifyIcon niTray = null; private static FrmToolbox _currentInstance = null; @@ -25,23 +30,11 @@ namespace VAR.Toolbox.UI public FrmToolbox() { InitializeComponent(); - - InitializeCustomControls(); - - MouseDown += DragWindow_MouseDown; - lblToolbox.MouseDown += DragWindow_MouseDown; - _currentInstance = this; } private void InitializeCustomControls() { - niTray = new NotifyIcon - { - Text = "VAR.Toolbox", - Visible = true - }; - niTray.MouseClick += NiTray_MouseClick; } private void FrmToolbox_Load(object sender, EventArgs e) @@ -68,7 +61,7 @@ namespace VAR.Toolbox.UI #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) { @@ -104,48 +97,143 @@ namespace VAR.Toolbox.UI 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 + #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 toolFormTypes = ReflectionUtils.GetTypesOfInterface(iToolForm); + Dictionary 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 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> sortedToolForms = dictToolFormTypes.OrderBy(p => p.Key); + foreach (KeyValuePair 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 private Form CreateWindow(Type type) diff --git a/VAR.Toolbox/UI/Tools/FrmTestWebService.cs b/VAR.Toolbox/UI/Tools/FrmTestWebService.cs index 185a5fd..bc86c54 100644 --- a/VAR.Toolbox/UI/Tools/FrmTestWebService.cs +++ b/VAR.Toolbox/UI/Tools/FrmTestWebService.cs @@ -9,8 +9,12 @@ using System.Xml; 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() { InitializeComponent(); diff --git a/VAR.Toolbox/UI/Tools/PnlCover.Designer.cs b/VAR.Toolbox/UI/Tools/PnlCover.Designer.cs index 445ae43..df353f6 100644 --- a/VAR.Toolbox/UI/Tools/PnlCover.Designer.cs +++ b/VAR.Toolbox/UI/Tools/PnlCover.Designer.cs @@ -47,29 +47,29 @@ this.grpCover.Controls.Add(this.chkAutoCover); this.grpCover.Dock = System.Windows.Forms.DockStyle.Fill; 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.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.grpCover.Size = new System.Drawing.Size(262, 160); + this.grpCover.Padding = new System.Windows.Forms.Padding(4); + this.grpCover.Size = new System.Drawing.Size(200, 123); this.grpCover.TabIndex = 14; this.grpCover.TabStop = false; this.grpCover.Text = "Cover"; // // btnCover // - this.btnCover.Location = new System.Drawing.Point(8, 83); - this.btnCover.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnCover.Location = new System.Drawing.Point(7, 66); + this.btnCover.Margin = new System.Windows.Forms.Padding(4); 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.Text = "Cover"; this.btnCover.UseVisualStyleBackColor = true; - this.btnCover.Click += new System.EventHandler(this.btnCover_Click); + this.btnCover.Click += new System.EventHandler(this.BtnCover_Click); // // numInactive // - this.numInactive.Location = new System.Drawing.Point(131, 27); - this.numInactive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.numInactive.Location = new System.Drawing.Point(116, 22); + this.numInactive.Margin = new System.Windows.Forms.Padding(4); this.numInactive.Maximum = new decimal(new int[] { 300, 0, @@ -81,7 +81,7 @@ 0, 0}); 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.Value = new decimal(new int[] { 180, @@ -92,10 +92,10 @@ // lblInactive // 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.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.Text = "lblInactive"; // @@ -104,10 +104,10 @@ this.chkAutoCover.AutoSize = true; this.chkAutoCover.Checked = true; this.chkAutoCover.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkAutoCover.Location = new System.Drawing.Point(8, 29); - this.chkAutoCover.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkAutoCover.Location = new System.Drawing.Point(7, 23); + this.chkAutoCover.Margin = new System.Windows.Forms.Padding(4); 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.Text = "AutoCover"; this.chkAutoCover.UseVisualStyleBackColor = true; @@ -115,15 +115,15 @@ // timTicker // this.timTicker.Enabled = true; - this.timTicker.Tick += new System.EventHandler(this.timTicker_Tick); + this.timTicker.Tick += new System.EventHandler(this.TimTicker_Tick); // // PnlCover // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.grpCover); + this.Margin = new System.Windows.Forms.Padding(0); 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.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numInactive)).EndInit(); diff --git a/VAR.Toolbox/UI/Tools/PnlCover.cs b/VAR.Toolbox/UI/Tools/PnlCover.cs index 8214f25..72b6775 100644 --- a/VAR.Toolbox/UI/Tools/PnlCover.cs +++ b/VAR.Toolbox/UI/Tools/PnlCover.cs @@ -11,7 +11,7 @@ namespace VAR.Toolbox.UI InitializeComponent(); } - private void timTicker_Tick(object sender, EventArgs e) + private void TimTicker_Tick(object sender, EventArgs e) { if (DesignMode) { return; } timTicker.Stop(); @@ -35,7 +35,7 @@ namespace VAR.Toolbox.UI timTicker.Start(); } - private void btnCover_Click(object sender, EventArgs e) + private void BtnCover_Click(object sender, EventArgs e) { CoverScreen(); } @@ -60,5 +60,6 @@ namespace VAR.Toolbox.UI frmParent.WindowState = FormWindowState.Minimized; } } + } } diff --git a/VAR.Toolbox/UI/Tools/PnlSuspension.Designer.cs b/VAR.Toolbox/UI/Tools/PnlSuspension.Designer.cs index 105c46f..e023a56 100644 --- a/VAR.Toolbox/UI/Tools/PnlSuspension.Designer.cs +++ b/VAR.Toolbox/UI/Tools/PnlSuspension.Designer.cs @@ -46,18 +46,18 @@ // chkSuspendAtCustom // this.chkSuspendAtCustom.AutoSize = true; - this.chkSuspendAtCustom.Location = new System.Drawing.Point(8, 29); - this.chkSuspendAtCustom.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkSuspendAtCustom.Location = new System.Drawing.Point(7, 23); + this.chkSuspendAtCustom.Margin = new System.Windows.Forms.Padding(4); 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.Text = "SuspendAtCustom"; this.chkSuspendAtCustom.UseVisualStyleBackColor = true; // // numOffset // - this.numOffset.Location = new System.Drawing.Point(90, 101); - this.numOffset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.numOffset.Location = new System.Drawing.Point(80, 81); + this.numOffset.Margin = new System.Windows.Forms.Padding(4); this.numOffset.Maximum = new decimal(new int[] { 600, 0, @@ -69,7 +69,7 @@ 0, 0}); 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.Value = new decimal(new int[] { 180, @@ -79,54 +79,54 @@ // // btnRandOffset // - this.btnRandOffset.Location = new System.Drawing.Point(8, 101); - this.btnRandOffset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnRandOffset.Location = new System.Drawing.Point(7, 81); + this.btnRandOffset.Margin = new System.Windows.Forms.Padding(4); 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.Text = "Rand"; this.btnRandOffset.UseVisualStyleBackColor = true; - this.btnRandOffset.Click += new System.EventHandler(this.btnRandOffset_Click); + this.btnRandOffset.Click += new System.EventHandler(this.BtnRandOffset_Click); // // label1 // 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.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.Text = "Secs."; // // btnCustomSuspenedNow // - this.btnCustomSuspenedNow.Location = new System.Drawing.Point(181, 60); - this.btnCustomSuspenedNow.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnCustomSuspenedNow.Location = new System.Drawing.Point(161, 48); + this.btnCustomSuspenedNow.Margin = new System.Windows.Forms.Padding(4); 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.Text = "N"; this.btnCustomSuspenedNow.UseVisualStyleBackColor = true; - this.btnCustomSuspenedNow.Click += new System.EventHandler(this.btnCustomSuspenedNow_Click); + this.btnCustomSuspenedNow.Click += new System.EventHandler(this.BtnCustomSuspenedNow_Click); // // ddlCustomHour // this.ddlCustomHour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ddlCustomHour.FormattingEnabled = true; - this.ddlCustomHour.Location = new System.Drawing.Point(37, 63); - this.ddlCustomHour.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ddlCustomHour.Location = new System.Drawing.Point(33, 50); + this.ddlCustomHour.Margin = new System.Windows.Forms.Padding(4); 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; // // ddlCustomMinute // this.ddlCustomMinute.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ddlCustomMinute.FormattingEnabled = true; - this.ddlCustomMinute.Location = new System.Drawing.Point(109, 63); - this.ddlCustomMinute.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.ddlCustomMinute.Location = new System.Drawing.Point(97, 50); + this.ddlCustomMinute.Margin = new System.Windows.Forms.Padding(4); 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; // // grpSuspension @@ -141,10 +141,10 @@ this.grpSuspension.Controls.Add(this.chkSuspendAtCustom); this.grpSuspension.Dock = System.Windows.Forms.DockStyle.Fill; 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.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.grpSuspension.Size = new System.Drawing.Size(261, 213); + this.grpSuspension.Padding = new System.Windows.Forms.Padding(4); + this.grpSuspension.Size = new System.Drawing.Size(200, 167); this.grpSuspension.TabIndex = 12; this.grpSuspension.TabStop = false; this.grpSuspension.Text = "Suspension"; @@ -154,25 +154,25 @@ 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.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.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.Text = "00:00:00:00"; // // timTicker // this.timTicker.Enabled = true; - this.timTicker.Tick += new System.EventHandler(this.timTicker_Tick); + this.timTicker.Tick += new System.EventHandler(this.TimTicker_Tick); // // PnlSuspension // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.grpSuspension); + this.Margin = new System.Windows.Forms.Padding(0); 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); ((System.ComponentModel.ISupportInitialize)(this.numOffset)).EndInit(); this.grpSuspension.ResumeLayout(false); diff --git a/VAR.Toolbox/UI/Tools/PnlSuspension.cs b/VAR.Toolbox/UI/Tools/PnlSuspension.cs index 2834fba..2fd90ec 100644 --- a/VAR.Toolbox/UI/Tools/PnlSuspension.cs +++ b/VAR.Toolbox/UI/Tools/PnlSuspension.cs @@ -15,22 +15,22 @@ namespace VAR.Toolbox.UI private void PnlSuspension_Load(object sender, EventArgs e) { - ddlCustomHour_Load(); - ddlCustomMinute_Load(); + DdlCustomHour_Load(); + DdlCustomMinute_Load(); RandomizeOffset(); } - private void btnCustomSuspenedNow_Click(object sender, EventArgs e) + private void BtnCustomSuspenedNow_Click(object sender, EventArgs e) { CustomHourMinute_SetNow(); } - private void btnRandOffset_Click(object sender, EventArgs e) + private void BtnRandOffset_Click(object sender, EventArgs e) { RandomizeOffset(); } - private void timTicker_Tick(object sender, EventArgs e) + private void TimTicker_Tick(object sender, EventArgs e) { if (DesignMode) { return; } ResetCountdown(); @@ -73,7 +73,7 @@ namespace VAR.Toolbox.UI } - private void ddlCustomHour_Load() + private void DdlCustomHour_Load() { 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++) { diff --git a/VAR.Toolbox/VAR.Toolbox.csproj b/VAR.Toolbox/VAR.Toolbox.csproj index 8ec8d79..8460ef5 100644 --- a/VAR.Toolbox/VAR.Toolbox.csproj +++ b/VAR.Toolbox/VAR.Toolbox.csproj @@ -75,6 +75,7 @@ + @@ -183,9 +184,6 @@ Form - - FrmToolbox.cs -