Ejemplo n.º 1
0
        //public override void RegisterAddress(IPCManager ipcManager)
        //{
        //    base.RegisterAddress(ipcManager);

        //    ipcManager.RegisterAddress(Settings.Address2, AppSettings.groupStringRead);
        //    LastAddress2 = Settings.Address2;
        //}

        //public override void UpdateAddress(IPCManager ipcManager)
        //{
        //    base.UpdateAddress(ipcManager);

        //    LastAddress2 = UpdateAddress(ipcManager, LastAddress2, Settings.Address2);
        //}

        //public override void DeregisterAddress(IPCManager ipcManager)
        //{
        //    base.DeregisterAddress(ipcManager);

        //    ipcManager.DeregisterValue(Settings.Address2);
        //    if (Settings.Address2 != LastAddress2)
        //        Log.Logger.Error($"DeregisterValue: LastAddress and Address different for {ActionID} [ {Settings.Address2} != {LastAddress2} ] ");
        //}

        //public override void RefreshValue(IPCManager ipcManager)
        //{
        //    int results = 0;

        //    if (RefreshValue(ipcManager, Address, out string currentValue))
        //        results++;
        //    CurrentValue = currentValue;

        //    if (RefreshValue(ipcManager, Settings.Address2, out currentValue))
        //        results++;
        //    CurrentValue2 = currentValue;

        //    if (results > 0)
        //        IsChanged = true;
        //}

        protected override void DrawBar(string value, ImageRenderer render)
        {
            if (GaugeSettings.BarOrientation == (int)GaugeOrientation.LEFT)
            {
                GaugeSettings.IndicatorFlip = false;
            }
            else
            {
                GaugeSettings.IndicatorFlip = true;
            }

            base.DrawBar(value, render);

            value = ValueManager[ID.Second];
            if (GaugeSettings.DecodeBCD)
            {
                value = ModelDisplay.ConvertFromBCD(value);
            }
            value = GaugeSettings.ScaleValue(value);

            float min = ModelDisplayText.GetNumValue(GaugeSettings.MinimumValue, 0);
            float max = ModelDisplayText.GetNumValue(GaugeSettings.MaximumValue, 100);

            render.DrawBarIndicator(GaugeSettings.GetBar(), ColorTranslator.FromHtml(GaugeSettings.IndicatorColor), ModelDisplayText.GetNumValue(GaugeSettings.IndicatorSize, 10), ModelDisplayText.GetNumValue(value, 0), min, max, !GaugeSettings.IndicatorFlip);
        }
Ejemplo n.º 2
0
        protected virtual void DrawBar(string value, ImageRenderer render)
        {
            Bar   drawBar = GaugeSettings.GetBar();
            float min     = ModelDisplayText.GetNumValue(GaugeSettings.MinimumValue, 0);
            float max     = ModelDisplayText.GetNumValue(GaugeSettings.MaximumValue, 100);

            render.Rotate(GaugeSettings.BarOrientation, new PointF(0, 0));
            render.DrawBar(ColorTranslator.FromHtml(GaugeSettings.GaugeColor), drawBar);

            if (GaugeSettings.DrawWarnRange)
            {
                render.DrawBarRanges(drawBar, GaugeSettings.GetColorRange(), GaugeSettings.GetWarnRange(), min, max, GaugeSettings.SymmRange);
            }

            if (GaugeSettings.CenterLine)
            {
                render.DrawBarCenterLine(drawBar, ColorTranslator.FromHtml(GaugeSettings.CenterLineColor), ModelDisplayText.GetNumValue(GaugeSettings.CenterLineThickness, 2));
            }

            render.DrawBarIndicator(drawBar, ColorTranslator.FromHtml(GaugeSettings.IndicatorColor), ModelDisplayText.GetNumValue(GaugeSettings.IndicatorSize, 10), ModelDisplayText.GetNumValue(value, 0), min, max, GaugeSettings.IndicatorFlip);
        }