public SettingsForm()
        {
            InitializeComponent();

            InitializeSettings();

            this.MouseDown += SettingsForm_MouseDown;
            this.KeySettingsGroupBox.MouseDown              += SettingsForm_MouseDown;
            this.SettingsTable.MouseDown                    += SettingsForm_MouseDown;
            this.ProcessKillerButtonLabel.MouseDown         += SettingsForm_MouseDown;
            this.CountDownButtonLabel.MouseDown             += SettingsForm_MouseDown;
            this.TimerCountDownTimeTextBox.KeyPress         += TimerCountDownTimeTextBox_KeyPress;
            this.TimerCountDownWarnningTimeTextBox.KeyPress += TimerCountDownWarnningTimeTextBox_KeyPress;
            _keyboardEventHook = new KeyboardInputEventHelper();
            _keyboardEventHook.KeyBoardKeyDownEvent += keyboard_key_down;

            GC.KeepAlive(_keyboardEventHook);

            this.Load += settings_form_load;
        }
예제 #2
0
        public MainForm()
        {
            _runningTimer = new Stopwatch();
            _runningTimer.Start();

            this.Text = Resources.ApplicationName;

            InitializeComponent();

            InitializeSettings();

            _defaultFontFamily = FontFamily.GenericSansSerif;

            try
            {
                _defaultFontFamily = new FontFamily("Microsoft YaHei"); // use Microsoft YaHei if it is available
            }
            catch (Exception)
            {
                // ignore
            }

            _processMonitor = new ProcessMonitor(Resources.DragonNest_Exe_Name);

            _processMonitor.OnEventArrived += event_arrived;

            InitializeTitleBar();

            _container = new FlowLayoutPanel()
            {
                AutoSize      = true,
                AutoScroll    = false,
                FlowDirection = FlowDirection.TopDown,
                WrapContents  = false,
                Width         = DefaultClientRectangleWidth,
                Padding       = new Padding(0, this.TitleBar.Height, 0, 3),
            };

            this.Controls.Add(_container);

            InitializeControls(_container);

            _processMonitor.StartMonitoring();

            _winEvent = new WinEventHelper();
            _winEvent.OnWindowForegroundChanged += window_event_triggered;
            _winEvent.OnWindowMinimizeStart     += window_event_triggered;
            _winEvent.OnWindowMinimizeEnd       += window_event_triggered;

            _keyboardEventHook = new KeyboardInputEventHelper();
            _keyboardEventHook.KeyBoardKeyDownEvent += keyboard_key_down;

            this.ResizeEnd += resize_end;

            // hacky way to keep delegates alive
            GC.KeepAlive(_winEvent);
            GC.KeepAlive(_keyboardEventHook);

            // new version check
            Task.Factory.StartNew(NotifyIfNewVersionFound);

#if DEBUG
            TitleBarLabel.Text += " DEBUG ";
#endif
        }