Remove all build messages.

This commit is contained in:
2019-05-24 07:41:30 +02:00
parent b49c70a039
commit eac18b2e78
16 changed files with 92 additions and 81 deletions

View File

@@ -50,7 +50,7 @@
this.btnCoder.TabIndex = 0; this.btnCoder.TabIndex = 0;
this.btnCoder.Text = "Coder"; this.btnCoder.Text = "Coder";
this.btnCoder.UseVisualStyleBackColor = true; this.btnCoder.UseVisualStyleBackColor = true;
this.btnCoder.Click += new System.EventHandler(this.btnCoder_Click); this.btnCoder.Click += new System.EventHandler(this.BtnCoder_Click);
// //
// btnProxyCmd // btnProxyCmd
// //
@@ -60,7 +60,7 @@
this.btnProxyCmd.TabIndex = 1; this.btnProxyCmd.TabIndex = 1;
this.btnProxyCmd.Text = "ProxyCmd"; this.btnProxyCmd.Text = "ProxyCmd";
this.btnProxyCmd.UseVisualStyleBackColor = true; this.btnProxyCmd.UseVisualStyleBackColor = true;
this.btnProxyCmd.Click += new System.EventHandler(this.btnProxyCmd_Click); this.btnProxyCmd.Click += new System.EventHandler(this.BtnProxyCmd_Click);
// //
// btnWebcam // btnWebcam
// //
@@ -70,7 +70,7 @@
this.btnWebcam.TabIndex = 2; this.btnWebcam.TabIndex = 2;
this.btnWebcam.Text = "Webcam"; this.btnWebcam.Text = "Webcam";
this.btnWebcam.UseVisualStyleBackColor = true; this.btnWebcam.UseVisualStyleBackColor = true;
this.btnWebcam.Click += new System.EventHandler(this.btnWebcam_Click); this.btnWebcam.Click += new System.EventHandler(this.BtnWebcam_Click);
// //
// btnTunnelTCP // btnTunnelTCP
// //
@@ -81,7 +81,7 @@
this.btnTunnelTCP.TabIndex = 5; this.btnTunnelTCP.TabIndex = 5;
this.btnTunnelTCP.Text = "TunnelTCP"; this.btnTunnelTCP.Text = "TunnelTCP";
this.btnTunnelTCP.UseVisualStyleBackColor = true; this.btnTunnelTCP.UseVisualStyleBackColor = true;
this.btnTunnelTCP.Click += new System.EventHandler(this.btnTunnelTCP_Click); this.btnTunnelTCP.Click += new System.EventHandler(this.BtnTunnelTCP_Click);
// //
// lblToolbox // lblToolbox
// //
@@ -124,7 +124,7 @@
this.btnExit.TabIndex = 7; this.btnExit.TabIndex = 7;
this.btnExit.Text = "Exit"; this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true; this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click); this.btnExit.Click += new System.EventHandler(this.BtnExit_Click);
// //
// btnTestWebService // btnTestWebService
// //
@@ -135,7 +135,7 @@
this.btnTestWebService.TabIndex = 8; this.btnTestWebService.TabIndex = 8;
this.btnTestWebService.Text = "TestWebService"; this.btnTestWebService.Text = "TestWebService";
this.btnTestWebService.UseVisualStyleBackColor = true; this.btnTestWebService.UseVisualStyleBackColor = true;
this.btnTestWebService.Click += new System.EventHandler(this.btnTestWebService_Click); this.btnTestWebService.Click += new System.EventHandler(this.BtnTestWebService_Click);
// //
// btnScreenshooter // btnScreenshooter
// //
@@ -146,7 +146,7 @@
this.btnScreenshooter.TabIndex = 10; this.btnScreenshooter.TabIndex = 10;
this.btnScreenshooter.Text = "Screenshooter"; this.btnScreenshooter.Text = "Screenshooter";
this.btnScreenshooter.UseVisualStyleBackColor = true; this.btnScreenshooter.UseVisualStyleBackColor = true;
this.btnScreenshooter.Click += new System.EventHandler(this.btnScreenshooter_Click); this.btnScreenshooter.Click += new System.EventHandler(this.BtnScreenshooter_Click);
// //
// btnIPScan // btnIPScan
// //
@@ -157,7 +157,7 @@
this.btnIPScan.TabIndex = 11; this.btnIPScan.TabIndex = 11;
this.btnIPScan.Text = "IPScan"; this.btnIPScan.Text = "IPScan";
this.btnIPScan.UseVisualStyleBackColor = true; this.btnIPScan.UseVisualStyleBackColor = true;
this.btnIPScan.Click += new System.EventHandler(this.btnIPScan_Click); this.btnIPScan.Click += new System.EventHandler(this.BtnIPScan_Click);
// //
// btnNetworkInfo // btnNetworkInfo
// //
@@ -168,7 +168,7 @@
this.btnNetworkInfo.TabIndex = 12; this.btnNetworkInfo.TabIndex = 12;
this.btnNetworkInfo.Text = "NetworkInfo"; this.btnNetworkInfo.Text = "NetworkInfo";
this.btnNetworkInfo.UseVisualStyleBackColor = true; this.btnNetworkInfo.UseVisualStyleBackColor = true;
this.btnNetworkInfo.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnNetworkInfo_MouseClick); this.btnNetworkInfo.MouseClick += new System.Windows.Forms.MouseEventHandler(this.BtnNetworkInfo_MouseClick);
// //
// FrmToolbox // FrmToolbox
// //

View File

@@ -1,4 +1,6 @@
using System; #pragma warning disable IDE0019
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -34,10 +36,12 @@ namespace VAR.Toolbox.UI
private void InitializeCustomControls() private void InitializeCustomControls()
{ {
niTray = new NotifyIcon(); niTray = new NotifyIcon
niTray.Text = "VAR.Toolbox"; {
niTray.Visible = true; Text = "VAR.Toolbox",
niTray.MouseClick += niTray_MouseClick; Visible = true
};
niTray.MouseClick += NiTray_MouseClick;
} }
private void FrmToolbox_Load(object sender, EventArgs e) private void FrmToolbox_Load(object sender, EventArgs e)
@@ -73,7 +77,7 @@ namespace VAR.Toolbox.UI
} }
} }
private void btnExit_Click(object sender, EventArgs e) private void BtnExit_Click(object sender, EventArgs e)
{ {
DialogResult dialogResult = MessageBox.Show("Are you sure want to exit?", "Exit?", MessageBoxButtons.YesNo); DialogResult dialogResult = MessageBox.Show("Are you sure want to exit?", "Exit?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes) if (dialogResult == DialogResult.Yes)
@@ -85,7 +89,7 @@ namespace VAR.Toolbox.UI
} }
} }
private void niTray_MouseClick(object sender, MouseEventArgs e) private void NiTray_MouseClick(object sender, MouseEventArgs e)
{ {
if (Visible) if (Visible)
{ {
@@ -100,42 +104,42 @@ namespace VAR.Toolbox.UI
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;
} }
private void btnCoder_Click(object sender, EventArgs e) private void BtnCoder_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmCoder)); CreateWindow(typeof(FrmCoder));
} }
private void btnProxyCmd_Click(object sender, EventArgs e) private void BtnProxyCmd_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmProxyCmd)); CreateWindow(typeof(FrmProxyCmd));
} }
private void btnWebcam_Click(object sender, EventArgs e) private void BtnWebcam_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmWebcam)); CreateWindow(typeof(FrmWebcam));
} }
private void btnTunnelTCP_Click(object sender, EventArgs e) private void BtnTunnelTCP_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmTunnelTCP)); CreateWindow(typeof(FrmTunnelTCP));
} }
private void btnTestWebService_Click(object sender, EventArgs e) private void BtnTestWebService_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmTestWebService)); CreateWindow(typeof(FrmTestWebService));
} }
private void btnScreenshooter_Click(object sender, EventArgs e) private void BtnScreenshooter_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmScreenshooter)); CreateWindow(typeof(FrmScreenshooter));
} }
private void btnIPScan_Click(object sender, EventArgs e) private void BtnIPScan_Click(object sender, EventArgs e)
{ {
CreateWindow(typeof(FrmIPScan)); CreateWindow(typeof(FrmIPScan));
} }
private void btnNetworkInfo_MouseClick(object sender, MouseEventArgs e) private void BtnNetworkInfo_MouseClick(object sender, MouseEventArgs e)
{ {
CreateWindow(typeof(FrmNetworkInfo)); CreateWindow(typeof(FrmNetworkInfo));
} }
@@ -146,13 +150,13 @@ namespace VAR.Toolbox.UI
private Form CreateWindow(Type type) private Form CreateWindow(Type type)
{ {
Form frm = Activator.CreateInstance(type) as Form; var frm = Activator.CreateInstance(type) as Form;
if (frm == null) if (frm == null)
{ {
return null; return null;
} }
_forms.Add(frm); _forms.Add(frm);
frm.FormClosing += frmChild_FormClosing; frm.FormClosing += FrmChild_FormClosing;
if ((frm as IToolForm)?.HasIcon == false) if ((frm as IToolForm)?.HasIcon == false)
{ {
frm.Icon = Icon; frm.Icon = Icon;
@@ -161,9 +165,9 @@ namespace VAR.Toolbox.UI
return frm; return frm;
} }
private List<Form> _forms = new List<Form>(); private readonly List<Form> _forms = new List<Form>();
private void frmChild_FormClosing(object sender, FormClosingEventArgs e) private void FrmChild_FormClosing(object sender, FormClosingEventArgs e)
{ {
_forms.Remove((Form)sender); _forms.Remove((Form)sender);
} }

View File

@@ -63,7 +63,7 @@
this.btnDecode.TabIndex = 1; this.btnDecode.TabIndex = 1;
this.btnDecode.Text = "Decode"; this.btnDecode.Text = "Decode";
this.btnDecode.UseVisualStyleBackColor = true; this.btnDecode.UseVisualStyleBackColor = true;
this.btnDecode.Click += new System.EventHandler(this.btnDecodeBase64_Click); this.btnDecode.Click += new System.EventHandler(this.BtnDecode_Click);
// //
// txtOutput // txtOutput
// //
@@ -123,7 +123,7 @@
this.cboCode.Name = "cboCode"; this.cboCode.Name = "cboCode";
this.cboCode.Size = new System.Drawing.Size(131, 21); this.cboCode.Size = new System.Drawing.Size(131, 21);
this.cboCode.TabIndex = 4; this.cboCode.TabIndex = 4;
this.cboCode.SelectedIndexChanged += new System.EventHandler(this.cboCode_SelectedIndexChanged); this.cboCode.SelectedIndexChanged += new System.EventHandler(this.CboCode_SelectedIndexChanged);
// //
// btnEncode // btnEncode
// //
@@ -134,7 +134,7 @@
this.btnEncode.TabIndex = 3; this.btnEncode.TabIndex = 3;
this.btnEncode.Text = "Encode"; this.btnEncode.Text = "Encode";
this.btnEncode.UseVisualStyleBackColor = true; this.btnEncode.UseVisualStyleBackColor = true;
this.btnEncode.Click += new System.EventHandler(this.btnEncodeBase64_Click); this.btnEncode.Click += new System.EventHandler(this.BtnEncode_Click);
// //
// btnSwap // btnSwap
// //
@@ -145,7 +145,7 @@
this.btnSwap.TabIndex = 4; this.btnSwap.TabIndex = 4;
this.btnSwap.Text = "Swap"; this.btnSwap.Text = "Swap";
this.btnSwap.UseVisualStyleBackColor = true; this.btnSwap.UseVisualStyleBackColor = true;
this.btnSwap.Click += new System.EventHandler(this.btnSwap_Click); this.btnSwap.Click += new System.EventHandler(this.BtnSwap_Click);
// //
// FrmCoder // FrmCoder
// //

View File

@@ -20,7 +20,7 @@ namespace VAR.Toolbox.UI
private ITextCoder _coder = null; private ITextCoder _coder = null;
private void btnDecodeBase64_Click(object sender, EventArgs e) private void BtnDecode_Click(object sender, EventArgs e)
{ {
string output = string.Empty; string output = string.Empty;
try try
@@ -34,7 +34,7 @@ namespace VAR.Toolbox.UI
txtOutput.Text = output; txtOutput.Text = output;
} }
private void btnEncodeBase64_Click(object sender, EventArgs e) private void BtnEncode_Click(object sender, EventArgs e)
{ {
string output = string.Empty; string output = string.Empty;
try try
@@ -48,14 +48,14 @@ namespace VAR.Toolbox.UI
txtOutput.Text = output; txtOutput.Text = output;
} }
private void btnSwap_Click(object sender, EventArgs e) private void BtnSwap_Click(object sender, EventArgs e)
{ {
string temp = txtOutput.Text; string temp = txtOutput.Text;
txtOutput.Text = txtInput.Text; txtOutput.Text = txtInput.Text;
txtInput.Text = temp; txtInput.Text = temp;
} }
private void cboCode_SelectedIndexChanged(object sender, EventArgs e) private void CboCode_SelectedIndexChanged(object sender, EventArgs e)
{ {
string code = (string)cboCode.SelectedItem; string code = (string)cboCode.SelectedItem;
_coder = TextCoderFactory.CreateFromName(code); _coder = TextCoderFactory.CreateFromName(code);

View File

@@ -55,7 +55,7 @@
this.btnScan.TabIndex = 1; this.btnScan.TabIndex = 1;
this.btnScan.Text = "Scan"; this.btnScan.Text = "Scan";
this.btnScan.UseVisualStyleBackColor = true; this.btnScan.UseVisualStyleBackColor = true;
this.btnScan.Click += new System.EventHandler(this.btnScan_Click); this.btnScan.Click += new System.EventHandler(this.BtnScan_Click);
// //
// lblStatus // lblStatus
// //
@@ -76,7 +76,7 @@
this.btnStop.TabIndex = 3; this.btnStop.TabIndex = 3;
this.btnStop.Text = "Stop"; this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true; this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click); this.btnStop.Click += new System.EventHandler(this.BtnStop_Click);
// //
// txtSubnet // txtSubnet
// //

View File

@@ -54,13 +54,13 @@ namespace VAR.Toolbox.UI
} }
} }
private void btnScan_Click(object sender, EventArgs e) private void BtnScan_Click(object sender, EventArgs e)
{ {
Thread thread = new Thread(() => { IPScan(txtSubnet.Text); }); Thread thread = new Thread(() => { IPScan(txtSubnet.Text); });
thread.Start(); thread.Start();
} }
private void btnStop_Click(object sender, EventArgs e) private void BtnStop_Click(object sender, EventArgs e)
{ {
running = false; running = false;
} }

View File

@@ -59,7 +59,7 @@
this.ddlNetworkInterfaces.Name = "ddlNetworkInterfaces"; this.ddlNetworkInterfaces.Name = "ddlNetworkInterfaces";
this.ddlNetworkInterfaces.Size = new System.Drawing.Size(510, 21); this.ddlNetworkInterfaces.Size = new System.Drawing.Size(510, 21);
this.ddlNetworkInterfaces.TabIndex = 0; this.ddlNetworkInterfaces.TabIndex = 0;
this.ddlNetworkInterfaces.SelectedIndexChanged += new System.EventHandler(this.ddlNetworkInterfaces_SelectedIndexChanged); this.ddlNetworkInterfaces.SelectedIndexChanged += new System.EventHandler(this.DdlNetworkInterfaces_SelectedIndexChanged);
// //
// lblID // lblID
// //
@@ -226,7 +226,7 @@
// timRefresh // timRefresh
// //
this.timRefresh.Interval = 500; this.timRefresh.Interval = 500;
this.timRefresh.Tick += new System.EventHandler(this.timRefresh_Tick); this.timRefresh.Tick += new System.EventHandler(this.TimRefresh_Tick);
// //
// FrmNetworkInfo // FrmNetworkInfo
// //

View File

@@ -1,4 +1,6 @@
using System; #pragma warning disable IDE0019
using System;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Text; using System.Text;
@@ -32,14 +34,14 @@ namespace VAR.Toolbox.UI
timRefresh.Stop(); timRefresh.Stop();
} }
private void ddlNetworkInterfaces_SelectedIndexChanged(object sender, EventArgs e) private void DdlNetworkInterfaces_SelectedIndexChanged(object sender, EventArgs e)
{ {
ListItem listItem = ddlNetworkInterfaces.SelectedItem as ListItem; var listItem = ddlNetworkInterfaces.SelectedItem as ListItem;
if (listItem == null) { return; } if (listItem == null) { return; }
RefreshInterface(listItem.ID); RefreshInterface(listItem.ID);
} }
private void timRefresh_Tick(object sender, EventArgs e) private void TimRefresh_Tick(object sender, EventArgs e)
{ {
RefreshInterfaces(); RefreshInterfaces();
RefreshInterface(); RefreshInterface();
@@ -135,17 +137,17 @@ namespace VAR.Toolbox.UI
{ {
return string.Format("{0}kbps", Math.Round(dSpeed, 2)); return string.Format("{0}kbps", Math.Round(dSpeed, 2));
} }
dSpeed = dSpeed / 1000; dSpeed /= 1000;
if (dSpeed < 1000) if (dSpeed < 1000)
{ {
return string.Format("{0}mbps", Math.Round(dSpeed, 2)); return string.Format("{0}mbps", Math.Round(dSpeed, 2));
} }
dSpeed = dSpeed / 1000; dSpeed /= 1000;
if (dSpeed < 1000) if (dSpeed < 1000)
{ {
return string.Format("{0}gbps", Math.Round(dSpeed, 2)); return string.Format("{0}gbps", Math.Round(dSpeed, 2));
} }
dSpeed = dSpeed / 1000; dSpeed /= 1000;
return string.Format("{0}tbps", Math.Round(dSpeed, 2)); return string.Format("{0}tbps", Math.Round(dSpeed, 2));
} }

View File

@@ -89,7 +89,7 @@
this.txtInput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtInput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtInput.Size = new System.Drawing.Size(413, 55); this.txtInput.Size = new System.Drawing.Size(413, 55);
this.txtInput.TabIndex = 0; this.txtInput.TabIndex = 0;
this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown); this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtInput_KeyDown);
// //
// ddlCurrentConfig // ddlCurrentConfig
// //
@@ -101,7 +101,7 @@
this.ddlCurrentConfig.Name = "ddlCurrentConfig"; this.ddlCurrentConfig.Name = "ddlCurrentConfig";
this.ddlCurrentConfig.Size = new System.Drawing.Size(342, 21); this.ddlCurrentConfig.Size = new System.Drawing.Size(342, 21);
this.ddlCurrentConfig.TabIndex = 4; this.ddlCurrentConfig.TabIndex = 4;
this.ddlCurrentConfig.SelectedIndexChanged += new System.EventHandler(this.ddlCurrentConfig_SelectedIndexChanged); this.ddlCurrentConfig.SelectedIndexChanged += new System.EventHandler(this.DdlCurrentConfig_SelectedIndexChanged);
// //
// btnConfig // btnConfig
// //
@@ -112,7 +112,7 @@
this.btnConfig.TabIndex = 5; this.btnConfig.TabIndex = 5;
this.btnConfig.Text = "Config"; this.btnConfig.Text = "Config";
this.btnConfig.UseVisualStyleBackColor = true; this.btnConfig.UseVisualStyleBackColor = true;
this.btnConfig.Click += new System.EventHandler(this.btnConfig_Click); this.btnConfig.Click += new System.EventHandler(this.BtnConfig_Click);
// //
// FrmProxyCmd // FrmProxyCmd
// //

View File

@@ -1,4 +1,6 @@
using System; #pragma warning disable IDE0019
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
@@ -14,9 +16,9 @@ namespace VAR.Toolbox.UI
#region Declarations #region Declarations
private object _executionLock = new object(); private readonly object _executionLock = new object();
private List<string> _cmdHistory = new List<string>(); private readonly List<string> _cmdHistory = new List<string>();
private int _currentHistoryIndex = -1; private int _currentHistoryIndex = -1;
#endregion Declarations #endregion Declarations
@@ -33,7 +35,7 @@ namespace VAR.Toolbox.UI
#region UI events #region UI events
private void txtInput_KeyDown(object sender, KeyEventArgs e) private void TxtInput_KeyDown(object sender, KeyEventArgs e)
{ {
if (Monitor.IsEntered(_executionLock)) if (Monitor.IsEntered(_executionLock))
{ {
@@ -105,12 +107,12 @@ namespace VAR.Toolbox.UI
} }
} }
private void ddlCurrentConfig_SelectedIndexChanged(object sender, EventArgs e) private void DdlCurrentConfig_SelectedIndexChanged(object sender, EventArgs e)
{ {
CleanProxyCmdExecutor(); CleanProxyCmdExecutor();
} }
private void btnConfig_Click(object sender, EventArgs e) private void BtnConfig_Click(object sender, EventArgs e)
{ {
FrmToolbox.StaticCreateWindow(typeof(FrmProxyCmdConfig)); FrmToolbox.StaticCreateWindow(typeof(FrmProxyCmdConfig));
} }
@@ -130,8 +132,7 @@ namespace VAR.Toolbox.UI
} }
private void CleanProxyCmdExecutor() private void CleanProxyCmdExecutor()
{ {
IDisposable disposableProxyCmdExecutor = _proxyCmdExecutor as IDisposable; if (_proxyCmdExecutor is IDisposable disposableProxyCmdExecutor)
if (disposableProxyCmdExecutor != null)
{ {
disposableProxyCmdExecutor.Dispose(); disposableProxyCmdExecutor.Dispose();
} }
@@ -180,8 +181,10 @@ namespace VAR.Toolbox.UI
List<ProxyCmdConfigItem> configItems = FrmProxyCmdConfig.GetConfigurationItems(); List<ProxyCmdConfigItem> configItems = FrmProxyCmdConfig.GetConfigurationItems();
string previousSelectedName = null; string previousSelectedName = null;
ProxyCmdConfigItem selectedConfig = ddlCurrentConfig.SelectedItem as ProxyCmdConfigItem; if (ddlCurrentConfig.SelectedItem is ProxyCmdConfigItem selectedConfig)
if (selectedConfig != null) { previousSelectedName = selectedConfig.Name; } {
previousSelectedName = selectedConfig.Name;
}
ddlCurrentConfig.Items.Clear(); ddlCurrentConfig.Items.Clear();
ddlCurrentConfig.Items.AddRange(configItems.ToArray()); ddlCurrentConfig.Items.AddRange(configItems.ToArray());
ddlCurrentConfig.SelectedIndex = 0; ddlCurrentConfig.SelectedIndex = 0;
@@ -200,7 +203,7 @@ namespace VAR.Toolbox.UI
private string GetCurrentConfig() private string GetCurrentConfig()
{ {
ProxyCmdConfigItem selectedConfig = ddlCurrentConfig.SelectedItem as ProxyCmdConfigItem; var selectedConfig = ddlCurrentConfig.SelectedItem as ProxyCmdConfigItem;
if (selectedConfig == null) { return null; } if (selectedConfig == null) { return null; }
return selectedConfig.Config; return selectedConfig.Config;
} }

View File

@@ -43,7 +43,7 @@
this.btnScreenshoot.TabIndex = 1; this.btnScreenshoot.TabIndex = 1;
this.btnScreenshoot.Text = "Screenshoot"; this.btnScreenshoot.Text = "Screenshoot";
this.btnScreenshoot.UseVisualStyleBackColor = true; this.btnScreenshoot.UseVisualStyleBackColor = true;
this.btnScreenshoot.Click += new System.EventHandler(this.btnScreenshoot_Click); this.btnScreenshoot.Click += new System.EventHandler(this.BtnScreenshoot_Click);
// //
// picViewer // picViewer
// //
@@ -67,7 +67,7 @@
this.btnStartStop.TabIndex = 2; this.btnStartStop.TabIndex = 2;
this.btnStartStop.Text = "Start"; this.btnStartStop.Text = "Start";
this.btnStartStop.UseVisualStyleBackColor = true; this.btnStartStop.UseVisualStyleBackColor = true;
this.btnStartStop.Click += new System.EventHandler(this.btnStartStop_Click); this.btnStartStop.Click += new System.EventHandler(this.BtnStartStop_Click);
// //
// FrmScreenshooter // FrmScreenshooter
// //

View File

@@ -13,7 +13,7 @@ namespace VAR.Toolbox.UI
public bool HasIcon { get { return false; } } public bool HasIcon { get { return false; } }
private bool _repetitiveScreenshots = false; private bool _repetitiveScreenshots = false;
private Timer timTicker; private readonly Timer timTicker;
private Bitmap bmpScreen = null; private Bitmap bmpScreen = null;
public FrmScreenshooter() public FrmScreenshooter()
@@ -21,13 +21,15 @@ namespace VAR.Toolbox.UI
InitializeComponent(); InitializeComponent();
if (components == null) { components = new Container(); } if (components == null) { components = new Container(); }
timTicker = new Timer(components); timTicker = new Timer(components)
timTicker.Interval = 16; {
timTicker.Enabled = false; Interval = 16,
Enabled = false
};
timTicker.Tick += TimTicker_Tick; timTicker.Tick += TimTicker_Tick;
} }
private void btnScreenshoot_Click(object sender, EventArgs e) private void BtnScreenshoot_Click(object sender, EventArgs e)
{ {
bmpScreen = Screenshooter.CaptureScreen(bmpScreen); bmpScreen = Screenshooter.CaptureScreen(bmpScreen);
picViewer.ImageShow = bmpScreen; picViewer.ImageShow = bmpScreen;
@@ -41,7 +43,7 @@ namespace VAR.Toolbox.UI
timTicker.Start(); timTicker.Start();
} }
private void btnStartStop_Click(object sender, EventArgs e) private void BtnStartStop_Click(object sender, EventArgs e)
{ {
GC.Collect(); GC.Collect();
if (_repetitiveScreenshots) if (_repetitiveScreenshots)

View File

@@ -48,7 +48,7 @@
this.btnRun.TabIndex = 0; this.btnRun.TabIndex = 0;
this.btnRun.Text = "Run"; this.btnRun.Text = "Run";
this.btnRun.UseVisualStyleBackColor = true; this.btnRun.UseVisualStyleBackColor = true;
this.btnRun.Click += new System.EventHandler(this.btnRun_Click); this.btnRun.Click += new System.EventHandler(this.BtnRun_Click);
// //
// btnStop // btnStop
// //
@@ -59,7 +59,7 @@
this.btnStop.TabIndex = 1; this.btnStop.TabIndex = 1;
this.btnStop.Text = "Stop"; this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true; this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click); this.btnStop.Click += new System.EventHandler(this.BtnStop_Click);
// //
// lblRemoteHost // lblRemoteHost
// //

View File

@@ -32,7 +32,7 @@ namespace VAR.Toolbox.UI
btnRun.Enabled = true; btnRun.Enabled = true;
} }
private void btnStop_Click(object sender, EventArgs e) private void BtnStop_Click(object sender, EventArgs e)
{ {
if (_running == false) { return; } if (_running == false) { return; }
@@ -41,7 +41,7 @@ namespace VAR.Toolbox.UI
btnRun.Enabled = true; btnRun.Enabled = true;
} }
private void btnRun_Click(object sender, EventArgs e) private void BtnRun_Click(object sender, EventArgs e)
{ {
if (_running == true) { return; } if (_running == true) { return; }

View File

@@ -44,7 +44,7 @@
this.btnStartStop.TabIndex = 4; this.btnStartStop.TabIndex = 4;
this.btnStartStop.Text = "Start"; this.btnStartStop.Text = "Start";
this.btnStartStop.UseVisualStyleBackColor = true; this.btnStartStop.UseVisualStyleBackColor = true;
this.btnStartStop.Click += new System.EventHandler(this.btnStartStop_Click); this.btnStartStop.Click += new System.EventHandler(this.BtnStartStop_Click);
// //
// cboWebcams // cboWebcams
// //

View File

@@ -21,10 +21,10 @@ namespace VAR.Toolbox.UI
private void FrmWebcam_Load(object sender, EventArgs e) private void FrmWebcam_Load(object sender, EventArgs e)
{ {
cboWebcams_LoadData(); CboWebcams_LoadData();
} }
private void webcam_NewFrame(object sender, Bitmap frame) private void Webcam_NewFrame(object sender, Bitmap frame)
{ {
picWebcam.ImageShow = frame; picWebcam.ImageShow = frame;
} }
@@ -37,7 +37,7 @@ namespace VAR.Toolbox.UI
} }
} }
private void btnStartStop_Click(object sender, EventArgs e) private void BtnStartStop_Click(object sender, EventArgs e)
{ {
if (webcam == null) if (webcam == null)
{ {
@@ -65,7 +65,7 @@ namespace VAR.Toolbox.UI
if (cboWebcams.SelectedIndex < 0) { return; } if (cboWebcams.SelectedIndex < 0) { return; }
WebcamObject webcamObject = (WebcamObject)cboWebcams.SelectedItem; WebcamObject webcamObject = (WebcamObject)cboWebcams.SelectedItem;
webcam = new Webcam(webcamObject.Moniker); webcam = new Webcam(webcamObject.Moniker);
webcam.NewFrame += webcam_NewFrame; webcam.NewFrame += Webcam_NewFrame;
} }
private class WebcamObject private class WebcamObject
@@ -79,7 +79,7 @@ namespace VAR.Toolbox.UI
} }
}; };
private void cboWebcams_LoadData() private void CboWebcams_LoadData()
{ {
try try
{ {