Ejemplo n.º 1
0
 public void CloneFromAlarmObject(cAlarmObject AlarmObjectToCopy)
 {
     RoadSideObject          = AlarmObjectToCopy.RoadSideObject;
     bActive                 = AlarmObjectToCopy.bActive;
     bSuspended              = AlarmObjectToCopy.bSuspended;
     bAcknowledged           = AlarmObjectToCopy.bAcknowledged;
     sObjectType             = AlarmObjectToCopy.sObjectType;
     sSpecificObject         = AlarmObjectToCopy.sSpecificObject;
     sAlarmCodeId            = AlarmObjectToCopy.sAlarmCodeId;
     sDescription            = AlarmObjectToCopy.sDescription;
     sExternalAlarmCodeId    = AlarmObjectToCopy.sExternalAlarmCodeId;
     sExternalNTSAlarmCodeId = AlarmObjectToCopy.sExternalNTSAlarmCodeId;
     sPriority               = AlarmObjectToCopy.sPriority;
     sCategory               = AlarmObjectToCopy.sCategory;
     AlarmReturnValues.Clear();
     foreach (cAlarmReturnValue AlarmReturnValue in AlarmObjectToCopy.AlarmReturnValues)
     {
         cAlarmReturnValue NewAlarmReturnValue = new cAlarmReturnValue();
         NewAlarmReturnValue.sName    = AlarmReturnValue.sName;
         NewAlarmReturnValue.sComment = AlarmReturnValue.sComment;
         NewAlarmReturnValue.Value    = new cValue(AlarmReturnValue.Value.ValueTypeObject, true);
         AlarmReturnValues.Add(NewAlarmReturnValue);
     }
     // We don't copy alarm events
 }
Ejemplo n.º 2
0
        private void listView_Alarms_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListView     listview = (ListView)sender;
            ListViewItem lvItem;

            int iSelectedColumn = 0;

            if (listview.SelectedItems.Count == 0)
            {
                return;
            }

            lvItem = listview.SelectedItems[0];

            ListViewHitTestInfo lvHitTest = listview.HitTest(LastMouseX, LastMouseY);

            foreach (ListViewItem.ListViewSubItem ScanSubItem in lvItem.SubItems)
            {
                if (lvHitTest.SubItem == ScanSubItem)
                {
                    break;
                }
                iSelectedColumn++;
            }

            try
            {
                // Tag is ex Value_2
                if (listview.Columns[iSelectedColumn].Tag.ToString().StartsWith("Value", StringComparison.OrdinalIgnoreCase))
                {
                    int               iIndex           = Int32.Parse(listview.Columns[iSelectedColumn].Tag.ToString().Substring(6));
                    cAlarmObject      AlarmObject      = (cAlarmObject)lvItem.Tag;
                    cAlarmReturnValue AlarmReturnValue = AlarmObject.AlarmReturnValues[iIndex];
                    string            sText            = lvHitTest.SubItem.Text;
                    // if (cFormsHelper.InputBox("Enter new value", "Value", ref sText, sType.Equals("base64", StringComparison.OrdinalIgnoreCase), true) == DialogResult.OK)
                    if (cFormsHelper.InputStatusBoxValueType("Enter new value", ref sText, AlarmReturnValue.Value, AlarmReturnValue.sComment, true) == DialogResult.OK)
                    {
                        AlarmReturnValue.Value.SetValue(sText);
                        lvHitTest.SubItem.Text = sText;
                    }
                }
            }
            catch
            {
            }
        }