Esempio n. 1
0
 /// <summary>
 ///     刷新控制实施值
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CtimeCotrolReal_Tick(object sender, EventArgs e)
 {
     try
     {
         if (null == CgleStaionAdress.EditValue)
         {
             return;
         }
         if (string.IsNullOrEmpty(CgleStaionAdress.EditValue.ToString()))
         {
             return;
         }
         var fzh = 0;
         if (CgleStaionAdress.EditValue.ToString().Length > 3)
         {
             fzh = Convert.ToInt32(CgleStaionAdress.EditValue.ToString().Substring(0, 3));
         }
         if (fzh <= 0)
         {
             return;
         }
         IList <Jc_DefInfo> Control = DEFServiceModel.QueryPointByInfs(fzh, 3);
         if (null == Control)
         {
             return;
         }
         for (var i = 0; i < Control.Count; i++)
         {
             if (windowsUIButtonPanel1 != null)
             {
                 if (windowsUIButtonPanel1.Buttons != null)
                 {
                     for (var j = 0; j < windowsUIButtonPanel1.Buttons.Count; j++)
                     {
                         if (windowsUIButtonPanel1.Buttons[j].Properties.Caption == Control[i].Point)
                         {
                             if (Control[i].DataState == 44)
                             {
                                 windowsUIButtonPanel1.Buttons[j].Properties.Checked = false; //断开
                             }
                             else
                             {
                                 windowsUIButtonPanel1.Buttons[j].Properties.Checked = true; //接通
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         CtimeCotrolReal.Enabled = false;//出现异常,则停止刷新界面,否则会造成界面卡死  20170701
         LogHelper.Error(ex);
     }
 }
Esempio n. 2
0
        /// <summary>
        ///     得到控制量
        /// </summary>
        /// <param name="fzh"></param>
        /// <returns></returns>
        private IBaseButton[] GetControlButtons(string Station, bool ifEnable = false)
        {
            // 20170629
            IBaseButton[] temp = null;
            if (string.IsNullOrEmpty(Station))
            {
                return(temp);
            }
            var fzh = 0;

            if (Station.Length > 3)
            {
                fzh = Convert.ToInt32(Station.Substring(0, 3));
            }
            if (fzh <= 0)
            {
                return(temp);
            }
            IList <Jc_DefInfo> Control = DEFServiceModel.QueryPointByInfs(fzh, 3);

            if (null == Control)
            {
                return(temp);
            }
            try
            {
                Control = Control.OrderBy(item => item.Kh).ToList();
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }

            temp = new IBaseButton[Control.Count];
            for (var i = 0; i < Control.Count; i++)
            {
                var tempButton = new WindowsUIButton();
                tempButton.Caption = Control[i].Point;
                tempButton.ToolTip = Control[i].Wz;
                tempButton.Tag     = Control[i].Bz14; //xuzp20160524
                tempButton.Style   = ButtonStyle.CheckButton;
                tempButton.Image   = Resources.apply_32x32;
                tempButton.Checked = true; //表示当前都没有控制
                if (ifEnable)
                {
                    tempButton.Enabled = false;
                }
                temp[i] = tempButton;
            }
            return(temp);
        }