using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FCC_Uber_MDX_Configurator { public partial class RemoteControlForm : Form { public RemoteControlForm() { InitializeComponent(); TXT_PORT.Text = GlobalStaticClass.RemoteControlProperties.port.ToString(); TXT_USER_NAME.Text = GlobalStaticClass.RemoteControlProperties.userName; CHK_ENABLE.Checked = GlobalStaticClass.RemoteControlProperties.enabled; } public void Save_Info() { GlobalStaticClass.RemoteControlProperties.enabled = CHK_ENABLE.Checked; int.TryParse(TXT_PORT.Text, out GlobalStaticClass.RemoteControlProperties.port); GlobalStaticClass.RemoteControlProperties.userName = TXT_USER_NAME.Text; } #region Verify Textboxes Only get Number Inputs private void KeyDown_IsANumber(object sender, KeyEventArgs e) { if (!char.IsDigit((char)e.KeyValue) && e.KeyData != Keys.Back && e.KeyData != Keys.Left && e.KeyData != Keys.Right && e.KeyData != Keys.Decimal && e.KeyValue != 190 && !e.KeyCode.Equals(Keys.NumPad0) && !e.KeyCode.Equals(Keys.NumPad1) && !e.KeyCode.Equals(Keys.NumPad2) && !e.KeyCode.Equals(Keys.NumPad3) && !e.KeyCode.Equals(Keys.NumPad4) && !e.KeyCode.Equals(Keys.NumPad5) && !e.KeyCode.Equals(Keys.NumPad6) && !e.KeyCode.Equals(Keys.NumPad7) && !e.KeyCode.Equals(Keys.NumPad8) && !e.KeyCode.Equals(Keys.NumPad9)) { e.SuppressKeyPress = true; } return; } #endregion #region Verify a Number is entered in TextBox private void Leave_VerifyTXTIsValid(object sender, EventArgs e) { try { TextBox _senderBox = (TextBox)sender; double _tempDbl; if (!double.TryParse(_senderBox.Text, out _tempDbl)) { ErrorForm _tempErrorForm = new ErrorForm(_senderBox.Name, "The value you entered is not valid"); _tempErrorForm.ShowDialog(); _senderBox.Focus(); } } catch (Exception) { ErrorForm _tempErrorForm = new ErrorForm("Unknown Error", "There was an unexpected untraceable error caught in the application. If you can reproduce this error, please let me know at FusionControlCentre@gmail.com"); _tempErrorForm.ShowDialog(); } } #endregion #region Register Remote Account private void BTN_REGISTER_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(@"http://www.fusioncontrolcentre.com/tcp/register.php"); } #endregion } }