Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Get Alarm text with name of alarm
PostPosted: Thu Aug 13, 2015 9:36 am 

Joined: Sun May 31, 2015 2:38 am
Posts: 14

Offline
Hello

Struggling with a problem on how to get the text of an alarm with the name of the alarm.

I got a screen to show info on alarm when pressing request alarm info which works perfectly, but I would like to have the "Text" of the alarm parsed to that screen aswell.

Using a Text Library to handle the alarm info, but would like to have the alarm text handled automaticly when adding new alarms.

Posted my code to show the screen.

Code:
      void AlarmViewer_AlarmEventInfoRequested(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.AlarmEventEventArgs e)
      {
         
         try
         {
            int aNumber = Int32.Parse( e.AlarmEvent.AlarmItemDisplayName.Replace("F", ""));
            
            Globals.Tags.AlarmToShow.Value = aNumber;
            Globals.scn_AlarmInfo.Show();
         }
         
         catch (Exception ex)
         {
            MessageBox.Show(ex.Message);
         }
      }


 Profile  
 
 Post subject: Re: Get Alarm text with name of alarm
PostPosted: Wed Sep 30, 2015 6:31 am 

Joined: Tue Sep 08, 2015 1:32 pm
Posts: 15

Offline
I've not tested this, but the following function might work:

private string getAlarmTextFromDisplayName(string alarmDisplayName)
{
foreach (IAlarmGroup ag in Globals.AlarmServer.AlarmGroups)
{
foreach (IAlarmItem ai in ag.AlarmItems)
{
if (ai.DisplayName.Equals(alarmDisplayName))
return ai.Text;
}
}

}


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron