private void connectToolStripMenuItem_Click(object sender, EventArgs e) { DesktopConnection connection = ((ConnectionListViewItem)connectionsListView.SelectedItems[0]).Connection as DesktopConnection; if (connection != null) { connection.Connect(); } }
public void CanConnectAndDisconnect() { DesktopConnection connection = new DesktopConnection("Desktop", 10); connection.Connect(); Assert.IsTrue(connection.IsConnected); connection.Disconnect(); Assert.IsFalse(connection.IsConnected); }
public void ConnectRaisesStateChangeEvent() { DesktopConnection connection = new DesktopConnection("Desktop", 10); bool isConnected = false; string networkName = string.Empty; EventHandler <StateChangedEventArgs> handler = new EventHandler <StateChangedEventArgs>( delegate(object sender, StateChangedEventArgs args) { isConnected = args.IsConnected; }); connection.StateChanged += handler; connection.Connect(); Assert.IsTrue(isConnected); }