Ejemplo n.º 1
0
        //-----------------

        public MyAeSession(string url) : base(url)
        {
            StateChangeCompleted            += new StateChangeEventHandler(HandleStateChangeCompleted);
            PerformStateTransitionCompleted += new PerformStateTransitionEventHandler(HandlePerformObjectStateTransitionCompleted);
            ShutdownRequest          += new ShutdownEventHandler(HandleShutdown);
            GetServerStatusCompleted += new GetStatusEventHandler(HandleGetStatusCompleted);
        }
        /// <summary>
        /// Completes an asynchronous get status request and updates the control.
        /// </summary>
        private void OnGetStatus(IAsyncResult result)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new AsyncCallback(OnGetStatus), result);
                return;
            }

            try
            {
                GetStatusEventHandler callback = (GetStatusEventHandler)result.AsyncState;

                OpcServerStatus status = callback.EndInvoke(result);

                ShowPanels   = true;
                InfoPN.Text  = status.VendorInfo;
                StatePN.Text = (status.StatusInfo == null)?status.ServerState.ToString():status.StatusInfo;
                TimePN.Text  = status.CurrentTime.ToString();
            }
            catch (Exception e)
            {
                ShowPanels = false;
                Text       = e.Message;
            }
        }
Ejemplo n.º 3
0
        //-----------------

        public MyDaSession(string url) : base(url)
        {
            StateChangeCompleted            += new StateChangeEventHandler(HandleStateChanged);
            PerformStateTransitionCompleted += new PerformStateTransitionEventHandler(HandlePerformStateTransition);
            ShutdownRequest    += new ShutdownEventHandler(HandleServerShutdown);
            ReadCompleted      += new SessionReadEventHandler(HandleSessionReadCompleted);
            WriteCompleted     += new SessionWriteEventHandler(HandleSessionWriteCompleted);
            GetStatusCompleted += new GetStatusEventHandler(HandleGetServerStatus);
        }
 /// <summary>
 /// Called when the update timer expires - begins a get status request.
 /// </summary>
 private void UpdateTimer_Tick(object sender, System.EventArgs e)
 {
     try
     {
         GetStatusEventHandler callback = new GetStatusEventHandler(m_server.GetServerStatus);
         callback.BeginInvoke(new AsyncCallback(OnGetStatus), callback);
     }
     catch (Exception exception)
     {
         ShowPanels = false;
         Text       = exception.Message;
     }
 }