Ejemplo n.º 1
0
        public static StoreManageCenterConfig GetConfig(string sectionName)
        {
            StoreManageCenterConfig section = (StoreManageCenterConfig)ConfigurationManager.GetSection("StoreManageCenterConfig");

            if (section == null)
            {
                throw new ConfigurationErrorsException("Section " + sectionName + " is not found.");
            }
            return(section);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            if (Environment.UserInteractive)
            {
                string parameter = string.Concat(args);
                switch (parameter)
                {
                case "-i":
                    ServiceHelper.InstallWindowsService();
                    goto RunIIS;

                case "-u":
                    ServiceHelper.UninstallWindowsService();
                    return;

                case "-start":
                    ServiceHelper.StartService();
                    goto RunIIS;

                case "-stop":
                    ServiceHelper.StopService();
                    break;

                default:
                    var status = ServiceHelper.CheckServiceStatus();
                    if (status == null)
                    {
                        ServiceHelper.InstallWindowsService();
                    }
                    else if (status != ServiceControllerStatus.Running)
                    {
                        ServiceHelper.StartService();
                    }
RunIIS:
                    {
                        POSService.storeManagerThread = Thread.CurrentThread;
                        IISExpressSeverManager manager = new IISExpressSeverManager();
                        var config = StoreManageCenterConfig.GetConfig();
                        var path   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Store");
                        manager.Run(config.Port, path, "v4.0", "IIS");
                        break;
                    }
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
            else
            {
                ServiceBase[] servicesToRun;
                servicesToRun = new ServiceBase[] { new POSService() };
                ServiceBase.Run(servicesToRun);
            }
        }
Ejemplo n.º 3
0
        public static StoreManageCenterConfig GetConfig()
        {
            StoreManageCenterConfig section = (StoreManageCenterConfig)ConfigurationManager.GetSection("StoreManageCenterConfig");

            return(section);
        }