Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Thread m_oPrintThread;

            ConfigManager.Init();

            ConfigManager.ReloadConfig();

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

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

            TcpChannel ch = new TcpChannel(8085);

            ChannelServices.RegisterChannel(ch);

            RemotingConfiguration.RegisterWellKnownServiceType(typeof

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

            Console.Write("Sever is  Ready........");

            Console.Read();
        }
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;
            }
        }