public bool AddHost(String value) { foreach (IHostProvider hostProvider in this.hostProviders) { if (hostProvider.ValidHostValue(value)) { try { BasicHost host = hostProvider.Host(value, this); if (host != null) { lock (addHostLock) { this.mainWindow.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => { if (hosts.Count == 0) { this.updateDispatchTimer.Start(); this.pingDispatchTimer.Start(); } hosts.Add(host); host.Ping().Start(); })); } } return(true); } catch (BasicHostAllReadyExistsException e) { return(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } } } return(false); }
private void btnRemoveHost_Click(object sender, RoutedEventArgs e) { System.Diagnostics.Debug.WriteLine("MainWindow.btnRemoveHost_Click()"); BasicHost host = (BasicHost)(((Button)sender).DataContext); this.HostsManager.RemoveHost(host); }
public void RemoveHost(BasicHost host) { host.RemoveHost(); hosts.Remove(host); if (hosts.Count == 0) { this.updateDispatchTimer.Stop(); this.pingDispatchTimer.Stop(); } }
public void ToggleHostPause(BasicHost host) { if (host.IsPaused) { host.UnPause(); } else { host.Pause(); } }