Exemplo n.º 1
0
        public void Start()
        {
            StartCalled = true;

            string AppPath = ACA.LabelX.GlobalDataStore.AppPath; // System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string RemotingConfigFilePath = AppPath + @"\ACALabelXClient.config.xml";

            if (!File.Exists(RemotingConfigFilePath))
            {
                throw new LabelXClientEngineException(string.Format("Remoting configuration file doesn't exist: {0}", RemotingConfigFilePath));
            }

            string Protocol;
            string Address;
            string Port;
            string Uri;

            Toolbox.Toolbox toolbox = new Toolbox.Toolbox();
            toolbox.GetRemotingClientConfiguraton(RemotingConfigFilePath, out Protocol, out Address, out Port, out Uri);

            Hashtable myTable = new Hashtable();

            switch (Protocol.ToLower())
            {
            case "http":
                myTable["name"] = "servercon";
                HttpClientChannel theHttp = new HttpClientChannel(myTable, null);
                ChannelServices.RegisterChannel(theHttp, false);
                break;

            case "tcp":
                myTable["name"] = "servercon";
                TcpClientChannel theTcp = new TcpClientChannel(myTable, null);
                ChannelServices.RegisterChannel(theTcp, false);
                break;

            default:
                throw new LabelXClientEngineException(string.Format("Cannot obtain the correct protocol from the Remoting configuration file: {0}\r\nProtocol found: {1}\r\nShould be: http, or tcp", RemotingConfigFilePath, Protocol));
            }

            ServerURL = string.Format("{0}://{1}:{2}/{3}", Protocol, Address, Port, Uri);

            PrintGroups = new List <LabelX.Toolbox.PrintGroupItem>();
            toolbox.GetGeneralClientConfiguraton(AppPath + @"\ACALabelXClient.config.xml", out PrintJobsRootFolder, out LabelDefinitionsRootFolder, out PaperDefinitionsRootFolder, out SettingsRootFolder, out PicturesRootFolder, out UpdateRootFolder, out MachineName, out PollFrequency, ref PrintGroups);
        }
Exemplo n.º 2
0
        public void Start()
        {
            StartCalled = true;

            string AppPath = ".\\"; // System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string RemotingConfigFilePath = AppPath + @"\ACALabelXClientRemote.config.xml";

            if (!File.Exists(RemotingConfigFilePath))
            {
                throw new LabelXClientCtrlEngineException(string.Format("Remoting configuration file doesn't exist: {0}", RemotingConfigFilePath));
            }

            string Protocol;
            string Address;
            string Port;
            string Uri;

            Toolbox.Toolbox toolbox = new Toolbox.Toolbox();
            toolbox.GetRemotingClientConfiguraton(RemotingConfigFilePath, 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 LabelXClientCtrlEngineException(string.Format("Cannot obtain the correct protocol from the Remoting configuration file: {0}\r\nProtocol found: {1}\r\nShould be: http, or tcp", RemotingConfigFilePath, Protocol));
            }

            ServerURL = string.Format("{0}://{1}:{2}/{3}", Protocol, Address, Port, Uri);
        }