Exemple #1
0
        /// <summary>
        /// This function collects the printer commands when loading the application
        /// </summary>
        private static void GetPrinterCommands()
        {
            #region "Added by Baruri at 15.06.2009 for retrieving the print command"
            xmlDoc = new XmlDocument();
            string executableName = System.Reflection.Assembly.GetExecutingAssembly().Location;
            FileInfo executableFileInfo = new FileInfo(executableName);
            currentDirectory = executableFileInfo.DirectoryName + "\\config";
            xmlDoc.Load(currentDirectory + "\\paper_cartridge_command.xml");
            CPrinterConstants objPrinterConstants = new CPrinterConstants();
            XmlNode appSettingsNode = xmlDoc.SelectSingleNode("cartridge/CutPaperCode");

            RMSGlobal.m_printer_kitchen_cut_command = Convert.ToString(appSettingsNode.InnerText);
        }
Exemple #2
0
        protected override void OnStart(string[] args)
        {
            #region "Added by Baruri at 15.06.2009 for retrieving the print command"
            xmlDoc = new XmlDocument();
            string executableName = System.Reflection.Assembly.GetExecutingAssembly().Location;
            FileInfo executableFileInfo = new FileInfo(executableName);
            currentDirectory = executableFileInfo.DirectoryName + "\\Config";
            xmlDoc.Load(currentDirectory + "\\CommonConstants.xml");
            CPrinterConstants objPrinterConstants = new CPrinterConstants();
            XmlNode appSettingsNode = xmlDoc.SelectSingleNode("CCommonConstants/PaperCutCommand");

            RMSServiceGlobal.m_printer_kitchen_cut_command = Convert.ToString(appSettingsNode.InnerText);
            appSettingsNode = xmlDoc.SelectSingleNode("CCommonConstants/BeepCommand");

            RMSServiceGlobal.m_printer_beep_command = Convert.ToString(appSettingsNode.InnerText);

            #endregion

            try
            {
                ConfigManager.Init();

                ConfigManager.ReloadConfig();

                Logger.Write("Starting RMS SMS Service.", LogLevel.Information, LogSources.RmsServer);
                //throw new Exception("test exception");

                //preload config
               // ConfigManager.Init();

                Logger.Write("RMS SMS Service successfully started.", LogLevel.Information, LogSources.RmsServer);

                CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>();

                CPrintThread myThread = new CPrintThread();
                m_oPrintThread = new Thread(new ThreadStart(myThread.run));
                m_oPrintThread.Start();

                String sTempChannel = oConstant.Channel.Trim().ToLower();

                int iTempPort = oConstant.Port;

                if (sTempChannel.Equals("tcp"))
                {
                    TcpChannel oChannel = new TcpChannel(iTempPort);
                    ChannelServices.RegisterChannel(oChannel);
                    RemotingConfiguration.RegisterWellKnownServiceType(typeof

                                   (RmsRemote.CLogin), "RMSSERVER", WellKnownObjectMode.Singleton);

                }
                else if(sTempChannel.Equals("http"))
                {

                    HttpChannel oChannel = new HttpChannel(iTempPort);

                    ChannelServices.RegisterChannel(oChannel);

                    RemotingConfiguration.RegisterWellKnownServiceType(typeof

                                   (RmsRemote.CLogin), "RMSSERVER", WellKnownObjectMode.Singleton);

                }
            }
            catch (Exception exp)
            {
                Logger.Write("A fatal error occured while trying to start the RMS SMS Service: " + exp.Message, LogLevel.Fatal, LogSources.RmsServer);
                throw exp;
            }
        }