private void disconnectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DesktopConnection connection = ((ConnectionListViewItem)connectionsListView.SelectedItems[0]).Connection as DesktopConnection;

            if (connection != null)
            {
                connection.Disconnect();
            }
        }
Пример #2
0
        public void CanConnectAndDisconnect()
        {
            DesktopConnection connection = new DesktopConnection("Desktop", 10);

            connection.Connect();
            Assert.IsTrue(connection.IsConnected);

            connection.Disconnect();
            Assert.IsFalse(connection.IsConnected);
        }
Пример #3
0
        public void DisconnectRaisesStateChangeEvent()
        {
            DesktopConnection connection = new DesktopConnection("Desktop", 10);

            bool   isConnected = true;
            string networkName = string.Empty;
            EventHandler <StateChangedEventArgs> handler =
                new EventHandler <StateChangedEventArgs>(
                    delegate(object sender, StateChangedEventArgs args) { isConnected = args.IsConnected; });

            connection.StateChanged += handler;
            connection.Disconnect();

            Assert.IsFalse(isConnected);
        }