Exemplo n.º 1
0
 public const int DEFAULT_WEB_PORT = 12309; //如果没有配置,则使用此默认端口
 public Login(Router router, ClientMngr frm)
 {
     InitializeComponent();
     clientRouter = router;
     parentForm   = frm;
     UpdateTexts();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (!mutex.WaitOne(3, false))
            {
                string msg = "Another instance of the program is running.";
                //Logger.Error(msg, new Exception(msg));
                MessageBox.Show(msg);
                return;
            }

            var loggerRepository = LogManager.CreateRepository(LOGGER_REPO_NAME);
            var config           = XmlConfigurator.Configure(loggerRepository, new FileInfo(LoggerConfigPath));

            //BasicConfigurator.Configure(loggerRepository);
            Program.Logger = LogManager.GetLogger(loggerRepository.Name, "NSmartServerClient");
            if (!loggerRepository.Configured)
            {
                throw new Exception("log config failed.");
            }
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile(CONFIG_FILE_PATH);

            Configuration = builder.Build();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var clientForm = new ClientMngr();

            //Application.ApplicationExit += (sender, e) =>
            //{
            //    clientForm.Close();
            //};

            Application.Run(clientForm);
        }