Exemplo n.º 1
0
        void _w_DoWork(object sender, DoWorkEventArgs e)
        {
            SystemStateItem _el = e.Argument as SystemStateItem;

            object[] _plist = new object[3] {
                "OK", "GetCurrentState", null
            };
            try
            {
                object _ret     = ExecuteWCF.ExecuteMethod <SysWatchService.ISWCommandService>(_el.SystemURL, "DoCommand", _plist);
                byte[] _byteret = _ret as byte[];
                string _msg     = Encoding.Unicode.GetString(_byteret);
                _el.Connected       = true;
                _el.ConnectErrorMsg = "";
                _el.NodeState       = new WatchNodeState(_msg);
                e.Result            = _el;
            }
            catch (Exception ex)
            {
                _el.Connected       = false;
                _el.ConnectErrorMsg = ex.Message;
                _el.NodeState       = new WatchNodeState("00000");
                e.Result            = _el;
            }
        }
Exemplo n.º 2
0
        private string SendCommandToNode(string DesServer, string CommandName, byte[] ParamData)
        {
            SystemStateItem _el = WatchSystemLib.GetSystem(DesServer);

            if (_el.Connected)
            {
                object[] _plist = new object[3] {
                    "OK", CommandName, ParamData
                };
                try
                {
                    object _ret     = ExecuteWCF.ExecuteMethod <SysWatchService.ISWCommandService>(_el.SystemURL, "DoCommand", _plist);
                    byte[] _byteret = _ret as byte[];
                    string _msg     = Encoding.Unicode.GetString(_byteret);
                    return(_msg);
                }
                catch (Exception ex)
                {
                    string _error = string.Format("从{0}中取当前状态出错!{1}", DesServer, ex.Message);
                    throw new Exception(_error);
                }
            }
            else
            {
                string _error = string.Format("服务器[{0}]暂时尚未连接!", DesServer);
                throw new Exception(_error);
            }
        }
Exemplo n.º 3
0
        private string DoGetNodeCheckMsg(string DesServer, byte[] ParameterData)
        {
            SystemStateItem _el = WatchSystemLib.GetSystem(DesServer);

            object[] _plist = new object[3] {
                "OK", "GetNodeCheckMsg", null
            };
            try
            {
                object _ret     = ExecuteWCF.ExecuteMethod <SysWatchService.ISWCommandService>(_el.SystemURL, "DoCommand", _plist);
                byte[] _byteret = _ret as byte[];
                string _msg     = Encoding.Unicode.GetString(_byteret);
                return(_msg);
            }
            catch (Exception ex)
            {
                string _error = string.Format("从{0}中取当前状态出错!{1}", DesServer, ex.Message);
                throw new Exception(_error);
            }
        }