Пример #1
0
 public void SetChannel(ChannelElement c)
 {
     Channel = c;
     this.ulbChannelName.Text   = string.IsNullOrEmpty(c.Text) ? c.Name : c.Text;
     Channel.ShowOrHideChanged += Channel_ShowOrHideChanged;
     for (int i = 0; i < this.Controls.Count; i++)
     {
         if (this.Controls[i].GetType() == typeof(Sunny.UI.UILabel))
         {
             UILabel label = (UILabel)this.Controls[i];
             label.SetStyle(GasMonitorManager.MainForm.Style);
             label.ForeColor = Color.White;
         }
         else if (this.Controls[i].GetType() == typeof(Sunny.UI.UILine))
         {
             UILine line = (UILine)this.Controls[i];
             line.SetStyle(GasMonitorManager.MainForm.Style);
             line.ForeColor = Color.Red;
         }
         else if (this.Controls[i].GetType() == typeof(Sunny.UI.UISymbolLabel))
         {
             UISymbolLabel line = (UISymbolLabel)this.Controls[i];
             line.SetStyle(GasMonitorManager.MainForm.Style);
             line.ForeColor   = Color.White;
             line.SymbolColor = Color.Green;
         }
     }
     //设置曲线
 }
Пример #2
0
        public void SetChannel(ChannelElement c, ChannelAlarm channelAlarm)
        {
            ChannelAlarm = channelAlarm;
            Channel      = c;
            Channel.ShowOrHideChanged += Channel_ShowOrHideChanged;
            this.ulbChannelName.Text   = string.IsNullOrEmpty(c.Text) ? c.Name : c.Text;
            for (int i = 0; i < this.Controls.Count; i++)
            {
                if (this.Controls[i].GetType() == typeof(Sunny.UI.UILabel))
                {
                    UILabel label = (UILabel)this.Controls[i];
                    label.SetStyle(GasMonitorManager.MainForm.Style);
                    label.ForeColor = Color.White;
                }
                else if (this.Controls[i].GetType() == typeof(Sunny.UI.UILine))
                {
                    UILine line = (UILine)this.Controls[i];
                    line.SetStyle(GasMonitorManager.MainForm.Style);
                    line.ForeColor = Color.Red;
                }
                else if (this.Controls[i].GetType() == typeof(Sunny.UI.UISymbolLabel))
                {
                    UISymbolLabel line = (UISymbolLabel)this.Controls[i];
                    line.SetStyle(GasMonitorManager.MainForm.Style);
                    line.ForeColor   = Color.White;
                    line.SymbolColor = Color.Green;
                }
            }
            //配置报价参数
            if (channelAlarm != null)
            {
                ParaAlarm O2Alarm  = channelAlarm.ParaAlarms.Find(x => x.Name == "O2");
                ParaAlarm COAlarm  = channelAlarm.ParaAlarms.Find(x => x.Name == "CO");
                ParaAlarm CO2Alarm = channelAlarm.ParaAlarms.Find(x => x.Name == "CO2");
                ParaAlarm H2SAlarm = channelAlarm.ParaAlarms.Find(x => x.Name == "H2S");
                this.ucbO2Enable.Checked  = O2Alarm != null && O2Alarm.Enable == "1" ? true : false;
                this.ucbCO2Enable.Checked = CO2Alarm != null && CO2Alarm.Enable == "1" ? true : false;
                this.ucbCOEnable.Checked  = COAlarm != null && COAlarm.Enable == "1" ? true : false;
                this.ucbH2SEnable.Checked = H2SAlarm != null && H2SAlarm.Enable == "1" ? true : false;
                decimal Low  = 0;
                decimal High = 0;
                uudCOLow.Value  = decimal.TryParse(COAlarm.Low, out Low) ? Low : 0;
                uudCOHigh.Value = decimal.TryParse(COAlarm.High, out High) ? High : 0;

                uudCO2Low.Value  = decimal.TryParse(CO2Alarm.Low, out Low) ? Low : 0;
                uudCO2High.Value = decimal.TryParse(CO2Alarm.High, out High) ? High : 0;

                uudH2SLow.Value  = decimal.TryParse(H2SAlarm.Low, out Low) ? Low : 0;
                uudH2SHigh.Value = decimal.TryParse(H2SAlarm.High, out High) ? High : 0;

                uudO2Low.Value  = decimal.TryParse(O2Alarm.Low, out Low) ? Low : 0;
                uudO2High.Value = decimal.TryParse(O2Alarm.High, out High) ? High : 0;
            }
        }