コード例 #1
0
        /// <summary>
        /// 设备变更事件的响应
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void OnEquipmentChangeEvent(object sender, EventArgs e)
        {
            ChangeDeviceList(_proxy.EquipmentTable);

            if (_ctrlSystemCount == 0 && _otherDeviceCount == 0)
            {
                ChangeSoftwareMode(true);
                _tempCommPortLedDisplayDict = new Dictionary<string, List<ILEDDisplayInfo>>();
                AllCommPortLedDisplayDic = _tempCommPortLedDisplayDict;

                _tempRedundancyDict = new Dictionary<string, List<SenderRedundancyInfo>>();
                SenderReduInfoDic = _tempRedundancyDict;

                return;
            }
            else
            {
                string msg = "";
                CommonStaticMethod.GetLanguageString("正在获取硬件数据...", "Lang_StartUp_GetHWData", out msg);
                LoadingMessage = msg;
                CustomTransform.Delay(200, 10);

                ChangeSoftwareMode(false);

                #region 从软件空间读取屏体信息
                SoftWareSpaceAccessor accessor = new SoftWareSpaceAccessor(_proxy);
                List<string> readList = new List<string>();
                lock (_proxy.EquimentObject)
                {
                    string[] readArray = new string[_proxy.EquipmentTable.Keys.Count];
                    bool isFirst = true;
                    foreach (string key in _proxy.EquipmentTable.Keys)
                    {
                        EquipmentInfo info = _proxy.EquipmentTable[key];
                        if (CustomTransform.IsSystemController(info.ModuleID))
                        {
                            readList.Add(key);
                        }
                        if (isFirst)
                        {
                            _globalParams.SelectPort = key;
                            isFirst = false;
                        }
                    }
                }
                accessor.ReadPortSoftwareSpaceInfo(readList, OnCompletedReadPortsSoftwareSpaceInfo);

                AllCOMHWBaseInfoAccessor accessor1 = new AllCOMHWBaseInfoAccessor(_proxy);
                accessor1.ReadAllComHWBaseInfo(OnCompleteReadAllComHWBaseInfoCallback, null);
                #endregion
            }

        }
コード例 #2
0
        public HWSoftwareSpaceRes LoadAllComBaseInfoFromHW()
        {
            AllCOMHWBaseInfoAccessor accessor = new AllCOMHWBaseInfoAccessor(_serverProxy); ;
            HWSoftwareSpaceRes res = accessor.ReadAllComHWBaseInfo(ReadAllComBaseInfoCompleted, null);
            if (res == HWSoftwareSpaceRes.OK)
            {

            }
            return res;
        }
コード例 #3
0
        private HWSoftwareSpaceRes LoadAllComBaseInfoFromHW()
        {
            _reReadScreenTimer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

            if (_serverProxy != null && !_serverProxy.IsRegisted)
            {
                RegisterToServer();
            }

            if (_serverProxy == null || _serverProxy.EquipmentTable == null || _serverProxy.EquipmentTable.Count == 0)
            {
                _fLogService.Error("服务的相关信息为空,导致无法读取软件空间");
                if (_allComBaseInfo_Bak != null && _allComBaseInfo_Bak.AllInfoDict != null)
                {
                    _allComBaseInfo_Bak.AllInfoDict.Clear();
                }
                OnNotifyScreenCfgChangedEvent(this, EventArgs.Empty);
                _reReadScreenTimer.Change(10000, 10000);
                return HWSoftwareSpaceRes.NoServerObject;
            }

            lock (_readHWObjLock)
            {
                _readHWCount++;
            }
            AllCOMHWBaseInfoAccessor accessor = new AllCOMHWBaseInfoAccessor(_serverProxy);
            CompleteReadAllComHWBaseInfoCallback callBack = new CompleteReadAllComHWBaseInfoCallback(ReadAllComBaseInfoCompleted);
            HWSoftwareSpaceRes res = accessor.ReadAllComHWBaseInfo(callBack, null);

            if (res != HWSoftwareSpaceRes.OK)
            {
                lock (_readHWObjLock)
                {
                    _readHWCount--;
                }
                if (_allComBaseInfo_Bak != null && _allComBaseInfo_Bak.AllInfoDict != null)
                {
                    _allComBaseInfo_Bak.AllInfoDict.Clear();
                }
                OnNotifyScreenCfgChangedEvent(this, EventArgs.Empty);
                _reReadScreenTimer.Change(10000, 10000);
                _fLogService.Debug("读取软件空间失败,因此无屏信息:" + res.ToString());
            }
            return res;
        }
コード例 #4
0
        public void ReadCOMHWBaseInfoAsync(Action<CompleteReadAllComHWBaseInfoParams, object> callbackAction)
        {
            if (_accessor == null)
            {
                _accessor = new AllCOMHWBaseInfoAccessor(_serverProxy);
            }

            HWSoftwareSpaceRes res = _accessor.ReadAllComHWBaseInfo((c, o) => { callbackAction(c, o); }, null);
        }