예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="frmMain"/> class.
        /// </summary>
        public frmMain()
        {
            var cwh = ConsoleWindowHider.TryCreate();

            if (cwh != null)
            {
                cwh.Hide();
            }

            _logger = new MemoryAppender();
            BasicConfigurator.Configure(_logger);

            InitializeComponent();

            try
            {
                _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            }
            catch (Exception ex)
            {
                const string errmsg = "Failed to create Processor performance counter: {0}";
                if (log.IsErrorEnabled)
                {
                    log.ErrorFormat(errmsg, ex);
                }
                _cpuCounter = null;
            }

            _serverThread = new Thread(ServerThread)
            {
                Name = "Server Thread", IsBackground = true
            };
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="frmMain"/> class.
        /// </summary>
        public frmMain()
        {
            var cwh = ConsoleWindowHider.TryCreate();

            if (cwh != null)
            {
                cwh.Hide();
            }

            _logger = new MemoryAppender();
            BasicConfigurator.Configure(_logger);

            InitializeComponent();

            _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");

            _serverThread = new Thread(ServerThread)
            {
                Name = "Server Thread", IsBackground = true
            };
        }