示例#1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Lance la commande
        /// </summary>
        /// <param name="parameters">les parametres</param>
        /// <param name="logger">le logger</param>
        /// <param name="tunnel">le tunnel</param>
        /// <param name="sid">le jeton de session</param>
        /// -----------------------------------------------------------------------------
        public override void Execute(string[] parameters, ILogger logger, ITunnel tunnel, int sid)
        {
            MonitorResponse response = tunnel.Monitor(new SessionContextRequest(sid));

            if (response.Success)
            {
                LogObject(logger, 0, response.Sessions);
                logger.Log(this, string.Format(Strings.CURRENT_SID, sid.ToString("x")), ESeverity.INFO);
            }
            else
            {
                logger.Log(this, response.Message, ESeverity.ERROR);
            }
        }
示例#2
0
        private void RefreshSessions()
        {
            try
            {
                BtRefresh.Enabled = BtClose.Enabled = false;
                UseWaitCursor     = true;

                Application.DoEvents();
                var response = _tunnel.Monitor(new SessionContextRequest(_sid));
                if (response.Success)
                {
                    _currentsession = default(Session);
                    SessionsBindingSource.DataSource = response.Sessions;
                    SessionsBindingSource.ResetBindings(false);

                    if (Sessions.SelectedRows.Count > 0)
                    {
                        _currentsession = (Session)Sessions.SelectedRows[0].DataBoundItem;
                        ConnectionsBindingSource.DataSource = _currentsession.Connections;
                    }
                    else
                    {
                        ConnectionsBindingSource.DataSource = null;
                    }
                }
                else
                {
                    HandleResponse(response);
                }
            }
            finally
            {
                BtRefresh.Enabled = BtClose.Enabled = true;
                UseWaitCursor     = false;
            }
        }