예제 #1
0
        public void PingRemoteServer()
        {
            ACA.LabelX.Client.RemClientControlObject remClientControlObject = GetRemoteObject();
            string name = "";

            remClientControlObject.GetName(out name);
            remClientControlObject.Ping(name);
        }
        public RemClientControlObjectProxy()
        {
            isConnected = false;
            ServerUrl   = string.Empty;

            nPortNumber = -1;
            sProtocol   = string.Empty;
            sComputer   = string.Empty;
            channel     = null;
            remoteObj   = null;
        }
예제 #3
0
        private ACA.LabelX.Client.RemClientControlObject GetRemoteObject()
        {
            EnsureStartIsCalled();

            ACA.LabelX.Client.RemClientControlObject obj = (ACA.LabelX.Client.RemClientControlObject)Activator.GetObject(typeof(ACA.LabelX.Client.RemClientControlObject), ServerURL);
            if (obj == null)
            {
                throw new RemotingException("Cannot get the remote object.");
            }

            return(obj);
        }
예제 #4
0
        public void Start(string CfgFilePath)
        {
            GlobalDataStore.Logger.Debug("AcaLabelXClientRemoteEngine.Start");

            ConfigFilePath = CfgFilePath;
            RemotingConfiguration.Configure(ConfigFilePath, false);
            string Protocol;
            string Address;
            string Port;
            string Uri;

            Toolbox.Toolbox toolbox = new Toolbox.Toolbox();
            toolbox.GetRemotingClientRemoteConfiguration(ConfigFilePath, out Protocol, out Address, out Port, out Uri);

            switch (Protocol.ToLower())
            {
            case "http":
                ChannelServices.RegisterChannel(new HttpClientChannel(), false);
                break;

            case "tcp":
                ChannelServices.RegisterChannel(new TcpClientChannel(), false);
                break;

            default:
                throw new ApplicationException(string.Format("Could not obtain the correct protocol from: {0}\r\nFound protocol: {1}\r\nShould be: http, or tcp", ConfigFilePath, Protocol));
            }
            //Address = "localhost";
            Address = "127.0.0.1";
            string ClientURL = string.Format("{0}://{1}:{2}/{3}", Protocol, Address, Port, Uri);

            ACA.LabelX.Client.RemClientControlObject objLabelXRemObject = (ACA.LabelX.Client.RemClientControlObject)Activator.GetObject(
                typeof(ACA.LabelX.Client.RemClientControlObject), ClientURL);

            if (objLabelXRemObject != null)
            {
                objLabelXRemObject.InitServer();
            }
        }
        private void Connect()
        {
            ACA.LabelX.Client.RemClientControlObject theObj;

            Start();

            theObj = (ACA.LabelX.Client.RemClientControlObject)Activator.GetObject(typeof(ACA.LabelX.Client.RemClientControlObject), ServerUrl);
            if (theObj == null)
            {
                RemClientControlObjectProxyException ex;
                ex = new RemClientControlObjectProxyException("Could not connect", 0x01);
                //MessageBox.Show("Could not connect to the printer server.");
                ChannelServices.UnregisterChannel(channel);
                channel     = null;
                isConnected = false;
                remoteObj   = null;
                throw (ex);
            }
            else
            {
                remoteObj   = theObj;
                isConnected = true;
            }
        }