Exemple #1
0
 public static PressureManager Instance()
 {
     if (m_Manager == null)
     {
         m_Manager = new PressureManager();
     }
     return(m_Manager);
 }
Exemple #2
0
        public void ReadGrasebyPumpPressureSettings(ProductID pid, Misc.OcclusionLevel level)
        {
            string section = string.Empty;

            #region section
            switch (pid)
            {
            case ProductID.GrasebyC8:
                section = "GrasebyC8";
                break;

            case ProductID.GrasebyF8:
                section = "GrasebyF8";
                break;

            case ProductID.GrasebyC6:
                section = "GrasebyC6";
                break;

            case ProductID.Graseby2000:
                section = "Graseby2000";
                break;

            case ProductID.Graseby2100:
                section = "Graseby2100";
                break;

            case ProductID.GrasebyC6T:
                section = "GrasebyC6T";
                break;

            case ProductID.GrasebyF6:
                section = "GrasebyF6";
                break;

            default:
                section = "GrasebyC6";
                break;
            }
            #endregion

            string   val       = GetString(section, level.ToString()).Trim();
            string[] pressures = val.Split('~');
            if (pressures.Length != 2)
            {
                return;
            }
            float pMin = 0, pMax = 0;
            if (float.TryParse(pressures[0].Trim(), out pMin) && float.TryParse(pressures[1].Trim(), out pMax))
            {
                PressureManager.Instance().Add(pid, level, pMin, pMax);
            }
        }
Exemple #3
0
        public void IsPass(float n, float l, float c, float h)
        {
            ProductID      pid = ProductIDConvertor.PumpID2ProductID(m_LocalPid);
            PressureConfig cfg = PressureManager.Instance().Get(pid);

            if (cfg == null)
            {
                lbNValue.ForeColor = Color.Red;
                lbLValue.ForeColor = Color.Red;
                lbCValue.ForeColor = Color.Red;
                lbHValue.ForeColor = Color.Red;
                return;
            }

            var parameter = cfg.Find(Misc.OcclusionLevel.N);

            if (parameter != null && n > 0)
            {
                if (n >= parameter.Item2 && n <= parameter.Item3)
                {
                    lbNValue.ForeColor = Color.White;
                }
                else
                {
                    lbNValue.ForeColor = Color.Red;
                }
            }

            parameter = cfg.Find(Misc.OcclusionLevel.L);
            if (parameter != null && l > 0)
            {
                if (l >= parameter.Item2 && l <= parameter.Item3)
                {
                    lbLValue.ForeColor = Color.White;
                }
                else
                {
                    lbLValue.ForeColor = Color.Red;
                }
            }

            parameter = cfg.Find(Misc.OcclusionLevel.C);
            if (parameter != null && c > 0)
            {
                if (c >= parameter.Item2 && c <= parameter.Item3)
                {
                    lbCValue.ForeColor = Color.White;
                }
                else
                {
                    lbCValue.ForeColor = Color.Red;
                }
            }

            parameter = cfg.Find(Misc.OcclusionLevel.H);
            if (parameter != null && h > 0)
            {
                if (h >= parameter.Item2 && h <= parameter.Item3)
                {
                    lbHValue.ForeColor = Color.White;
                }
                else
                {
                    lbHValue.ForeColor = Color.Red;
                }
            }
        }