private void _service_TerminalChannelListChanged(object sender, ChannelListChangedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EventHandler <ChannelListChangedEventArgs>(_service_TerminalChannelListChanged),
                            sender, e);
                return;
            }

            var termChannel = e.Channel as SshWinConsoleChannel;

            // Add/remove item from list box depending on change to list.
            switch (e.Action)
            {
            case ChannelListAction.ChannelOpened:
                sessionsListBox.Items.Add(termChannel, false);
                break;

            case ChannelListAction.ChannelClosed:
                sessionsListBox.Items.Remove(termChannel);
                break;

            case ChannelListAction.ChannelUpdated:
                OnTerminalChannelUpdated(termChannel);
                break;
            }

            activeSessionsLabel.Text = _service.AllTerminalChannels.Count.ToString();
        }
Beispiel #2
0
        private void _service_TerminalChannelListChanged(object sender, ChannelListChangedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EventHandler<ChannelListChangedEventArgs>(_service_TerminalChannelListChanged),
                    sender, e);
                return;
            }

            var termChannel = e.Channel as SshWinConsoleChannel;

            // Add/remove item from list box depending on change to list.
            switch (e.Action)
            {
                case ChannelListAction.ChannelOpened:
                    sessionsListBox.Items.Add(termChannel, false);
                    break;
                case ChannelListAction.ChannelClosed:
                    sessionsListBox.Items.Remove(termChannel);
                    break;
                case ChannelListAction.ChannelUpdated:
                    OnTerminalChannelUpdated(termChannel);
                    break;
            }

            activeSessionsLabel.Text = _service.AllTerminalChannels.Count.ToString();
        }