Ejemplo n.º 1
0
 private void sinkLoopChanged(cdeP pProp)
 {
     int tTime = TheCommonUtils.CInt(TheThing.GetSafePropertyNumber(this, "MsToTrigger"));
     //if (tTime > 0)
     {
         int tPeriod = TheCommonUtils.CInt(TheThing.GetSafePropertyNumber(this, "LoopPeriod"));
         if (tPeriod == 0)
         {
             tPeriod = -1;
         }
         if (tPeriod > 0 && tPeriod < 10)
         {
             tPeriod = 10;
         }
         MyBaseThing.Value = "0";
         if (mTimer != null)
         {
             mTimer.Change(tTime, tPeriod);
         }
         else
         {
             mTimer = new Timer(sinkTriggerTimeout, null, tTime, tPeriod);
         }
         IsActive = true;
         MyBaseThing.StatusLevel = 1;
         MyBaseThing.LastMessage = $"Timer started at {DateTimeOffset.Now}";
         SummaryForm?.SetUXProperty(Guid.Empty, string.Format("Background=green"));
     }
 }
Ejemplo n.º 2
0
 private void StopTimer()
 {
     if (mTimer != null)
     {
         mTimer.Dispose();
     }
     mTimer   = null;
     IsActive = false;
     MyBaseThing.StatusLevel = 0;
     MyBaseThing.LastMessage = $"Timer stopped at {DateTimeOffset.Now}";
     SummaryForm?.SetUXProperty(Guid.Empty, string.Format("Background=gray"));
     return;
 }
Ejemplo n.º 3
0
 private void EngageMapper()
 {
     TheThingRegistry.UnmapPropertyMapper(mRealThingGuid);
     mRealThingGuid = TheThingRegistry.PropertyMapper(TheThing.GetSafePropertyGuid(MyBaseThing, "RealSensorThing"), TheThing.GetSafePropertyString(MyBaseThing, "RealSensorProperty"), MyBaseThing.cdeMID, "RawValue", false);
     if (mRealThingGuid == Guid.Empty)
     {
         MyBaseThing.StatusLevel = 0;
         MyBaseThing.LastMessage = "Mapper not active";
         IsActive = false;
     }
     else
     {
         MyBaseThing.LastMessage = "Mapper engaged";
         MyBaseThing.StatusLevel = 1;
         TheDefaultSensor.CopyStateSensorInfo(MyBaseThing);
         SummaryForm?.SetUXProperty(Guid.Empty, string.Format("Background={0}", TheNMIEngine.GetStatusColor(MyBaseThing.StatusLevel)));
         IsActive = true;
     }
 }
Ejemplo n.º 4
0
        private void SinkStatChanged(TheDashPanelInfo tDas, cdeP prop)
        {
            var i = (prop != null)
                ? TheCommonUtils.CInt(prop.ToString())
                : TheCommonUtils.CInt(MyBaseThing.Value);

            var tCol   = i < 3 ? "orange" : "green";
            var tLevel = i < 3 ? 2 : 1;

            if (i == 0)
            {
                tCol   = "gray";
                tLevel = 0;
            }

            SummaryForm.SetUXProperty(Guid.Empty, $"Background={tCol}");

            if (MyBaseThing.StatusLevel != tLevel)
            {
                MyBaseThing.StatusLevel = tLevel;
            }
        }
Ejemplo n.º 5
0
        void sinkStatChanged(TheDashPanelInfo tDas, cdeP prop)
        {
            int    tLevel = 1;
            string tCol   = "green";
            int    i      = TheCommonUtils.CInt(MyBaseThing.Value);

            if (prop != null)
            {
                i = TheCommonUtils.CInt(prop.ToString());
            }
            if (i < 3)
            {
                tCol = "orange"; tLevel = 2;
            }
            if (i == 0)
            {
                tCol = "gray"; tLevel = 0;
            }
            SummaryForm.SetUXProperty(Guid.Empty, string.Format("Background={0}", tCol));
            if (MyBaseThing.StatusLevel != tLevel)
            {
                MyBaseThing.StatusLevel = tLevel;
            }
        }