コード例 #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);
        }
コード例 #2
0
        public void GetLabelPrintGroups(ref byte[] printgroupXMLCompressed, ref int UncompressedDataLength)
        {
            GlobalDataStore.Logger.Debug("RemClientControlObject.GetLabelPrintGroups");

            List <ACA.LabelX.Toolbox.PrintGroupItem> PrintGroups;

            PrintGroups = new List <LabelX.Toolbox.PrintGroupItem>();

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

            lock (GlobalDataStore.LockClass)
            {
                if (!File.Exists(RemotingConfigFilePath))
                {
                    throw new LabelXRemClientControlOjectException(string.Format("Remoting configuration file doesn't exist: {0}", RemotingConfigFilePath));
                }
            }
            //not need all but fasted to use this for now...
            string PrintJobsRootFolder;
            string LabelDefinitionsRootFolder;
            string PaperDefinitionsRootFolder;
            string SettingsRootFolder;
            string MachineName;
            int    PollFrequency;

            Toolbox.Toolbox toolbox = new Toolbox.Toolbox();
            toolbox.GetGeneralClientConfiguraton(AppPath + @"\ACALabelXClient.config.xml",
                                                 out PrintJobsRootFolder,
                                                 out LabelDefinitionsRootFolder,
                                                 out PaperDefinitionsRootFolder,
                                                 out SettingsRootFolder,
                                                 out MachineName,
                                                 out PollFrequency,
                                                 ref PrintGroups);


            byte[] UncompressedPrintgroupXml;
            UncompressedPrintgroupXml = ConvertPrintergroupsToXML(PrintGroups);
            UncompressedDataLength    = UncompressedPrintgroupXml.Length;
            printgroupXMLCompressed   = PSLib.Compression.Compress(UncompressedPrintgroupXml);
        }