コード例 #1
0
        private void SenderStatusUC_MouseMoveInGridEvent(object sender, MouseOperateInGridEventArgs e)
        {
            if (_customToolTip == null)
            {
                _customToolTip                = new CustomToolTip();
                _customToolTip.Owner          = this.ParentForm;
                _customToolTip.TipContentFont = _customToolTipFont;
            }
            if (e.SenderGridInfo == null)
            {
                _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, null);
                return;
            }
            List <string> noticeStrList = new List <string>();

            noticeStrList.Add(GetLangText("CommPortName", "串口") + ":" + e.SenderGridInfo.CommPort);
            noticeStrList.Add(GetLangText("SenderName", "发送卡") + ":" + (e.SenderGridInfo.SenderIndex + 1).ToString());
            if (e.SenderGridInfo.Status == WorkStatusType.OK)
            {
                noticeStrList.Add(GetLangText("DVISignalOK", "DVI信号:正常"));
                //DVI信号正常时显示发送卡的刷新率
                string refreshReteStr = GetLangText("RefreshRate", "刷新率:");
                if (!e.SenderGridInfo.RefreshRateInfo.IsValid)
                {
                    refreshReteStr += GetLangText("label_Unknown", "未知");
                }
                else
                {
                    refreshReteStr += e.SenderGridInfo.RefreshRateInfo.Value.ToString() + " HZ";
                }
                noticeStrList.Add(refreshReteStr);
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.Error)
            {
                noticeStrList.Add(GetLangText("DVISignalException", "DVI信号:异常"));
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.Unknown)
            {
                noticeStrList.Add(GetLangText("DVISignalUnkonwn", "DVI信号:未知"));
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.SenderCardError)
            {
                noticeStrList.Add(GetLangText("SenderCardUnkonwn", "发送卡:发送卡故障"));
            }
            string msg     = "";
            string portMsg = "";

            if (_tempRedundancyDict != null && _tempRedundancyDict.Count > 0 &&
                _tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
            {
                if (_tempRedundancyDict[e.SenderGridInfo.CommPort] != null &&
                    _tempRedundancyDict[e.SenderGridInfo.CommPort].Count > 0)
                {
                    foreach (int i in e.SenderGridInfo.RedundantStateTypeList.Keys)
                    {
                        RedundantStateType state = e.SenderGridInfo.RedundantStateTypeList[i];
                        if (state == RedundantStateType.OK)
                        {
                            portMsg = "";
                            msg     = GetLangText("PortNormal", "网口:正常");
                        }
                        else if (state == RedundantStateType.Error)
                        {
                            if (_tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
                            {
                                for (int j = 0; j < _tempRedundancyDict[e.SenderGridInfo.CommPort].Count; j++)
                                {
                                    SenderRedundancyInfo senderInfo = _tempRedundancyDict[e.SenderGridInfo.CommPort][j];
                                    if (senderInfo.SlaveSenderIndex == e.SenderGridInfo.SenderIndex && senderInfo.SlavePortIndex == i)
                                    {
                                        portMsg = "-" + GetLangText("MasterSenderPort", "主网口:发送卡") + (senderInfo.MasterSenderIndex + 1) + "-" + GetLangText("Port", "网口") + (senderInfo.MasterPortIndex + 1);
                                        msg     = GetLangText("PortRedundant", "网口:冗余");
                                        break;
                                    }
                                    else
                                    {
                                        msg = GetLangText("PortNormal", "网口:正常");
                                    }
                                }
                            }
                        }
                        else if (state == RedundantStateType.Unknown)
                        {
                            portMsg = "";
                            msg     = GetLangText("PortUnknown", "网口:未知");
                        }
                        msg = (i + 1) + msg + portMsg;
                        noticeStrList.Add(msg);
                    }
                }
            }
            _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, noticeStrList);
            if (!_customToolTip.TopLevel)
            {
                _customToolTip.TopLevel = true;
            }
        }
コード例 #2
0
 private void SenderStatusUC_MouseMoveInGridEvent(object sender, MouseOperateInGridEventArgs e)
 {
     if (_customToolTip == null)
     {
         _customToolTip = new CustomToolTip();
         _customToolTip.Owner = this.ParentForm;
         _customToolTip.TipContentFont = _customToolTipFont;
     }
     if (e.SenderGridInfo == null)
     {
         _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, null);
         return;
     }
     List<string> noticeStrList = new List<string>();
     noticeStrList.Add(GetLangText("CommPortName", "串口") + ":" + e.SenderGridInfo.CommPort);
     noticeStrList.Add(GetLangText("SenderName", "发送卡") + ":" + (e.SenderGridInfo.SenderIndex + 1).ToString());
     if (e.SenderGridInfo.Status == WorkStatusType.OK)
     {
         noticeStrList.Add(GetLangText("DVISignalOK", "DVI信号:正常"));
         //DVI信号正常时显示发送卡的刷新率
         string refreshReteStr = GetLangText("RefreshRate", "刷新率:");
         if (!e.SenderGridInfo.RefreshRateInfo.IsValid)
         {
             refreshReteStr += GetLangText("label_Unknown", "未知");
         }
         else
         {
             refreshReteStr += e.SenderGridInfo.RefreshRateInfo.Value.ToString() + " HZ";
         }
         noticeStrList.Add(refreshReteStr);
     }
     else if (e.SenderGridInfo.Status == WorkStatusType.Error)
     {
         noticeStrList.Add(GetLangText("DVISignalException", "DVI信号:异常"));
     }
     else if (e.SenderGridInfo.Status == WorkStatusType.Unknown)
     {
         noticeStrList.Add(GetLangText("DVISignalUnkonwn", "DVI信号:未知"));
     }
     else if (e.SenderGridInfo.Status == WorkStatusType.SenderCardError)
     {
         noticeStrList.Add(GetLangText("SenderCardUnkonwn", "发送卡:发送卡故障"));
     }
     string msg = "";
     string portMsg = "";
     if (_tempRedundancyDict != null && _tempRedundancyDict.Count > 0
         && _tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
     {
         if (_tempRedundancyDict[e.SenderGridInfo.CommPort] != null &&
             _tempRedundancyDict[e.SenderGridInfo.CommPort].Count > 0)
         {
             foreach (int i in e.SenderGridInfo.RedundantStateTypeList.Keys)
             {
                 RedundantStateType state = e.SenderGridInfo.RedundantStateTypeList[i];
                 if (state == RedundantStateType.OK)
                 {
                     portMsg = "";
                     msg = GetLangText("PortNormal", "网口:正常");
                 }
                 else if (state == RedundantStateType.Error)
                 {
                     if (_tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
                     {
                         for (int j = 0; j < _tempRedundancyDict[e.SenderGridInfo.CommPort].Count; j++)
                         {
                             SenderRedundancyInfo senderInfo = _tempRedundancyDict[e.SenderGridInfo.CommPort][j];
                             if (senderInfo.SlaveSenderIndex == e.SenderGridInfo.SenderIndex && senderInfo.SlavePortIndex == i)
                             {
                                 portMsg = "-" + GetLangText("MasterSenderPort", "主网口:发送卡") + (senderInfo.MasterSenderIndex + 1) + "-" + GetLangText("Port", "网口") + (senderInfo.MasterPortIndex + 1);
                                 msg = GetLangText("PortRedundant", "网口:冗余");
                                 break;
                             }
                             else
                             {
                                 msg = GetLangText("PortNormal", "网口:正常");
                             }
                         }
                     }
                 }
                 else if (state == RedundantStateType.Unknown)
                 {
                     portMsg = "";
                     msg = GetLangText("PortUnknown", "网口:未知");
                 }
                 msg = (i + 1) + msg + portMsg;
                 noticeStrList.Add(msg);
             }
         }
     }
     _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, noticeStrList);
     if (!_customToolTip.TopLevel)
     {
         _customToolTip.TopLevel = true;
     }
 }