Exemple #1
0
        public FirstRunDialog()
        {
            InitializeComponent();

            HandleCreated += (object sender, EventArgs e) =>
            {
                DarkModeChanged += FirstRunDialog_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };

            ControlScheduleSetDarkMode(darkButton, true);

            headerLabel.Text          = strings.firstRunHeading;
            messageLabel.Text         = strings.firstRunMessage;
            allowUpdatesCheckBox.Text = strings.firstRunAllowUpdateCheck;
            lnkLabel1.Text            = strings.firstRunPrivacyInfoLinkLabel;
            lnkLabel2.Text            = strings.firstRunContribute;
            okButton.Text             = strings.firstRunStart;
            exitButton.Text           = strings.firstRunExit;
            themeLabel.Text           = strings.firstRunColorSchemePreference;
            lightButton.Text          = strings.firstRunColorSchemeLight;
            darkButton.Text           = strings.firstRunColorSchemeDark;

            if (Environment.OSVersion.Version.Major < 10)
            {
                darkButton.Enabled = false;
                darkButton.Text   += "\r\n" + strings.firstRunColorSchemeWin10Only;
            }
        }
Exemple #2
0
        public DownloadDialog()
        {
            InitializeComponent();

            HandleCreated += (sender, e) =>
            {
                DarkModeChanged += DownloadDialog_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };
        }
        public NumberInputDialog(int defaultValue, int minValue, int maxValue)
        {
            InitializeComponent();
            min = minValue;
            max = maxValue;
            inputTextBox.Text = defaultValue.ToString();

            HandleCreated += (sender, e) =>
            {
                DarkModeChanged += NumberInputDialog_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };
        }
Exemple #4
0
        public UpdateDialog()
        {
            InitializeComponent();

            Text = strings.updateAvailable;
            updateNowButton.Text        = strings.updateNow;
            dismissButton.Text          = strings.dismissButton;
            downloadManuallyButton.Text = strings.downloadManuallyButton;

            HandleCreated += (sender, e) =>
            {
                DarkModeChanged += UpdateDialog_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };
        }
Exemple #5
0
 private void darkButton_Click(object sender, EventArgs e)
 {
     DarkModeProvider.SetDarkModeEnabled(true);
 }
Exemple #6
0
 private void lightButton_Click(object sender, EventArgs e)
 {
     DarkModeProvider.SetDarkModeEnabled(false);
 }
        public IndSettingsWindow()
        {
            InitializeComponent();

            resources = new ResourceManager("CapsLockIndicatorV3.resources", Assembly.GetExecutingAssembly());

            HandleCreated += (sender, e) =>
            {
                DarkModeChanged += IndSettingsWindow_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };

            MaximumSize = new Size(int.MaxValue, Screen.FromControl(this).WorkingArea.Height);
            AutoScroll  = true;

            displayTimeSlider.Value = SettingsManager.Get <int>("indDisplayTime") > 0 ? SettingsManager.Get <int>("indDisplayTime") : 2001;
            displayTimeLabel.Text   = displayTimeSlider.Value < 2001 ? string.Format("{0} ms", displayTimeSlider.Value) : strings.permanentIndicator;

            opacitySlider.Value = SettingsManager.Get <int>("indOpacity");
            opacityLabel.Text   = string.Format("{0} %", opacitySlider.Value);

            bdSizeSlider.Value = SettingsManager.Get <int>("bdSize");
            bdSizeLabel.Text   = string.Format("{0}", bdSizeSlider.Value);

            backgroundColourActivatedPreview.BackColor   = SettingsManager.Get <Color>("indBgColourActive");
            backgroundColourDeactivatedPreview.BackColor = SettingsManager.Get <Color>("indBgColourInactive");

            foregroundColourActivatedPreview.BackColor   = SettingsManager.Get <Color>("indFgColourActive");
            foregroundColourDeactivatedPreview.BackColor = SettingsManager.Get <Color>("indFgColourInactive");

            borderColourActivatedPreview.BackColor   = SettingsManager.Get <Color>("indBdColourActive");
            borderColourDeactivatedPreview.BackColor = SettingsManager.Get <Color>("indBdColourInactive");

            fontButton.Font = SettingsManager.GetOrDefault <Font>("indFont");

            onlyShowWhenActiveCheckBox.Checked = SettingsManager.Get <bool>("alwaysShowWhenActive");

            switch (SettingsManager.Get <IndicatorDisplayPosition>("overlayPosition"))
            {
            case IndicatorDisplayPosition.TopLeft:
                positionTopLeft.Checked = true;
                break;

            case IndicatorDisplayPosition.TopCenter:
                positionTopCenter.Checked = true;
                break;

            case IndicatorDisplayPosition.TopRight:
                positionTopRight.Checked = true;
                break;

            case IndicatorDisplayPosition.MiddleLeft:
                positionMiddleLeft.Checked = true;
                break;

            case IndicatorDisplayPosition.MiddleCenter:
                positionMiddleCenter.Checked = true;
                break;

            case IndicatorDisplayPosition.MiddleRight:
                positionMiddleRight.Checked = true;
                break;

            case IndicatorDisplayPosition.BottomLeft:
                positionBottomLeft.Checked = true;
                break;

            case IndicatorDisplayPosition.BottomCenter:
                positionBottomCenter.Checked = true;
                break;

            case IndicatorDisplayPosition.BottomRight:
                positionBottomRight.Checked = true;
                break;

            default:
                break;
            }

            Text = strings.notificationSettingsTitle;
            displayTimeGroup.Text = strings.displayTime;
            opacityGroup.Text     = strings.opacity;
            fontGroupBox.Text     = strings.fontGroup;
            coloursGroup.Text     = strings.coloursGroup;
            fontButton.Text       = string.Format(strings.keyIsOff, strings.capsLock);
            saveButton.Text       = strings.saveAndCloseButton;
            backgroundColourActivatedButton.Text   = strings.backgroundColourActivatedButton;
            backgroundColourDeactivatedButton.Text = strings.backgroundColourDeactivatedButton;
            borderColourActivatedButton.Text       = strings.borderColourActivatedButton;
            borderColourDeactivatedButton.Text     = strings.borderColourDeactivatedButton;
            foregroundColourActivatedButton.Text   = strings.foregroundColourActivatedButton;
            foregroundColourDeactivatedButton.Text = strings.foregroundColourDeactivatedButton;
            positionGroup.Text = strings.overlayPositionGroup;
            onlyShowWhenActiveCheckBox.Text = strings.showOverlayOnlyWhenActive;
            lnkLabel1.Text   = strings.advancedSettings;
            borderGroup.Text = strings.borderThicknessGroup;
        }
        public MainForm()
        {
            Assembly        assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string          version  = fvi.FileVersion;

            // Initialize component
            InitializeComponent();

            Opacity       = 0;
            ShowInTaskbar = false;

            // Load "resources.resx" into a ResourceManager to access its resources
            resources = new ResourceManager("CapsLockIndicatorV3.resources", Assembly.GetExecutingAssembly());

            // Load the icons into variables
            ReloadIcons();

            // Set the values
            numState    = KeyHelper.isNumlockActive;
            capsState   = KeyHelper.isCapslockActive;
            scrollState = KeyHelper.isScrolllockActive;

            // Load settings
            enableNumIcon.Checked    = SettingsManager.Get <bool>("numIco");
            enableCapsIcon.Checked   = SettingsManager.Get <bool>("capsIco");
            enableScrollIcon.Checked = SettingsManager.Get <bool>("scrollIco");

            enableNumInd.Checked    = SettingsManager.Get <bool>("numInd");
            enableCapsInd.Checked   = SettingsManager.Get <bool>("capsInd");
            enableScrollInd.Checked = SettingsManager.Get <bool>("scrollInd");

            showNoIcons.Checked        = SettingsManager.Get <bool>("noIco");
            showNoNotification.Checked = SettingsManager.Get <bool>("noInd");

            iconsGroup.Enabled     = !showNoIcons.Checked;
            indicatorGroup.Enabled = !showNoNotification.Checked;

            generalIcon.ContextMenu                =
                numLockIcon.ContextMenu            =
                    capsLockIcon.ContextMenu       =
                        scrollLockIcon.ContextMenu =
                            contextMenu1;

            HandleCreated += (sender, e) =>
            {
                DarkModeChanged += MainForm_DarkModeChanged;
                DarkModeProvider.RegisterForm(this);
            };

            // Check if application is in startup
            startonlogonCheckBox.Checked = Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "CapsLock Indicator", null) != null;

            // Hides the window on startup if enabled
            if (SettingsManager.Get <bool>("hideOnStartup"))
            {
                hideOnStartupCheckBox.Checked = true;
                hideWindowTimer.Start();
            }
            else
            {
                Opacity       = 1;
                ShowInTaskbar = true;
            }

            checkForUpdatedCheckBox.Checked = SettingsManager.Get <bool>("checkForUpdates");

            AddCultures();

            ApplyLocales();

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
        }