Beispiel #1
0
        private void InitializeControls(FlowLayoutPanel container)
        {
            var width = container.Width - container.Margin.All * 2;

            _buttonsContainer = new FlowLayoutPanel()
            {
                AutoSize      = true,
                AutoScroll    = false,
                FlowDirection = FlowDirection.TopDown,
                WrapContents  = false,
            };
            _buttonsContainer.ControlAdded   += process_button_added;
            _buttonsContainer.ControlRemoved += process_button_removed;

            _startGameButton = GetStartGameButton();

            container.Controls.Add(_startGameButton);

            for (var i = 0; i < _processMonitor.GetRunningProcesses().Count; i++)
            {
                var process = _processMonitor.GetRunningProcesses()[i];
                var button  = GetProcessButton(process);
                _buttonsContainer.Controls.Add(button);
                var killerButton = GetProcessKillerButton(button);
                if (_disableProcessKiller)
                {
                    killerButton.Hide();
                }
                _buttonsContainer.Controls.Add(killerButton);
                button.ShowPerformanceCounter();
            }
            _container.Controls.Add(_buttonsContainer);

            _timerButton = GetTimerButton(width - container.Margin.All * 2,
                                          TimeSpan.FromSeconds(_countDownTime), TimeSpan.FromSeconds(_countDownWarnningTime));
            _container.Controls.Add(_timerButton);

            var settingsButton = GetSettingsButton();

            container.Controls.Add(settingsButton);
            _copyrightLabel            = GetCopyrightLabel(width);
            _copyrightLabel.MouseDown += window_mouse_down;
            container.Controls.Add(_copyrightLabel);
            _versionInfoLabel              = GetVersionInfoLabel(width);
            _versionInfoLabel.LinkClicked += home_link_clicked;
            container.Controls.Add(_versionInfoLabel);
            _newVersionDownloadLinkLabel              = GetNewVersionDownloadLinkLabel(width);
            _newVersionDownloadLinkLabel.LinkClicked += new_version_link_clicked;

            ResizeWindowIfNeeded();
        }
Beispiel #2
0
        private TimerButton GetTimerButton(int width, TimeSpan countDown, TimeSpan alertThreshold)
        {
            var button = new TimerButton(countDown, alertThreshold, _timerDefaultTextColor, _timerAlertTextColor, _timerRunningBackColor, _timerDefaultBackColor)
            {
                Width     = width,
                Height    = DefaultTimerButtonHeight,
                Font      = new Font(_defaultFontFamily, 32, FontStyle.Regular),
                FlatStyle = FlatStyle.Flat,
                Margin    = new Padding(6, 0, 6, 3),
                Text      = countDown.TotalSeconds.ToString("0"),
                BackColor = _timerDefaultBackColor,
                ForeColor = _timerDefaultTextColor,
            };

            button.FlatAppearance.BorderSize = 0;
            button.Click += timer_button_click;

            return(button);
        }