예제 #1
0
        public void UpdateAlarmListView(cSiteIdObject SiteIdObject, cRoadSideObject RoadSideObject)
        {
            listView_Alarms.Items.Clear();
            listView_AlarmEvents.Items.Clear();

            if (SiteIdObject == null && RoadSideObject == null)
            {
                return;
            }

            listView_Alarms.BeginUpdate();
            listView_Alarms.StopSorting();

            listView_AlarmEvents.StopSorting();

            if (RoadSideObject != null)
            {
                listView_Alarms.ShowGroups = ToolStripMenuItem_View_AlwaysShowGroupHeaders.Checked;
                UpdateAlarmListView(RoadSideObject);
            }
            else
            {
                listView_Alarms.ShowGroups = true;
                foreach (cRoadSideObject roadSideObject in SiteIdObject.RoadSideObjects)
                {
                    UpdateAlarmListView(roadSideObject);
                }
            }

            listView_Alarms.ResumeSorting();
            listView_Alarms.EndUpdate();

            listView_AlarmEvents.ResumeSorting();
        }
예제 #2
0
        private void ToolStripMenuItem_ProcessImage_RandomUpdateAllStatusValues_Click(object sender, EventArgs e)
        {
            Random Rnd = new Random();

            List <RSMP_Messages.Status_VTQ> sS = new List <RSMP_Messages.Status_VTQ>();

            foreach (cRoadSideObject RoadSideObject in RSMPGS.ProcessImage.RoadSideObjects.Values)
            {
                foreach (cStatusObject StatusObject in RoadSideObject.StatusObjects)
                {
                    foreach (cStatusReturnValue StatusReturnValue in StatusObject.StatusReturnValues)
                    {
                        switch (StatusReturnValue.Value.GetValueType().ToLower())
                        {
                        case "boolean":
                            StatusReturnValue.Value.SetValue(Rnd.Next(0, 2) >= 1 ? "true" : "false");
                            break;

                        case "string":
                            StatusReturnValue.Value.SetValue(Rnd.Next(0, 1).ToString());
                            break;

                        case "real":
                            StatusReturnValue.Value.SetValue((Rnd.Next(-10000, 10000) / 10).ToString());
                            break;

                        default:
                            StatusReturnValue.Value.SetValue(Rnd.Next(-1000, 1000).ToString());
                            break;
                        }
                        //StatusReturnValue.sStatus = "?";
                    }
                }
                // Update ListView if this RoadSide object is selected
                if (treeView_SitesAndObjects.SelectedNode != null)
                {
                    if (treeView_SitesAndObjects.SelectedNode.Tag != null)
                    {
                        if (treeView_SitesAndObjects.SelectedNode.Parent == null)
                        {
                            cSiteIdObject SiteIdObject = (cSiteIdObject)treeView_SitesAndObjects.SelectedNode.Tag;
                            UpdateStatusListView(SiteIdObject, null);
                        }
                        else
                        {
                            if (RoadSideObject == (cRoadSideObject)treeView_SitesAndObjects.SelectedNode.Tag)
                            {
                                UpdateStatusListView(null, RoadSideObject);
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        private void ToolStripMenuItem_ProcessImage_Reset_Click(object sender, EventArgs e)
        {
            List <RSMP_Messages.Status_VTQ> sS = new List <RSMP_Messages.Status_VTQ>();

            //			if (System.Windows.Forms.MessageBox.Show("This will reset all status' to default (unknown/null).\r\nAre you sure?", "RSMPGS1", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            //			{

            RSMPGS.ProcessImage.BufferedMessages.Clear();
            ListView_BufferedMessages.Items.Clear();
            textBox_BufferedMessages.Text = RSMPGS.ProcessImage.BufferedMessages.Count.ToString();

            foreach (cRoadSideObject RoadSideObject in RSMPGS.ProcessImage.RoadSideObjects.Values)
            {
                foreach (cAlarmObject AlarmObject in RoadSideObject.AlarmObjects)
                {
                    AlarmObject.AlarmEvents.Clear();
                    AlarmObject.bAcknowledged = false;
                    AlarmObject.bActive       = false;
                    AlarmObject.bSuspended    = false;
                    AlarmObject.AlarmCount    = 0;
                }
                if (RoadSideObject.bIsComponentGroup)
                {
                    RoadSideObject.sFunctionalState    = "";
                    RoadSideObject.sFunctionalPosition = "";
                    for (int iIndex = 0; iIndex < RoadSideObject.bBitStatus.GetLength(0); iIndex++)
                    {
                        RoadSideObject.bBitStatus[iIndex] = false;
                    }
                }
                foreach (cStatusObject StatusObject in RoadSideObject.StatusObjects)
                {
                    foreach (cStatusReturnValue StatusReturnValue in StatusObject.StatusReturnValues)
                    {
                        StatusReturnValue.Value.SetInitialUnknownValue();
                    }
                }

                /*
                 *                      sS.Clear();
                 *                      // Delete subscription if it already exists
                 *                      foreach (cSubscription Subscription in RoadSideObject.Subscriptions)
                 *                      {
                 *                              if (Subscription.SubscribeStatus == cSubscription.Subscribe_OnChange)
                 *                              {
                 *                                      RSMP_Messages.Status_VTQ s = new RSMP_Messages.Status_VTQ();
                 *                                      s.sCI = Subscription.StatusObject.sStatusCodeId;
                 *                                      s.n = Subscription.StatusReturnValue.sName;
                 *                                      RSMPGS.ProcessImage.UpdateStatusValue(ref s, Subscription.StatusReturnValue.sStatus);
                 *                                      sS.Add(s);
                 *                              }
                 *                      }
                 *                      if (sS.Count > 0)
                 *                      {
                 *                              RSMPGS_Main.JSon.CreateAndSendStatusUpdateMessage(RoadSideObject, sS);
                 *                      }
                 */
                // Update ListView if this RoadSide object is selected
                if (treeView_SitesAndObjects.SelectedNode != null)
                {
                    if (treeView_SitesAndObjects.SelectedNode.Tag != null)
                    {
                        if (treeView_SitesAndObjects.SelectedNode.Parent != null)
                        {
                            if (RoadSideObject == (cRoadSideObject)treeView_SitesAndObjects.SelectedNode.Tag)
                            {
                                UpdateStatusListView(null, RoadSideObject);
                                UpdateAlarmListView(null, RoadSideObject);
                            }
                        }
                    }
                }
            }

            if (treeView_SitesAndObjects.SelectedNode != null)
            {
                if (treeView_SitesAndObjects.SelectedNode.Parent == null)
                {
                    cSiteIdObject SiteIdObject = (cSiteIdObject)treeView_SitesAndObjects.SelectedNode.Tag;
                    UpdateStatusListView(SiteIdObject, null);
                    UpdateAlarmListView(SiteIdObject, null);
                }
            }
        }
예제 #4
0
        private void ToolStripMenuItem_ProcessImage_RandomUpdates_Click(object sender, EventArgs e)
        {
            Random Rnd = new Random();

            List <RSMP_Messages.Status_VTQ> sS = new List <RSMP_Messages.Status_VTQ>();

            foreach (cRoadSideObject RoadSideObject in RSMPGS.ProcessImage.RoadSideObjects.Values)
            {
                sS.Clear();
                // Delete subscription if it already exists
                foreach (cSubscription Subscription in RoadSideObject.Subscriptions)
                {
                    switch (Subscription.StatusReturnValue.Value.GetValueType().ToLower())
                    {
                    case "boolean":
                        Subscription.StatusReturnValue.Value.SetValue(Rnd.Next(0, 2) >= 1 ? "true" : "false");
                        break;

                    case "string":
                        Subscription.StatusReturnValue.Value.SetValue(Rnd.Next(0, 1).ToString());
                        break;

                    case "real":
                        Subscription.StatusReturnValue.Value.SetValue((Rnd.Next(-10000, 10000) / 10).ToString());
                        break;

                    default:
                        Subscription.StatusReturnValue.Value.SetValue(Rnd.Next(-1000, 1000).ToString());
                        break;
                    }
                    if (Subscription.SubscribeStatus == cSubscription.SubscribeMethod.OnChange || Subscription.SubscribeStatus == cSubscription.SubscribeMethod.IntervalAndOnChange)
                    {
                        RSMP_Messages.Status_VTQ s = new RSMP_Messages.Status_VTQ();
                        s.sCI = Subscription.StatusObject.sStatusCodeId;
                        s.n   = Subscription.StatusReturnValue.sName;
                        RSMPGS.ProcessImage.UpdateStatusValue(ref s, Subscription.StatusReturnValue.Value.GetValueType(), Subscription.StatusReturnValue.Value.GetValue());
                        sS.Add(s);
                    }
                }
                if (sS.Count > 0)
                {
                    RSMPGS.JSon.CreateAndSendStatusUpdateMessage(RoadSideObject, sS);
                }
                // Update ListView if this RoadSide object is selected
                if (treeView_SitesAndObjects.SelectedNode != null)
                {
                    if (treeView_SitesAndObjects.SelectedNode.Tag != null)
                    {
                        if (treeView_SitesAndObjects.SelectedNode.Parent == null)
                        {
                            cSiteIdObject SiteIdObject = (cSiteIdObject)treeView_SitesAndObjects.SelectedNode.Tag;
                            UpdateStatusListView(SiteIdObject, null);
                        }
                        else
                        {
                            if (RoadSideObject == (cRoadSideObject)treeView_SitesAndObjects.SelectedNode.Tag)
                            {
                                UpdateStatusListView(null, RoadSideObject);
                            }
                        }
                    }
                }
            }
        }