public void UpdateAlarmListView(ListViewItem lvItem)
        {
            cAlarmObject AlarmObject = (cAlarmObject)lvItem.Tag;

            // alarmCodeId;description;externalAlarmCodeId;externalNtSAlarmCodeId;priority;category;name;type;value;Kommentar
            lvItem.Text = AlarmObject.StatusAsText();
            int iSubItemIndex = 1;

            //lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.AlarmEvents.Count() > 0 ? AlarmObject.AlarmEvents.Count().ToString() : "";
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.AlarmCount > 0 ? AlarmObject.AlarmCount.ToString() : "";
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sAlarmCodeId;
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sDescription;
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sExternalAlarmCodeId;
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sExternalNTSAlarmCodeId;
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sPriority;
            lvItem.SubItems[iSubItemIndex++].Text = AlarmObject.sCategory;

            foreach (cAlarmReturnValue AlarmReturnValue in AlarmObject.AlarmReturnValues)
            {
                lvItem.SubItems[iSubItemIndex++].Text = AlarmReturnValue.sName;
                lvItem.SubItems[iSubItemIndex++].Text = AlarmReturnValue.Value.GetValueType();
                lvItem.SubItems[iSubItemIndex++].Text = AlarmReturnValue.Value.GetValue();
                lvItem.SubItems[iSubItemIndex++].Text = AlarmReturnValue.sComment.Replace("\n", " / ");
            }
        }
Exemple #2
0
        private void ToolStripMenuItem_SendAlarmEvent_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuitem    = (ToolStripMenuItem)sender;
            ListViewItem      lvItem      = listView_Alarms.SelectedItems[0];
            cAlarmObject      AlarmObject = (cAlarmObject)lvItem.Tag;

            switch (menuitem.Tag.ToString())
            {
            case "AcknowledgeAndSend":
                RSMPGS.JSon.CreateAndSendAlarmMessage(AlarmObject, cJSon.AlarmSpecialisation.Acknowledge);
                break;

            case "SuspendAndSend":
                RSMPGS.JSon.CreateAndSendAlarmMessage(AlarmObject, AlarmObject.bSuspended ? cJSon.AlarmSpecialisation.Resume : cJSon.AlarmSpecialisation.Suspend);
                break;

            case "RequestAndSend":
                RSMPGS.JSon.CreateAndSendAlarmMessage(AlarmObject, cJSon.AlarmSpecialisation.Request);
                break;
            }
            lvItem.SubItems[0].Text = AlarmObject.StatusAsText();
        }