private void OnConnectProgress(int progressPercentage, string status) { LastConnectStatus = new ConnectProgressChangedEventArgs(progressPercentage, status); if (ConnectProgress != null) { ConnectProgress(this, LastConnectStatus); } }
/// <summary> /// Connects to an INSTEON network using the specified connection. /// </summary> /// <param name="connection">Specifies the connection to the INSTEON powerline controller device, which can accessed serially or over the network. Examples: "serial: COM1" or "net: 192.168.2.5".</param> public void Connect(InsteonConnection connection) { Messenger.Connect(connection); Connection = connection; Controller = new InsteonController(this); OnConnected(); LastConnectStatus = null; }
/// <summary> /// Connects to an INSTEON network using the specified connection. /// </summary> /// <param name="connection">Specifies the connection to the INSTEON controller device, which can accessed serially or over the network. Examples: "serial: COM1" or "net: 192.168.2.5".</param> /// <returns>Returns true if a connection was successfully made, or false if unable to find a connection.</returns> /// <remarks> /// This method does not throw an exception. /// </remarks> public bool TryConnect(InsteonConnection connection) { if (!Messenger.TryConnect(connection)) { return(false); } Connection = connection; Controller = new InsteonController(this); OnConnected(); LastConnectStatus = null; return(true); }
private void Network_ConnectProgress(object sender, ConnectProgressChangedEventArgs e) { if (stopping) e.Cancel = true; this.Dispatcher.BeginInvoke(new Action(() => { progressBar.Value = e.ProgressPercentage; statusTextBlock.Text = e.Status; } ), null); }
private void OnConnectProgress(int progressPercentage, string status) { LastConnectStatus = new ConnectProgressChangedEventArgs(progressPercentage, status); ConnectProgress?.Invoke(this, LastConnectStatus); }
/// <summary> /// Connects to an INSTEON network using the specified connection. /// </summary> /// <param name="connection">Specifies the connection to the INSTEON controller device, which can accessed serially or over the network. Examples: "serial: COM1" or "net: 192.168.2.5".</param> /// <returns>Returns true if a connection was successfully made, or false if unable to find a connection.</returns> /// <remarks> /// This method does not throw an exception. /// </remarks> public bool TryConnect(InsteonConnection connection) { if (!this.Messenger.TryConnect(connection)) { return false; } this.Connection = connection; this.Controller = new InsteonController(this); this.OnConnected(); this.LastConnectStatus = null; return true; }
private void OnConnectProgress(int progressPercentage, string status) { this.LastConnectStatus = new ConnectProgressChangedEventArgs(progressPercentage, status); if (this.ConnectProgress != null) { this.ConnectProgress(this, this.LastConnectStatus); } }
private void Network_ConnectProgress(object sender, ConnectProgressChangedEventArgs e) { this.Dispatcher.BeginInvoke(new Action(() => this.UpdateStatus()), null); }