A form which displays the audit events produced by the server.
상속: System.Windows.Forms.Form
예제 #1
0
 /// <summary>
 /// Handles the FormClosing event of the AuditEventForm control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.FormClosingEventArgs"/> instance containing the event data.</param>
 void AuditEventForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Object.ReferenceEquals(m_auditEventForm, sender))
     {
         m_auditEventForm = null;
     }
 }
예제 #2
0
        /// <summary>
        /// Handles the Click event of the View_AuditEventsMI control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void View_AuditEventsMI_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_auditEventForm == null)
                {
                    m_auditEventForm              = new AuditEventForm(m_session, m_subscription);
                    m_auditEventForm.FormClosing += new FormClosingEventHandler(AuditEventForm_FormClosing);
                }

                m_auditEventForm.Show();
                m_auditEventForm.BringToFront();
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
예제 #3
0
        /// <summary>
        /// Updates the application after connecting to or disconnecting from the server.
        /// </summary>
        private void Server_ConnectComplete(object sender, EventArgs e)
        {
            try
            {
                m_session = ConnectServerCTRL.Session;

                // check for disconnect.
                if (m_session == null)
                {
                    if (m_auditEventForm != null)
                    {
                        m_auditEventForm.Close();
                        m_auditEventForm = null;
                    }

                    return;
                }

                // set a suitable initial state.
                if (m_session != null && !m_connectedOnce)
                {
                    m_connectedOnce = true;
                }

                // create the default subscription.
                m_subscription = new Subscription();

                m_subscription.DisplayName                = null;
                m_subscription.PublishingInterval         = 1000;
                m_subscription.KeepAliveCount             = 10;
                m_subscription.LifetimeCount              = 100;
                m_subscription.MaxNotificationsPerPublish = 1000;
                m_subscription.PublishingEnabled          = true;
                m_subscription.TimestampsToReturn         = TimestampsToReturn.Both;

                m_session.AddSubscription(m_subscription);
                m_subscription.Create();

                // must specify the fields that the form is interested in.
                m_filter.SelectClauses = m_filter.ConstructSelectClauses(
                    m_session,
                    NodeId.Parse("ns=2;s=4:2"),
                    NodeId.Parse("ns=2;s=4:1"),
                    ObjectTypeIds.DialogConditionType,
                    ObjectTypeIds.ExclusiveLimitAlarmType,
                    ObjectTypeIds.NonExclusiveLimitAlarmType);

                // create a monitored item based on the current filter settings.
                m_monitoredItem = m_filter.CreateMonitoredItem(m_session);

                // set up callback for notifications.
                m_monitoredItem.Notification += m_MonitoredItem_Notification;

                m_subscription.AddItem(m_monitoredItem);
                m_subscription.ApplyChanges();

                // send an initial refresh.
                Conditions_RefreshMI_Click(sender, e);

                ConditionsMI.Enabled = true;
                ViewMI.Enabled       = true;
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
예제 #4
0
        /// <summary>
        /// Updates the application after connecting to or disconnecting from the server.
        /// </summary>
        private void Server_ConnectComplete(object sender, EventArgs e)
        {
            try
            {
                m_session = ConnectServerCTRL.Session;

                // check for disconnect.
                if (m_session == null)
                {
                    if (m_auditEventForm != null)
                    {
                        m_auditEventForm.Close();
                        m_auditEventForm = null;
                    }

                    return;
                }

                // set a suitable initial state.
                if (m_session != null && !m_connectedOnce)
                {
                    m_connectedOnce = true;
                }

                // create the default subscription.
                m_subscription = new Subscription();

                m_subscription.DisplayName = null;
                m_subscription.PublishingInterval = 1000;
                m_subscription.KeepAliveCount = 10;
                m_subscription.LifetimeCount = 100;
                m_subscription.MaxNotificationsPerPublish = 1000;
                m_subscription.PublishingEnabled = true;
                m_subscription.TimestampsToReturn = TimestampsToReturn.Both;

                m_session.AddSubscription(m_subscription);
                m_subscription.Create();

                // must specify the fields that the form is interested in.
                m_filter.SelectClauses = m_filter.ConstructSelectClauses(
                    m_session,
                    NodeId.Parse("ns=2;s=4:2"),
                    NodeId.Parse("ns=2;s=4:1"),
                    ObjectTypeIds.DialogConditionType,
                    ObjectTypeIds.ExclusiveLimitAlarmType,
                    ObjectTypeIds.NonExclusiveLimitAlarmType);

                // create a monitored item based on the current filter settings.
                m_monitoredItem = m_filter.CreateMonitoredItem(m_session);

                // set up callback for notifications.
                m_monitoredItem.Notification += m_MonitoredItem_Notification;

                m_subscription.AddItem(m_monitoredItem);
                m_subscription.ApplyChanges();

                // send an initial refresh.
                Conditions_RefreshMI_Click(sender, e);

                ConditionsMI.Enabled = true;
                ViewMI.Enabled = true;
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
예제 #5
0
 /// <summary>
 /// Handles the FormClosing event of the AuditEventForm control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.FormClosingEventArgs"/> instance containing the event data.</param>
 void AuditEventForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Object.ReferenceEquals(m_auditEventForm, sender))
     {
         m_auditEventForm = null;
     }
 }
예제 #6
0
        /// <summary>
        /// Handles the Click event of the View_AuditEventsMI control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void View_AuditEventsMI_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_auditEventForm == null)
                {
                    m_auditEventForm = new AuditEventForm(m_session, m_subscription);
                    m_auditEventForm.FormClosing += new FormClosingEventHandler(AuditEventForm_FormClosing);
                }

                m_auditEventForm.Show();
                m_auditEventForm.BringToFront();
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }