public CreateForm(out GliderConnection connection) { InitializeComponent(); connection = new GliderConnection(); _connection = connection; name_txt.Focus(); }
private void view_btn_Click(object sender, EventArgs e) { GliderConnection _conn = getSelectedConnection(); if (_conn != null) { new ViewForm(_conn).ShowDialog(); } }
public ViewForm(GliderConnection connection) { InitializeComponent(); _connection = connection; _timer = new Timer(); _timer.Interval = 40; _timer.Tick += new System.EventHandler(this.timer_Tick); _last = null; _eventAdded = false; }
private GliderConnection getSelectedConnection() { GliderConnection _conn = null; if (connections_tc.Controls.Count > 0) { _conn = ((objects.TabPage)connections_tc.SelectedTab).Connection; } return(_conn); }
private void disconnect_btn_Click(object sender, EventArgs e) { GliderConnection _conn = getSelectedConnection(); if (_conn != null && _conn.Status) { _conn.Disconnect(); } CheckButton(); }
private void connectTimer_Tick(object sender, EventArgs e) { GliderConnection _conn = getSelectedConnection(); if (_conn != null && !_conn.Connecting) { System.Windows.Forms.Timer timer = ((System.Windows.Forms.Timer)sender); timer.Enabled = false; timer.Dispose(); } CheckButton(); }
private void connect_btn_Click(object sender, EventArgs e) { GliderConnection _conn = getSelectedConnection(); if (!_conn.Connecting) { connect_btn.Image = LenHandler.Properties.Resources.loader; Thread thread = new Thread(new ThreadStart(_conn.Connect)); thread.IsBackground = false; thread.Start(); _openThread.Add(thread); System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Interval = 500; timer.Tick += new System.EventHandler(this.connectTimer_Tick); timer.Enabled = true; } }
private void CheckButton() { bool _status = false; connect_btn.Enabled = false; GliderConnection _conn = getSelectedConnection(); if (_conn != null) { _status = _conn.Status; if (!_conn.Connecting) { connect_btn.Image = null; } else { connect_btn.Image = LenHandler.Properties.Resources.loader; } connect_btn.Enabled = !_status; } disconnect_btn.Enabled = _status; view_btn.Enabled = _status; cmd_btn.Enabled = _status; }
public CommandForm(GliderConnection connection) { InitializeComponent(); _connection = connection; }