Showing results 1 to 4 of 4

Thread: Alarm events

  1. #1

    Default Alarm events

    Hello,

    For a project we need to do something on the event of a new Alarm. We would like to do this in VSTA using C# code. But the documentation doesn't tell us how to capture the AlarmComes event.

    Best regards,

    Stephan de Wit

  2. #2
    Join Date
    28.07.2008
    Posts
    64

    Default Re: Alarm events

    Try this

    using System;
    using System.Collections.Generic;
    
    namespace ProjectAddin
    {
        [System.AddIn.AddIn("ThisProject", Version = "1.0", Publisher = "", Description = "")]
        public partial class ThisProject
        {
            zenOn.IAlarm zAlarm;
    
            private void ThisProject_Startup(object sender, EventArgs e)
            {
                try
                {   
    
                    //init the alarm object for events
                    zAlarm = this.Alarm();
    
                    //Initial Events 
                    zAlarm.AlarmAcknowledged += new zenOn.AlarmAcknowledgedEventHandler(zAlarm_AlarmAcknowledged);
                    zAlarm.AlarmComes += new zenOn.AlarmComesEventHandler(zAlarm_AlarmComes);
                    zAlarm.AlarmGoes += new zenOn.AlarmGoesEventHandler(zAlarm_AlarmGoes);
    
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Print("ERROR ThisProject_Startup:" + ex.Message + " " + ex.Source);
                }
            }
    
            private void ThisProject_Shutdown(object sender, EventArgs e)
            {
                try
                {
     
                    zAlarm.AlarmAcknowledged -= new zenOn.AlarmAcknowledgedEventHandler(zAlarm_AlarmAcknowledged);
                    zAlarm.AlarmComes -= new zenOn.AlarmComesEventHandler(zAlarm_AlarmComes);
                    zAlarm.AlarmGoes -= new zenOn.AlarmGoesEventHandler(zAlarm_AlarmGoes);
    
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Print("ERROR ThisProject_Startup:" + ex.Message + " " + ex.Source);
                }
            }
          
            /// 
            /// procedure is executed when an Alarm has gone
            /// 
            /// AlarmItem Alarm has gone
            void zAlarm_AlarmGoes(zenOn.IAlarmItem obItem)
            {
                System.Windows.Forms.MessageBox.Show("AlarmGoes from " + obItem.Name + " " + obItem.Text);
            }
    
            /// 
            /// procedure is executed when an Alarm comes
            /// 
            /// AlarmItem Alarm comes
            void zAlarm_AlarmComes(zenOn.IAlarmItem obItem)
            {
                System.Windows.Forms.MessageBox.Show("AlarmComes from " + obItem.Name);
       
            }
    
            /// 
            /// procedure is executed when an Alarm was acknowledged by a user
            /// 
            /// AlarmItem Alarm acknowledged
            void zAlarm_AlarmAcknowledged(zenOn.IAlarmItem obItem)
            {
               System.Windows.Forms.MessageBox.Show("AlarmAcknowledged from " + obItem.Name);
            }
    
    
    
            #region VSTA generated code
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisProject_Startup);
                this.Shutdown += new System.EventHandler(ThisProject_Shutdown);
            }
    	#endregion
    
    
        }
    }

  3. #3

    Default Re: Alarm events

    Thanks for this information. Now we would like to know how and if it is possible to enter data in the Comment field of the alarm.

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Alarm events

    Setting a comment to an alarm (via "Usertext") via the COM-Interface will be possible with the following version of zenon 6.50 (-> 6.51: scheduled release is about at the last quarter of this year).

    Regards,
    Herbert

Similar Threads

  1. Replies: 10
    Last Post: 16th October 2012, 23:13
  2. Alarm Status Line and Alarm List
    By tomaslipa in forum zenon Supervisor
    Replies: 1
    Last Post: 21st January 2009, 12:02
  3. VBA scripts by alarms events
    By captain in forum VBA
    Replies: 2
    Last Post: 14th August 2008, 09:30
  4. Circular Alarms/Events
    By consol in forum zenon Supervisor
    Replies: 1
    Last Post: 13th August 2008, 10:11

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •