Ejemplo n.º 1
0
        public PCDResponse Disconnect()
        {
            Connected       = false;
            _pcdmisCallback = null;
            PCDResponse response = new PCDResponse()
            {
                Success = true, Message = ""
            };

            return(response);
        }
Ejemplo n.º 2
0
        public PCDResponse Connect()
        {
            _pcdmisCallback = OperationContext.Current.GetCallbackChannel <IPCDmisCallback>();

            PCDResponse response = new PCDResponse()
            {
                Success = true, Message = ""
            };

            if (_pcdmisCallback == null)
            {
                response.Success = false;
                response.Message = "回连失败";
                ServerLog.Logs.AddLog("回连失败");
            }
            Connected     = response.Success;
            StatusMessage = Connected ? "控制器已连接" : "控制器连接过程中发生错误";
            ServerLog.Logs.AddLog(StatusMessage);
            OperationContext.Current.Channel.Closed  += Channel_Closed;
            OperationContext.Current.Channel.Opened  += Channel_Opened;
            OperationContext.Current.Channel.Faulted += Channel_Faulted;
            _channelCache = OperationContext.Current.Channel;
            return(response);
        }