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

            if (connection != null)
            {
                connection.Connect();
            }
        }
Ejemplo n.º 2
0
        public void CanConnectAndDisconnect()
        {
            DesktopConnection connection = new DesktopConnection("Desktop", 10);

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

            connection.Disconnect();
            Assert.IsFalse(connection.IsConnected);
        }
Ejemplo n.º 3
0
        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);
        }