2020-07-07 09:37:55 +12:00
// <copyright file="SettingsForm.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
2020-07-07 07:15:45 +12:00
// </copyright>
2020-05-05 05:43:47 +12:00
namespace SystemTrayMenu.UserInterface
{
2020-07-07 07:15:45 +12:00
using System ;
using System.Collections.Generic ;
using System.Drawing ;
2021-05-09 19:52:37 +12:00
using System.IO ;
2020-07-07 07:15:45 +12:00
using System.Reflection ;
using System.Text ;
2021-10-22 07:51:24 +13:00
using System.Threading.Tasks ;
2020-07-07 07:15:45 +12:00
using System.Windows.Forms ;
2020-07-08 03:05:19 +12:00
using Microsoft.Win32 ;
2021-05-05 02:18:19 +12:00
using SystemTrayMenu.Properties ;
2021-11-11 11:39:52 +13:00
using SystemTrayMenu.UserInterface.FolderBrowseDialog ;
2020-07-07 07:15:45 +12:00
using SystemTrayMenu.Utilities ;
2021-10-22 07:51:24 +13:00
using Windows.ApplicationModel ;
2020-07-08 03:05:19 +12:00
using static SystemTrayMenu . UserInterface . HotkeyTextboxControl . HotkeyControl ;
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
public partial class SettingsForm : Form
{
2021-09-23 22:00:50 +12:00
private const string MenuName = @"Software\Classes\directory\shell\SystemTrayMenu_SetAsRootFolder" ;
private const string Command = @"Software\Classes\directory\shell\SystemTrayMenu_SetAsRootFolder\command" ;
2021-05-09 23:14:37 +12:00
private static readonly Icon SystemTrayMenu = Resources . SystemTrayMenu ;
2021-12-27 18:31:23 +13:00
private static SettingsForm settingsForm ;
2021-11-17 12:13:46 +13:00
private readonly ColorConverter colorConverter = new ( ) ;
2021-04-17 12:39:48 +12:00
private bool inHotkey ;
2020-05-05 05:43:47 +12:00
public SettingsForm ( )
{
InitializeComponent ( ) ;
2021-05-09 23:14:37 +12:00
Icon = SystemTrayMenu ;
2020-05-05 05:43:47 +12:00
2021-04-26 02:22:53 +12:00
// Initialize and replace here here, because designer always removes it
InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder ( ) ;
void InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder ( )
{
2021-04-26 06:40:11 +12:00
textBoxHotkey = new HotkeyTextboxControl . HotkeyControl
{
Hotkey = Keys . None ,
HotkeyModifiers = Keys . None ,
Name = "textBoxHotkey" ,
Size = new Size ( 200 , 20 ) ,
Text = "None" ,
} ;
2021-11-14 03:20:43 +13:00
textBoxHotkey . TabStop = false ;
2021-06-19 05:31:30 +12:00
textBoxHotkey . Enter + = new EventHandler ( TextBoxHotkeyEnter ) ;
textBoxHotkey . Leave + = new EventHandler ( TextBoxHotkey_Leave ) ;
2021-04-26 02:22:53 +12:00
tableLayoutPanelHotkey . Controls . Remove ( textBoxHotkeyPlaceholder ) ;
tableLayoutPanelHotkey . Controls . Add ( textBoxHotkey , 0 , 0 ) ;
}
// designer always resets it to 1
2021-06-19 05:31:30 +12:00
tabControl . SelectedIndex = 0 ;
2021-04-26 02:22:53 +12:00
2021-08-16 21:48:35 +12:00
CombineControls ( textBoxColorIcons , pictureBoxIcons ) ;
2021-06-06 09:57:36 +12:00
CombineControls ( textBoxColorBackground , pictureBoxBackground ) ;
2021-07-04 07:50:59 +12:00
CombineControls ( textBoxColorBackgroundBorder , pictureBoxBackgroundBorder ) ;
2021-06-06 09:57:36 +12:00
CombineControls ( textBoxColorSearchField , pictureBoxSearchField ) ;
CombineControls ( textBoxColorOpenFolder , pictureBoxOpenFolder ) ;
CombineControls ( textBoxColorOpenFolderBorder , pictureBoxOpenFolderBorder ) ;
CombineControls ( textBoxColorSelectedItem , pictureBoxSelectedItem ) ;
CombineControls ( textBoxColorSelectedItemBorder , pictureBoxSelectedItemBorder ) ;
CombineControls ( textBoxColorScrollbarBackground , pictureBoxScrollbarBackground ) ;
CombineControls ( textBoxColorSlider , pictureBoxSlider ) ;
CombineControls ( textBoxColorSliderDragging , pictureBoxSliderDragging ) ;
CombineControls ( textBoxColorSliderHover , pictureBoxSliderHover ) ;
CombineControls ( textBoxColorSliderArrowsAndTrackHover , pictureBoxSliderArrowsAndTrackHover ) ;
CombineControls ( textBoxColorArrow , pictureBoxArrow ) ;
CombineControls ( textBoxColorArrowClick , pictureBoxArrowClick ) ;
CombineControls ( textBoxColorArrowClickBackground , pictureBoxArrowClickBackground ) ;
CombineControls ( textBoxColorArrowHover , pictureBoxArrowHover ) ;
CombineControls ( textBoxColorArrowHoverBackground , pictureBoxArrowHoverBackground ) ;
2021-08-16 21:48:35 +12:00
CombineControls ( textBoxColorIconsDarkMode , pictureBoxIconsDarkMode ) ;
2021-06-06 09:57:36 +12:00
CombineControls ( textBoxColorBackgroundDarkMode , pictureBoxBackgroundDarkMode ) ;
2021-07-04 07:50:59 +12:00
CombineControls ( textBoxColorBackgroundBorderDarkMode , pictureBoxBackgroundBorderDarkMode ) ;
2021-06-06 09:57:36 +12:00
CombineControls ( textBoxColorSearchFieldDarkMode , pictureBoxSearchFieldDarkMode ) ;
CombineControls ( textBoxColorOpenFolderDarkMode , pictureBoxOpenFolderDarkMode ) ;
CombineControls ( textBoxColorOpenFolderBorderDarkMode , pictureBoxOpenFolderBorderDarkMode ) ;
CombineControls ( textBoxColorSelecetedItemDarkMode , pictureColorBoxSelectedItemDarkMode ) ;
CombineControls ( textBoxColorSelectedItemBorderDarkMode , pictureBoxSelectedItemBorderDarkMode ) ;
CombineControls ( textBoxColorScrollbarBackgroundDarkMode , pictureBoxScrollbarBackgroundDarkMode ) ;
CombineControls ( textBoxColorSliderDarkMode , pictureBoxSliderDarkMode ) ;
CombineControls ( textBoxColorSliderDraggingDarkMode , pictureBoxSliderDraggingDarkMode ) ;
CombineControls ( textBoxColorSliderHoverDarkMode , pictureBoxSliderHoverDarkMode ) ;
CombineControls ( textBoxColorSliderArrowsAndTrackHoverDarkMode , pictureBoxSliderArrowsAndTrackHoverDarkMode ) ;
CombineControls ( textBoxColorArrowDarkMode , pictureBoxArrowDarkMode ) ;
CombineControls ( textBoxColorArrowClickDarkMode , pictureBoxArrowClickDarkMode ) ;
CombineControls ( textBoxColorArrowClickBackgroundDarkMode , pictureBoxArrowClickBackgroundDarkMode ) ;
CombineControls ( textBoxColorArrowHoverDarkMode , pictureBoxArrowHoverDarkMode ) ;
CombineControls ( textBoxColorArrowHoverBackgroundDarkMode , pictureBoxArrowHoverBackgroundDarkMode ) ;
void CombineControls ( Control textBoxColor , Control pictureBox )
{
textBoxColor . Tag = pictureBox ;
pictureBox . Tag = textBoxColor ;
}
2020-05-05 05:43:47 +12:00
Translate ( ) ;
void Translate ( )
{
Text = Translator . GetText ( "Settings" ) ;
tabPageGeneral . Text = Translator . GetText ( "General" ) ;
2021-04-26 02:22:53 +12:00
groupBoxFolder . Text = Translator . GetText ( "Folder" ) ;
2021-05-05 07:59:55 +12:00
buttonChangeFolder . Text = Translator . GetText ( "Change folder" ) ;
2021-10-07 08:32:18 +13:00
buttonOpenFolder . Text = Translator . GetText ( "Open Folder" ) ;
2021-06-07 00:46:48 +12:00
checkBoxUseIconFromRootFolder . Text = Translator . GetText ( "Use icon from folder" ) ;
2021-10-07 08:32:18 +13:00
checkBoxPossibilityToSelectFolderByWindowsContextMenu . Text = Translator . GetText ( "Set by context menu " ) ;
2021-05-09 19:52:37 +12:00
groupBoxUSB . Text = Translator . GetText ( "USB" ) ;
buttonChangeRelativeFolder . Text = Translator . GetText ( "Change to relative folder" ) ;
2021-05-17 07:45:24 +12:00
checkBoxStoreConfigAtAssemblyLocation . Text = Translator . GetText ( "Store config at the assembly location" ) ;
buttonOpenAssemblyLocation . Text = Translator . GetText ( "Open the assembly location" ) ;
2021-04-26 02:22:53 +12:00
groupBoxAutostart . Text = Translator . GetText ( "Autostart" ) ;
2021-10-24 00:45:22 +13:00
if ( IsStartupTask ( ) )
{
2021-11-29 10:06:55 +13:00
groupBoxAutostart . Text + = $" ({Translator.GetText(" Task Manager ")})" ;
2021-10-24 00:45:22 +13:00
}
2020-05-05 05:43:47 +12:00
checkBoxAutostart . Text = Translator . GetText ( "Launch on startup" ) ;
2021-10-23 22:59:39 +13:00
buttonAddTaskManagerStartupTask . Text = Translator . GetText ( "Launch on startup" ) ;
2021-04-26 02:22:53 +12:00
groupBoxHotkey . Text = Translator . GetText ( "Hotkey" ) ;
buttonHotkeyDefault . Text = Translator . GetText ( "Default" ) ;
groupBoxLanguage . Text = Translator . GetText ( "Language" ) ;
2022-01-08 03:49:33 +13:00
tabPageSizeAndLocation . Text = Translator . GetText ( "Size and location" ) ;
2021-11-21 06:16:42 +13:00
groupBoxSize . Text = Translator . GetText ( "Size" ) ;
2022-01-23 03:43:44 +13:00
labelSizeInPercent . Text = $"% {Translator.GetText(" Size ")}" ;
labelIconSizeInPercent . Text = Translator . GetText ( "Size of the icons in percent" ) ;
labelRowHeightInPercentage . Text = Translator . GetText ( "Row height in percent" ) ;
2021-04-26 02:22:53 +12:00
labelMaxMenuWidth . Text = Translator . GetText ( "Pixels maximum menu width" ) ;
2021-05-29 19:45:59 +12:00
labelMaxMenuHeight . Text = Translator . GetText ( "Pixels maximum menu height" ) ;
2021-11-21 06:16:42 +13:00
groupBoxMenuAppearAt . Text = Translator . GetText ( "Main menu appears at" ) ;
radioButtonAppearAtTheBottomLeft . Text = Translator . GetText ( "Bottom left" ) ;
radioButtonAppearAtTheBottomRight . Text = Translator . GetText ( "Bottom right" ) ;
2021-11-25 07:01:59 +13:00
radioButtonUseCustomLocation . Text = Translator . GetText ( "Custom (drag it to the appropriate place)" ) ;
radioButtonAppearAtMouseLocation . Text = Translator . GetText ( "Mouse location" ) ;
2022-01-16 02:44:56 +13:00
groupBoxSubMenuAppearAt . Text = Translator . GetText ( "Sub menu appears at" ) ;
radioButtonNextToPreviousMenu . Text = Translator . GetText ( "Next to the previous one" ) ;
radioButtonOverlapping . Text = Translator . GetText ( "Overlapping" ) ;
labelOverlappingByPixelsOffset . Text = Translator . GetText ( "Offset by pixels" ) ;
2022-01-08 03:49:33 +13:00
buttonSizeAndLocationDefault . Text = Translator . GetText ( "Default" ) ;
tabPageAdvanced . Text = Translator . GetText ( "Advanced" ) ;
groupBoxClick . Text = Translator . GetText ( "Click" ) ;
checkBoxShowInTaskbar . Text = Translator . GetText ( "Show in Taskbar" ) ;
2022-01-16 00:07:02 +13:00
checkBoxOpenItemWithOneClick . Text = Translator . GetText ( "Single click to open an item instead of double click" ) ;
checkBoxOpenDirectoryWithOneClick . Text = Translator . GetText ( "Single click to open a directory instead of double click" ) ;
2022-01-08 03:49:33 +13:00
groupBoxHiddenFilesAndFolders . Text = Translator . GetText ( "Hidden files and folders" ) ;
radioButtonSystemSettingsShowHiddenFiles . Text = Translator . GetText ( "Use operating system settings" ) ;
radioButtonNeverShowHiddenFiles . Text = Translator . GetText ( "Never show hidden files, folders or drives" ) ;
radioButtonAlwaysShowHiddenFiles . Text = Translator . GetText ( "Always Show hidden files, folders or drives" ) ;
2021-10-27 09:09:40 +13:00
buttonAdvancedDefault . Text = Translator . GetText ( "Default" ) ;
2022-01-08 03:49:33 +13:00
tabPageFolders . Text = Translator . GetText ( "Folders" ) ;
2022-01-08 23:39:23 +13:00
groupBoxFoldersInRootFolder . Text = Translator . GetText ( "Add content of folders to main menu" ) ;
checkBoxShowOnlyAsSearchResult . Text = Translator . GetText ( "Show only as search result" ) ;
2022-01-08 03:49:33 +13:00
buttonAddFolderToRootFolder . Text = Translator . GetText ( "Add folder" ) ;
buttonRemoveFolder . Text = Translator . GetText ( "Remove folder" ) ;
ColumnFolder . HeaderText = Translator . GetText ( "Folder paths" ) ;
ColumnRecursiveLevel . HeaderText = Translator . GetText ( "Recursive" ) ;
ColumnOnlyFiles . HeaderText = Translator . GetText ( "Only Files" ) ;
buttonAddSampleStartMenuFolder . Text = Translator . GetText ( "Add sample 'Start Menu' folder" ) ;
buttonDefaultFolders . Text = Translator . GetText ( "Default" ) ;
checkBoxGenerateShortcutsToDrives . Text = Translator . GetText ( "Generate shortcuts to drives" ) ;
tabPageExpert . Text = Translator . GetText ( "Expert" ) ;
2021-04-26 02:22:53 +12:00
groupBoxStaysOpen . Text = Translator . GetText ( "Stays open" ) ;
2021-05-02 23:12:18 +12:00
checkBoxStayOpenWhenItemClicked . Text = Translator . GetText ( "If an item was clicked" ) ;
2021-04-26 02:22:53 +12:00
checkBoxStayOpenWhenFocusLost . Text = Translator . GetText ( "If the focus is lost and if the mouse is still on the menu" ) ;
labelTimeUntilCloses . Text = Translator . GetText ( "Milliseconds until the menu closes if in this case the mouse then leaves the menu" ) ;
2021-04-27 07:05:15 +12:00
groupBoxOpenSubmenus . Text = Translator . GetText ( "Time until a menu opens" ) ;
2021-04-26 02:22:53 +12:00
labelTimeUntilOpen . Text = Translator . GetText ( "Milliseconds until a menu opens when the mouse is on it" ) ;
2021-10-27 09:09:40 +13:00
checkBoxStayOpenWhenFocusLostAfterEnterPressed . Text = Translator . GetText ( "If the focus is lost and the Enter key was pressed" ) ;
labelTimeUntilClosesAfterEnterPressed . Text = Translator . GetText ( "Milliseconds until the menu closes if in this case the menu is not reactivated" ) ;
2021-12-12 02:34:28 +13:00
groupBoxCache . Text = Translator . GetText ( "Cache" ) ;
checkBoxCacheMainMenu . Text = Translator . GetText ( "Cache main menu" ) ;
labelClearCacheIfMoreThanThisNumberOfItems . Text = Translator . GetText ( "Clear cache if more than this number of items" ) ;
2021-10-27 09:09:40 +13:00
buttonExpertDefault . Text = Translator . GetText ( "Default" ) ;
2022-01-08 03:49:33 +13:00
tabPageCustomize . Text = Translator . GetText ( "Customize" ) ;
2021-11-21 06:16:42 +13:00
groupBoxAppearance . Text = Translator . GetText ( "Appearance" ) ;
checkBoxRoundCorners . Text = Translator . GetText ( "Round corners" ) ;
2022-02-05 11:40:07 +13:00
checkBoxUseFading . Text = Translator . GetText ( "Fading" ) ;
2021-11-21 06:16:42 +13:00
checkBoxDarkModeAlwaysOn . Text = Translator . GetText ( "Dark Mode always active" ) ;
2022-02-05 11:40:07 +13:00
buttonAppearanceDefault . Text = Translator . GetText ( "Default" ) ;
2021-06-06 09:57:36 +12:00
groupBoxColorsLightMode . Text = Translator . GetText ( "Colors Light Mode" ) ;
groupBoxColorsDarkMode . Text = Translator . GetText ( "Colors Dark Mode" ) ;
labelMenuLightMode . Text = Translator . GetText ( "Menu" ) ;
labelMenuDarkMode . Text = Translator . GetText ( "Menu" ) ;
labelScrollbarLightMode . Text = Translator . GetText ( "Scrollbar" ) ;
labelScrollbarDarkMode . Text = Translator . GetText ( "Scrollbar" ) ;
2021-08-16 21:48:35 +12:00
labelIcons . Text = Translator . GetText ( "Icons" ) ;
labelIconsDarkMode . Text = Translator . GetText ( "Icons" ) ;
2021-05-05 07:59:55 +12:00
labelBackground . Text = Translator . GetText ( "Background" ) ;
2021-06-06 09:57:36 +12:00
labelBackgroundDarkMode . Text = Translator . GetText ( "Background" ) ;
2021-07-04 07:50:59 +12:00
labelBackgroundBorder . Text = Translator . GetText ( "Border of menu" ) ;
labelBackgroundBorderDarkMode . Text = Translator . GetText ( "Border of menu" ) ;
2021-05-05 07:59:55 +12:00
labelSearchField . Text = Translator . GetText ( "Search field" ) ;
2021-06-06 09:57:36 +12:00
labelSearchFieldDarkMode . Text = Translator . GetText ( "Search field" ) ;
2021-05-17 07:45:24 +12:00
labelOpenFolder . Text = Translator . GetText ( "Opened folder" ) ;
2021-06-06 09:57:36 +12:00
labelOpenFolderDarkMode . Text = Translator . GetText ( "Opened folder" ) ;
2021-05-17 07:45:24 +12:00
labelOpenFolderBorder . Text = Translator . GetText ( "Border of opened folder" ) ;
2021-06-06 09:57:36 +12:00
labelOpenFolderBorderDarkMode . Text = Translator . GetText ( "Border of opened folder" ) ;
2021-05-05 07:59:55 +12:00
labelSelectedItem . Text = Translator . GetText ( "Selected item" ) ;
2021-06-06 09:57:36 +12:00
labelSelectedItemDarkMode . Text = Translator . GetText ( "Selected item" ) ;
2021-05-17 07:45:24 +12:00
labelSelectedItemBorder . Text = Translator . GetText ( "Border of selected item" ) ;
2021-06-06 09:57:36 +12:00
labelSelectedItemBorderDarkMode . Text = Translator . GetText ( "Border of selected item" ) ;
labelScrollbarBackground . Text = Translator . GetText ( "Background" ) ;
labelColorDarkModeScrollbarBackground . Text = Translator . GetText ( "Background" ) ;
labelSlider . Text = Translator . GetText ( "Slider" ) ;
labelColorDarkModeSlider . Text = Translator . GetText ( "Slider" ) ;
labelSliderDragging . Text = Translator . GetText ( "Slider while dragging" ) ;
labelColorDarkModeSliderDragging . Text = Translator . GetText ( "Slider while dragging" ) ;
labelSliderHover . Text = Translator . GetText ( "Slider while mouse hovers 1" ) ;
labelColorDarkModeSliderHover . Text = Translator . GetText ( "Slider while mouse hovers 1" ) ;
labelSliderArrowsAndTrackHover . Text = Translator . GetText ( "Slider while mouse hovers 2" ) ;
labelColorDarkModeSliderArrowsAndTrackHover . Text = Translator . GetText ( "Slider while mouse hovers 2" ) ;
labelArrow . Text = Translator . GetText ( "Arrow" ) ;
labelColorDarkModeArrow . Text = Translator . GetText ( "Arrow" ) ;
labelArrowClick . Text = Translator . GetText ( "Arrow when clicking" ) ;
labelColorDarkModeArrowClick . Text = Translator . GetText ( "Arrow when clicking" ) ;
labelArrowClickBackground . Text = Translator . GetText ( "Background of arrow when clicking" ) ;
labelColorDarkModeArrowClickBackground . Text = Translator . GetText ( "Background of arrow when clicking" ) ;
labelArrowHover . Text = Translator . GetText ( "Arrow while mouse hovers" ) ;
labelColorDarkModeArrowHover . Text = Translator . GetText ( "Arrow while mouse hovers" ) ;
labelArrowHoverBackground . Text = Translator . GetText ( "Background of arrow while mouse hovers" ) ;
labelColorDarkModeArrowHoverBackground . Text = Translator . GetText ( "Background of arrow while mouse hovers" ) ;
buttonColorsDefault . Text = Translator . GetText ( "Default" ) ;
buttonColorsDefaultDarkMode . Text = Translator . GetText ( "Default" ) ;
2021-11-29 10:06:55 +13:00
buttonOk . Text = Translator . GetText ( "OK" ) ;
2020-05-05 05:43:47 +12:00
buttonCancel . Text = Translator . GetText ( "buttonCancel" ) ;
}
InitializeFolder ( ) ;
void InitializeFolder ( )
{
textBoxFolder . Text = Config . Path ;
2021-06-07 00:46:48 +12:00
checkBoxUseIconFromRootFolder . Checked =
Settings . Default . UseIconFromRootFolder ;
2021-09-23 22:00:50 +12:00
checkBoxPossibilityToSelectFolderByWindowsContextMenu . Checked =
Settings . Default . PossibilityToSelectFolderByWindowsContextMenu ;
2020-05-05 05:43:47 +12:00
}
InitializeAutostart ( ) ;
void InitializeAutostart ( )
{
2021-10-24 00:45:22 +13:00
if ( IsStartupTask ( ) )
2021-10-22 07:51:24 +13:00
{
2021-10-23 22:59:39 +13:00
checkBoxAutostart . Visible = false ;
2021-10-24 00:45:22 +13:00
labelStartupTaskStatus . Text = string . Empty ;
2021-10-23 22:59:39 +13:00
}
else
{
buttonAddTaskManagerStartupTask . Visible = false ;
2021-10-24 00:45:22 +13:00
labelStartupTaskStatus . Visible = false ;
2021-10-23 22:59:39 +13:00
checkBoxAutostart . Checked = Settings . Default . IsAutostartActivated ;
2021-10-22 07:51:24 +13:00
}
2020-05-05 05:43:47 +12:00
}
InitializeHotkey ( ) ;
void InitializeHotkey ( )
{
2021-05-05 02:18:19 +12:00
textBoxHotkey . SetHotkey ( Settings . Default . HotKey ) ;
2020-05-05 05:43:47 +12:00
}
InitializeLanguage ( ) ;
void InitializeLanguage ( )
{
2021-11-17 12:13:46 +13:00
List < Language > dataSource = new ( )
2020-05-14 05:14:51 +12:00
{
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "čeština" , Value = "cs" } ,
2020-07-07 07:15:45 +12:00
new Language ( ) { Name = "Deutsch" , Value = "de" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "English" , Value = "en" } ,
2021-04-16 05:01:23 +12:00
new Language ( ) { Name = "Español" , Value = "es" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "Français" , Value = "fr" } ,
2021-04-25 09:03:24 +12:00
new Language ( ) { Name = "Italiano" , Value = "it" } ,
2021-04-29 09:41:21 +12:00
new Language ( ) { Name = "Nederlands" , Value = "nl" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "Português (Brasil)" , Value = "pt-BR" } ,
2021-10-14 07:05:03 +13:00
new Language ( ) { Name = "Türkçe " , Value = "tr" } ,
2021-05-31 07:51:17 +12:00
new Language ( ) { Name = "中文(简体)" , Value = "zh-CN" } ,
2021-05-31 08:14:39 +12:00
new Language ( ) { Name = "日本語" , Value = "ja" } ,
2021-06-02 09:19:23 +12:00
new Language ( ) { Name = "한국어" , Value = "ko" } ,
2021-06-03 08:48:55 +12:00
new Language ( ) { Name = "русский" , Value = "ru" } ,
new Language ( ) { Name = "Tiếng Việt" , Value = "vi" } ,
2021-11-29 10:06:55 +13:00
new Language ( ) { Name = "فارسی" , Value = "fa" } ,
2020-05-14 05:14:51 +12:00
} ;
2020-05-05 05:43:47 +12:00
comboBoxLanguage . DataSource = dataSource ;
comboBoxLanguage . DisplayMember = "Name" ;
comboBoxLanguage . ValueMember = "Value" ;
2020-05-14 05:14:51 +12:00
comboBoxLanguage . SelectedValue =
2021-05-05 02:18:19 +12:00
Settings . Default . CurrentCultureInfoName ;
2020-05-05 05:43:47 +12:00
if ( comboBoxLanguage . SelectedValue = = null )
{
comboBoxLanguage . SelectedValue = "en" ;
}
}
2020-08-06 01:33:45 +12:00
2021-05-09 19:52:37 +12:00
checkBoxStoreConfigAtAssemblyLocation . Checked = CustomSettingsProvider . IsActivatedConfigPathAssembly ( ) ;
2022-01-23 03:43:44 +13:00
numericUpDownSizeInPercent . Minimum = 100 ;
numericUpDownSizeInPercent . Maximum = 200 ;
numericUpDownSizeInPercent . Increment = 25 ;
numericUpDownSizeInPercent . MouseWheel + = NumericUpDown_MouseWheel ;
2021-11-14 04:52:55 +13:00
void NumericUpDown_MouseWheel ( object sender , MouseEventArgs e )
2021-10-05 08:36:52 +13:00
{
2021-11-14 04:52:55 +13:00
NumericUpDown numericUpDown = ( NumericUpDown ) sender ;
decimal newValue = numericUpDown . Value ;
2021-10-05 08:36:52 +13:00
if ( e . Delta > 0 )
{
2021-11-14 04:52:55 +13:00
newValue + = numericUpDown . Increment ;
if ( newValue > numericUpDown . Maximum )
2021-10-05 08:36:52 +13:00
{
2021-11-14 04:52:55 +13:00
newValue = ( int ) numericUpDown . Maximum ;
2021-10-05 08:36:52 +13:00
}
}
else
{
2021-11-14 04:52:55 +13:00
newValue - = numericUpDown . Increment ;
if ( newValue < numericUpDown . Minimum )
2021-10-05 08:36:52 +13:00
{
2021-11-14 04:52:55 +13:00
newValue = ( int ) numericUpDown . Minimum ;
2021-10-05 08:36:52 +13:00
}
}
2021-11-14 04:52:55 +13:00
numericUpDown . Value = newValue ;
2021-10-05 08:36:52 +13:00
( ( HandledMouseEventArgs ) e ) . Handled = true ;
}
2022-01-23 03:43:44 +13:00
numericUpDownSizeInPercent . Value = Settings . Default . SizeInPercent ;
numericUpDownIconSizeInPercent . Minimum = 50 ;
numericUpDownIconSizeInPercent . Maximum = 200 ;
numericUpDownIconSizeInPercent . Increment = 5 ;
numericUpDownIconSizeInPercent . MouseWheel + = NumericUpDown_MouseWheel ;
numericUpDownIconSizeInPercent . Value = Settings . Default . IconSizeInPercent ;
2021-04-26 06:40:11 +12:00
2021-11-14 04:52:55 +13:00
numericUpDownRowHeighteInPercentage . Minimum = 50 ;
numericUpDownRowHeighteInPercentage . Maximum = 200 ;
numericUpDownRowHeighteInPercentage . Increment = 25 ;
numericUpDownRowHeighteInPercentage . MouseWheel + = NumericUpDown_MouseWheel ;
if ( DllImports . NativeMethods . IsTouchEnabled ( ) )
{
numericUpDownRowHeighteInPercentage . Value = Settings . Default . RowHeighteInPercentageTouch ;
}
else
{
numericUpDownRowHeighteInPercentage . Value = Settings . Default . RowHeighteInPercentage ;
}
2021-04-26 06:40:11 +12:00
numericUpDownMenuWidth . Minimum = 50 ;
2021-05-29 19:45:59 +12:00
numericUpDownMenuWidth . Maximum = 1000 ;
2021-04-26 06:40:11 +12:00
numericUpDownMenuWidth . Increment = 10 ;
2021-05-05 02:18:19 +12:00
numericUpDownMenuWidth . Value = Settings . Default . MaximumMenuWidth ;
2021-04-26 06:40:11 +12:00
2021-06-03 22:52:47 +12:00
numericUpDownMenuHeight . Minimum = 200 ;
2021-05-29 19:45:59 +12:00
numericUpDownMenuHeight . Maximum = 4000 ;
numericUpDownMenuHeight . Increment = 10 ;
numericUpDownMenuHeight . Value = Settings . Default . MaximumMenuHeight ;
2021-11-25 07:01:59 +13:00
if ( Settings . Default . UseCustomLocation )
{
radioButtonUseCustomLocation . Checked = true ;
}
else if ( Settings . Default . AppearAtMouseLocation )
2021-11-21 06:16:42 +13:00
{
radioButtonAppearAtMouseLocation . Checked = true ;
}
else if ( Settings . Default . AppearAtTheBottomLeft )
{
radioButtonAppearAtTheBottomLeft . Checked = true ;
}
else
{
radioButtonAppearAtTheBottomRight . Checked = true ;
}
2021-06-27 21:35:07 +12:00
2022-01-16 02:44:56 +13:00
numericUpDownOverlappingOffsetPixels . Value = Settings . Default . OverlappingOffsetPixels ;
if ( Settings . Default . AppearNextToPreviousMenu )
{
radioButtonNextToPreviousMenu . Checked = true ;
numericUpDownOverlappingOffsetPixels . Enabled = false ;
}
else
{
radioButtonOverlapping . Checked = true ;
numericUpDownOverlappingOffsetPixels . Enabled = true ;
}
2022-01-08 03:49:33 +13:00
checkBoxShowInTaskbar . Checked = Settings . Default . ShowInTaskbar ;
checkBoxOpenItemWithOneClick . Checked = Settings . Default . OpenItemWithOneClick ;
2022-01-16 00:07:02 +13:00
checkBoxOpenDirectoryWithOneClick . Checked = Settings . Default . OpenDirectoryWithOneClick ;
2022-01-08 03:49:33 +13:00
radioButtonSystemSettingsShowHiddenFiles . Checked = Settings . Default . SystemSettingsShowHiddenFiles ;
radioButtonNeverShowHiddenFiles . Checked = Settings . Default . NeverShowHiddenFiles ;
radioButtonAlwaysShowHiddenFiles . Checked = Settings . Default . AlwaysShowHiddenFiles ;
2022-01-08 23:39:23 +13:00
checkBoxShowOnlyAsSearchResult . Checked = Settings . Default . ShowOnlyAsSearchResult ;
2022-01-08 03:49:33 +13:00
try
{
foreach ( string pathAndRecursivString in Settings . Default . PathsAddToMainMenu . Split ( @"|" ) )
{
if ( string . IsNullOrEmpty ( pathAndRecursivString ) )
{
continue ;
}
string pathAddToMainMenu = pathAndRecursivString . Split ( "recursiv:" ) [ 0 ] . Trim ( ) ;
bool recursive = pathAndRecursivString . Split ( "recursiv:" ) [ 1 ] . StartsWith ( "True" ) ;
bool onlyFiles = pathAndRecursivString . Split ( "onlyFiles:" ) [ 1 ] . StartsWith ( "True" ) ;
dataGridViewFolders . Rows . Add ( pathAddToMainMenu , recursive , onlyFiles ) ;
}
}
catch ( Exception ex )
{
Log . Warn ( "PathsAddToMainMenu" , ex ) ;
}
checkBoxGenerateShortcutsToDrives . Checked = Settings . Default . GenerateShortcutsToDrives ;
2021-05-05 02:18:19 +12:00
checkBoxStayOpenWhenItemClicked . Checked = Settings . Default . StaysOpenWhenItemClicked ;
checkBoxStayOpenWhenFocusLost . Checked = Settings . Default . StaysOpenWhenFocusLost ;
2021-04-26 06:40:11 +12:00
numericUpDownTimeUntilClose . Minimum = 200 ;
numericUpDownTimeUntilClose . Maximum = 5000 ;
2021-12-12 02:34:28 +13:00
numericUpDownTimeUntilClose . Increment = 10 ;
2021-05-05 02:18:19 +12:00
numericUpDownTimeUntilClose . Value = Settings . Default . TimeUntilCloses ;
2021-04-26 06:40:11 +12:00
numericUpDownTimeUntilOpens . Minimum = 20 ;
numericUpDownTimeUntilOpens . Maximum = 1000 ;
numericUpDownTimeUntilOpens . Increment = 10 ;
2021-05-05 02:18:19 +12:00
numericUpDownTimeUntilOpens . Value = Settings . Default . TimeUntilOpens ;
2021-10-27 09:09:40 +13:00
checkBoxStayOpenWhenFocusLostAfterEnterPressed . Checked = Settings . Default . StaysOpenWhenFocusLostAfterEnterPressed ;
numericUpDownTimeUntilClosesAfterEnterPressed . Minimum = 20 ;
numericUpDownTimeUntilClosesAfterEnterPressed . Maximum = 1000 ;
numericUpDownTimeUntilClosesAfterEnterPressed . Increment = 10 ;
numericUpDownTimeUntilClosesAfterEnterPressed . Value = Settings . Default . TimeUntilClosesAfterEnterPressed ;
2021-12-12 02:34:28 +13:00
checkBoxCacheMainMenu . Checked = Settings . Default . CacheMainMenu ;
numericUpDownClearCacheIfMoreThanThisNumberOfItems . Value = Settings . Default . ClearCacheIfMoreThanThisNumberOfItems ;
2021-11-21 06:16:42 +13:00
checkBoxRoundCorners . Checked = Settings . Default . RoundCorners ;
2022-02-05 11:40:07 +13:00
checkBoxUseFading . Checked = Settings . Default . UseFading ;
2021-05-05 02:18:19 +12:00
checkBoxDarkModeAlwaysOn . Checked = Settings . Default . IsDarkModeAlwaysOn ;
2021-11-21 06:16:42 +13:00
2021-05-05 07:59:55 +12:00
textBoxColorSelectedItem . Text = Settings . Default . ColorSelectedItem ;
2021-06-06 09:57:36 +12:00
textBoxColorSelecetedItemDarkMode . Text = Settings . Default . ColorDarkModeSelecetedItem ;
2021-05-05 07:59:55 +12:00
textBoxColorSelectedItemBorder . Text = Settings . Default . ColorSelectedItemBorder ;
2021-06-06 09:57:36 +12:00
textBoxColorSelectedItemBorderDarkMode . Text = Settings . Default . ColorDarkModeSelectedItemBorder ;
2021-05-05 07:59:55 +12:00
textBoxColorOpenFolder . Text = Settings . Default . ColorOpenFolder ;
2021-06-06 09:57:36 +12:00
textBoxColorOpenFolderDarkMode . Text = Settings . Default . ColorDarkModeOpenFolder ;
2021-05-05 07:59:55 +12:00
textBoxColorOpenFolderBorder . Text = Settings . Default . ColorOpenFolderBorder ;
2021-06-06 09:57:36 +12:00
textBoxColorOpenFolderBorderDarkMode . Text = Settings . Default . ColorDarkModeOpenFolderBorder ;
2021-08-16 21:48:35 +12:00
textBoxColorIcons . Text = Settings . Default . ColorIcons ;
textBoxColorIconsDarkMode . Text = Settings . Default . ColorDarkModeIcons ;
2021-05-05 07:59:55 +12:00
textBoxColorBackground . Text = Settings . Default . ColorBackground ;
2021-06-06 09:57:36 +12:00
textBoxColorBackgroundDarkMode . Text = Settings . Default . ColorDarkModeBackground ;
2021-07-04 07:50:59 +12:00
textBoxColorBackgroundBorder . Text = Settings . Default . ColorBackgroundBorder ;
textBoxColorBackgroundBorderDarkMode . Text = Settings . Default . ColorDarkModeBackgroundBorder ;
2021-05-05 07:59:55 +12:00
textBoxColorSearchField . Text = Settings . Default . ColorSearchField ;
2021-06-06 09:57:36 +12:00
textBoxColorSearchFieldDarkMode . Text = Settings . Default . ColorDarkModeSearchField ;
textBoxColorScrollbarBackground . Text = Settings . Default . ColorScrollbarBackground ;
textBoxColorSlider . Text = Settings . Default . ColorSlider ;
textBoxColorSliderDragging . Text = Settings . Default . ColorSliderDragging ;
textBoxColorSliderHover . Text = Settings . Default . ColorSliderHover ;
textBoxColorSliderArrowsAndTrackHover . Text = Settings . Default . ColorSliderArrowsAndTrackHover ;
textBoxColorArrow . Text = Settings . Default . ColorArrow ;
textBoxColorArrowClick . Text = Settings . Default . ColorArrowClick ;
textBoxColorArrowClickBackground . Text = Settings . Default . ColorArrowClickBackground ;
textBoxColorArrowHover . Text = Settings . Default . ColorArrowHover ;
textBoxColorArrowHoverBackground . Text = Settings . Default . ColorArrowHoverBackground ;
textBoxColorScrollbarBackgroundDarkMode . Text = Settings . Default . ColorScrollbarBackgroundDarkMode ;
textBoxColorSliderDarkMode . Text = Settings . Default . ColorSliderDarkMode ;
textBoxColorSliderDraggingDarkMode . Text = Settings . Default . ColorSliderDraggingDarkMode ;
textBoxColorSliderHoverDarkMode . Text = Settings . Default . ColorSliderHoverDarkMode ;
textBoxColorSliderArrowsAndTrackHoverDarkMode . Text = Settings . Default . ColorSliderArrowsAndTrackHoverDarkMode ;
textBoxColorArrowDarkMode . Text = Settings . Default . ColorArrowDarkMode ;
textBoxColorArrowClickDarkMode . Text = Settings . Default . ColorArrowClickDarkMode ;
textBoxColorArrowClickBackgroundDarkMode . Text = Settings . Default . ColorArrowClickBackgroundDarkMode ;
textBoxColorArrowHoverDarkMode . Text = Settings . Default . ColorArrowHoverDarkMode ;
textBoxColorArrowHoverBackgroundDarkMode . Text = Settings . Default . ColorArrowHoverBackgroundDarkMode ;
2020-05-05 05:43:47 +12:00
}
2021-12-27 19:35:39 +13:00
/// <summary>
/// Gets NewHotKey.
/// </summary>
public string NewHotKey { get ; } = string . Empty ;
/// <summary>
/// Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
/// </summary>
/// <returns>Whether the hotkeys could be registered to the users content. This also applies if conflicts arise and the user decides to ignore these (i.e. not to register the conflicting hotkey).</returns>
public static bool RegisterHotkeys ( )
{
return RegisterHotkeys ( false ) ;
}
public static void ShowSingleInstance ( IWin32Window owner = null )
2021-12-27 18:31:23 +13:00
{
if ( IsOpen ( ) )
{
settingsForm . Activate ( ) ;
}
else
{
2021-12-27 19:35:39 +13:00
settingsForm = new ( ) ;
if ( owner = = null )
2021-12-27 18:31:23 +13:00
{
2021-12-27 19:35:39 +13:00
settingsForm . ShowDialog ( ) ;
}
else
{
settingsForm . Show ( owner ) ;
2021-12-27 18:31:23 +13:00
}
}
}
2021-12-27 19:35:39 +13:00
public static bool IsOpen ( )
2021-12-27 18:31:23 +13:00
{
return settingsForm ! = null ;
}
2020-05-05 05:43:47 +12:00
protected override bool ProcessCmdKey ( ref Message msg , Keys keyData )
{
switch ( keyData )
{
case Keys . Escape :
2020-07-07 09:37:55 +12:00
if ( ! inHotkey )
2020-05-05 05:43:47 +12:00
{
DialogResult = DialogResult . Cancel ;
}
else
{
return base . ProcessCmdKey ( ref msg , keyData ) ;
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
break ;
default :
return base . ProcessCmdKey ( ref msg , keyData ) ;
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
return true ;
}
/// <summary>
2020-07-07 09:37:55 +12:00
/// Helper method to cleanly register a hotkey.
2020-05-05 05:43:47 +12:00
/// </summary>
2020-07-07 09:37:55 +12:00
/// <param name="failedKeys">failedKeys.</param>
/// <param name="hotkeyString">hotkeyString.</param>
/// <param name="handler">handler.</param>
/// <returns>bool success.</returns>
2020-05-05 05:43:47 +12:00
private static bool RegisterHotkey ( StringBuilder failedKeys , string hotkeyString , HotKeyHandler handler )
{
2021-04-23 05:18:03 +12:00
Keys modifierKeyCode = HotkeyModifiersFromString ( hotkeyString ) ;
Keys virtualKeyCode = HotkeyFromString ( hotkeyString ) ;
2020-05-05 05:43:47 +12:00
if ( ! Keys . None . Equals ( virtualKeyCode ) )
{
2021-04-23 05:18:03 +12:00
if ( RegisterHotKey ( modifierKeyCode , virtualKeyCode , handler ) < 0 )
2020-05-05 05:43:47 +12:00
{
if ( failedKeys . Length > 0 )
{
failedKeys . Append ( ", " ) ;
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
failedKeys . Append ( hotkeyString ) ;
return false ;
}
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
return true ;
}
2020-07-04 08:02:16 +12:00
private static bool RegisterWrapper ( StringBuilder failedKeys , HotKeyHandler handler )
2020-05-05 05:43:47 +12:00
{
2020-07-07 09:37:55 +12:00
bool success = RegisterHotkey (
failedKeys ,
2021-05-05 02:18:19 +12:00
Settings . Default . HotKey ,
2020-07-07 02:46:47 +12:00
handler ) ;
return success ;
2020-05-05 05:43:47 +12:00
}
/// <summary>
/// Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
/// </summary>
2020-07-07 09:37:55 +12:00
/// <param name="ignoreFailedRegistration">if true, a failed hotkey registration will not be reported to the user - the hotkey will simply not be registered.</param>
2020-05-05 05:43:47 +12:00
/// <returns>Whether the hotkeys could be registered to the users content. This also applies if conflicts arise and the user decides to ignore these (i.e. not to register the conflicting hotkey).</returns>
private static bool RegisterHotkeys ( bool ignoreFailedRegistration )
{
bool success = true ;
2021-11-17 12:13:46 +13:00
StringBuilder failedKeys = new ( ) ;
2020-07-07 02:46:47 +12:00
if ( ! RegisterWrapper ( failedKeys , Handler ) )
2020-05-05 05:43:47 +12:00
{
success = false ;
}
if ( ! success )
{
if ( ! ignoreFailedRegistration )
{
success = HandleFailedHotkeyRegistration ( failedKeys . ToString ( ) ) ;
}
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
return success | | ignoreFailedRegistration ;
}
2020-07-07 02:46:47 +12:00
private static void Handler ( )
2020-05-14 05:14:51 +12:00
{
}
2020-05-05 05:43:47 +12:00
/// <summary>
2020-07-07 07:15:45 +12:00
/// Displays a dialog for the user to choose how to handle hotkey registration failures:
2020-05-05 05:43:47 +12:00
/// retry (allowing to shut down the conflicting application before),
/// ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to register it again on next startup)
2020-07-07 09:37:55 +12:00
/// abort (do nothing about it).
2020-05-05 05:43:47 +12:00
/// </summary>
2020-07-07 09:37:55 +12:00
/// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text.</param>
/// <returns>bool success.</returns>
2020-05-05 05:43:47 +12:00
private static bool HandleFailedHotkeyRegistration ( string failedKeys )
{
bool success = false ;
2020-07-04 08:02:16 +12:00
string warningTitle = Translator . GetText ( "Warning" ) ;
string message = Translator . GetText ( "Could not register the hot key." ) + failedKeys ;
2020-05-05 05:43:47 +12:00
DialogResult dr = MessageBox . Show ( message , warningTitle , MessageBoxButtons . AbortRetryIgnore , MessageBoxIcon . Exclamation ) ;
if ( dr = = DialogResult . Retry )
{
2021-04-23 05:18:03 +12:00
UnregisterHotkeys ( ) ;
2020-05-05 05:43:47 +12:00
success = RegisterHotkeys ( false ) ;
}
else if ( dr = = DialogResult . Ignore )
{
2021-04-23 05:18:03 +12:00
UnregisterHotkeys ( ) ;
2020-05-05 05:43:47 +12:00
success = RegisterHotkeys ( true ) ;
}
2020-07-07 07:15:45 +12:00
2020-05-05 05:43:47 +12:00
return success ;
}
2021-10-11 04:33:54 +13:00
private static void AdjustControlMultilineIfNecessary ( Control control )
2021-05-05 07:59:55 +12:00
{
2021-10-11 04:33:54 +13:00
if ( control . Width > control . Parent . Width )
{
control . MaximumSize = new Size ( control . Parent . Width , 0 ) ;
control . MinimumSize = new Size ( 0 , control . Height * 2 ) ;
}
}
2021-06-06 22:00:06 +12:00
2021-10-11 04:33:54 +13:00
private static void AddPossibilityToSelectFolderByWindowsContextMenu ( )
{
RegistryKey registryKeyContextMenu = null ;
RegistryKey registryKeyContextMenuCommand = null ;
try
{
registryKeyContextMenu = Registry . CurrentUser . CreateSubKey ( MenuName ) ;
2021-12-27 19:35:39 +13:00
string binLocation = Environment . ProcessPath ;
2021-10-11 04:33:54 +13:00
if ( registryKeyContextMenu ! = null )
{
registryKeyContextMenu . SetValue ( string . Empty , Translator . GetText ( "Set as SystemTrayMenu folder" ) ) ;
registryKeyContextMenu . SetValue ( "Icon" , binLocation ) ;
}
registryKeyContextMenuCommand = Registry . CurrentUser . CreateSubKey ( Command ) ;
if ( registryKeyContextMenuCommand ! = null )
{
registryKeyContextMenuCommand . SetValue ( string . Empty , binLocation + " \"%1\"" ) ;
}
Settings . Default . PossibilityToSelectFolderByWindowsContextMenu = true ;
}
catch ( Exception ex )
{
Log . Warn ( "SavePossibilityToSelectFolderByWindowsContextMenu failed" , ex ) ;
}
finally
{
if ( registryKeyContextMenu ! = null )
{
registryKeyContextMenu . Close ( ) ;
}
if ( registryKeyContextMenuCommand ! = null )
{
registryKeyContextMenuCommand . Close ( ) ;
}
}
2021-05-05 07:59:55 +12:00
}
2021-10-11 04:33:54 +13:00
private static void RemovePossibilityToSelectFolderByWindowsContextMenu ( )
2021-06-06 22:00:06 +12:00
{
2021-10-11 04:33:54 +13:00
try
2021-06-06 22:00:06 +12:00
{
2021-10-11 04:33:54 +13:00
RegistryKey registryKey = Registry . CurrentUser . OpenSubKey ( Command ) ;
if ( registryKey ! = null )
{
registryKey . Close ( ) ;
Registry . CurrentUser . DeleteSubKey ( Command ) ;
}
registryKey = Registry . CurrentUser . OpenSubKey ( MenuName ) ;
if ( registryKey ! = null )
{
registryKey . Close ( ) ;
Registry . CurrentUser . DeleteSubKey ( MenuName ) ;
}
Settings . Default . PossibilityToSelectFolderByWindowsContextMenu = false ;
2021-06-06 22:00:06 +12:00
}
2021-10-11 04:33:54 +13:00
catch ( Exception ex )
{
Log . Warn ( "DeletePossibilityToSelectFolderByWindowsContextMenu failed" , ex ) ;
}
}
2021-10-24 03:27:53 +13:00
private static bool IsStartupTask ( )
{
bool useStartupTask = false ;
#if RELEASEPACKAGE
useStartupTask = true ;
#endif
return useStartupTask ;
}
2021-10-11 04:33:54 +13:00
private void SettingsForm_Load ( object sender , EventArgs e )
{
AdjustControlMultilineIfNecessary ( checkBoxStayOpenWhenFocusLost ) ;
tabControl . Size = new Size (
tabControl . Size . Width ,
2021-10-27 09:09:40 +13:00
tableLayoutPanelGeneral . Size . Height + ( int ) ( 50 * Scaling . Factor ) ) ;
2021-11-11 11:39:52 +13:00
dataGridViewFolders . ClearSelection ( ) ;
2021-06-06 22:00:06 +12:00
}
2020-07-08 03:05:19 +12:00
private void ButtonOk_Click ( object sender , EventArgs e )
{
2021-10-23 22:59:39 +13:00
Settings . Default . UseIconFromRootFolder = checkBoxUseIconFromRootFolder . Checked ;
2021-10-24 00:45:22 +13:00
if ( ! IsStartupTask ( ) )
{
SaveAutostartRegistryEntry ( ) ;
}
2021-04-26 02:22:53 +12:00
SaveHotkey ( ) ;
void SaveHotkey ( )
2020-07-08 03:05:19 +12:00
{
2021-10-23 22:59:39 +13:00
Settings . Default . HotKey = new KeysConverter ( ) . ConvertToInvariantString (
2021-04-26 02:22:53 +12:00
textBoxHotkey . Hotkey | textBoxHotkey . HotkeyModifiers ) ;
2020-07-08 03:05:19 +12:00
}
2021-04-26 02:22:53 +12:00
SaveLanguage ( ) ;
void SaveLanguage ( )
2020-07-08 03:05:19 +12:00
{
2021-10-23 22:59:39 +13:00
Settings . Default . CurrentCultureInfoName = comboBoxLanguage . SelectedValue . ToString ( ) ;
2021-09-23 22:00:50 +12:00
Translator . Initialize ( ) ;
}
PossibilityToSelectFolderByWindowsContextMenu ( ) ;
void PossibilityToSelectFolderByWindowsContextMenu ( )
{
if ( checkBoxPossibilityToSelectFolderByWindowsContextMenu . Checked )
{
AddPossibilityToSelectFolderByWindowsContextMenu ( ) ;
}
else
{
RemovePossibilityToSelectFolderByWindowsContextMenu ( ) ;
}
2020-07-08 03:05:19 +12:00
}
2022-01-23 03:43:44 +13:00
Settings . Default . SizeInPercent = ( int ) numericUpDownSizeInPercent . Value ;
Settings . Default . IconSizeInPercent = ( int ) numericUpDownIconSizeInPercent . Value ;
2021-11-14 04:52:55 +13:00
if ( DllImports . NativeMethods . IsTouchEnabled ( ) )
{
Settings . Default . RowHeighteInPercentageTouch = ( int ) numericUpDownRowHeighteInPercentage . Value ;
}
else
{
Settings . Default . RowHeighteInPercentage = ( int ) numericUpDownRowHeighteInPercentage . Value ;
}
2021-05-05 02:18:19 +12:00
Settings . Default . MaximumMenuWidth = ( int ) numericUpDownMenuWidth . Value ;
2021-05-29 19:45:59 +12:00
Settings . Default . MaximumMenuHeight = ( int ) numericUpDownMenuHeight . Value ;
2021-11-21 06:16:42 +13:00
2021-11-25 07:01:59 +13:00
if ( radioButtonUseCustomLocation . Checked )
{
Settings . Default . UseCustomLocation = true ;
Settings . Default . AppearAtMouseLocation = false ;
Settings . Default . AppearAtTheBottomLeft = false ;
}
else if ( radioButtonAppearAtMouseLocation . Checked )
2021-11-21 06:16:42 +13:00
{
2021-11-25 07:01:59 +13:00
Settings . Default . UseCustomLocation = false ;
2021-11-21 06:16:42 +13:00
Settings . Default . AppearAtMouseLocation = true ;
Settings . Default . AppearAtTheBottomLeft = false ;
}
else if ( radioButtonAppearAtTheBottomLeft . Checked )
{
2021-11-25 07:01:59 +13:00
Settings . Default . UseCustomLocation = false ;
2021-11-21 06:16:42 +13:00
Settings . Default . AppearAtMouseLocation = false ;
Settings . Default . AppearAtTheBottomLeft = true ;
}
else
{
2021-11-25 07:01:59 +13:00
Settings . Default . UseCustomLocation = false ;
2021-11-21 06:16:42 +13:00
Settings . Default . AppearAtMouseLocation = false ;
Settings . Default . AppearAtTheBottomLeft = false ;
}
2022-01-16 02:44:56 +13:00
Settings . Default . OverlappingOffsetPixels = ( int ) numericUpDownOverlappingOffsetPixels . Value ;
if ( radioButtonNextToPreviousMenu . Checked )
{
Settings . Default . AppearNextToPreviousMenu = true ;
}
else
{
Settings . Default . AppearNextToPreviousMenu = false ;
}
2022-01-08 03:49:33 +13:00
Settings . Default . ShowInTaskbar = checkBoxShowInTaskbar . Checked ;
Settings . Default . OpenItemWithOneClick = checkBoxOpenItemWithOneClick . Checked ;
2022-01-16 00:07:02 +13:00
Settings . Default . OpenDirectoryWithOneClick = checkBoxOpenDirectoryWithOneClick . Checked ;
2022-01-08 03:49:33 +13:00
Settings . Default . SystemSettingsShowHiddenFiles = radioButtonSystemSettingsShowHiddenFiles . Checked ;
Settings . Default . AlwaysShowHiddenFiles = radioButtonAlwaysShowHiddenFiles . Checked ;
Settings . Default . NeverShowHiddenFiles = radioButtonNeverShowHiddenFiles . Checked ;
2022-01-08 23:39:23 +13:00
Settings . Default . ShowOnlyAsSearchResult = checkBoxShowOnlyAsSearchResult . Checked ;
2022-01-08 03:49:33 +13:00
SaveFolders ( ) ;
Settings . Default . GenerateShortcutsToDrives = checkBoxGenerateShortcutsToDrives . Checked ;
Settings . Default . CacheMainMenu = checkBoxCacheMainMenu . Checked ;
Settings . Default . ClearCacheIfMoreThanThisNumberOfItems = ( int ) numericUpDownClearCacheIfMoreThanThisNumberOfItems . Value ;
void SaveFolders ( )
{
Settings . Default . PathsAddToMainMenu = string . Empty ;
foreach ( DataGridViewRow row in dataGridViewFolders . Rows )
{
string pathAddToMainMenu = row . Cells [ 0 ] . Value . ToString ( ) ;
bool recursiv = ( bool ) row . Cells [ 1 ] . Value ;
bool onlyFiles = ( bool ) row . Cells [ 2 ] . Value ;
Settings . Default . PathsAddToMainMenu + = $"{pathAddToMainMenu} recursiv:{recursiv} onlyFiles:{onlyFiles}|" ;
}
}
2021-05-05 02:18:19 +12:00
Settings . Default . StaysOpenWhenItemClicked = checkBoxStayOpenWhenItemClicked . Checked ;
Settings . Default . StaysOpenWhenFocusLost = checkBoxStayOpenWhenFocusLost . Checked ;
Settings . Default . TimeUntilCloses = ( int ) numericUpDownTimeUntilClose . Value ;
Settings . Default . TimeUntilOpens = ( int ) numericUpDownTimeUntilOpens . Value ;
2021-10-27 09:09:40 +13:00
Settings . Default . StaysOpenWhenFocusLostAfterEnterPressed = checkBoxStayOpenWhenFocusLostAfterEnterPressed . Checked ;
Settings . Default . TimeUntilClosesAfterEnterPressed = ( int ) numericUpDownTimeUntilClosesAfterEnterPressed . Value ;
2021-06-06 09:57:36 +12:00
2021-11-21 06:16:42 +13:00
Settings . Default . RoundCorners = checkBoxRoundCorners . Checked ;
2022-02-05 11:40:07 +13:00
Settings . Default . UseFading = checkBoxUseFading . Checked ;
2021-05-05 02:18:19 +12:00
Settings . Default . IsDarkModeAlwaysOn = checkBoxDarkModeAlwaysOn . Checked ;
2021-05-09 19:52:37 +12:00
if ( checkBoxStoreConfigAtAssemblyLocation . Checked )
{
CustomSettingsProvider . ActivateConfigPathAssembly ( ) ;
Settings . Default . Save ( ) ;
}
else
{
Settings . Default . Save ( ) ;
CustomSettingsProvider . DeactivateConfigPathAssembly ( ) ;
}
2021-04-26 02:22:53 +12:00
DialogResult = DialogResult . OK ;
2021-12-27 19:35:39 +13:00
AppRestart . ByConfigChange ( ) ;
2021-04-26 02:22:53 +12:00
Close ( ) ;
2020-07-08 03:05:19 +12:00
}
2021-10-23 22:59:39 +13:00
private void SaveAutostartRegistryEntry ( )
{
if ( checkBoxAutostart . Checked )
{
RegistryKey key = Registry . CurrentUser . OpenSubKey (
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" , true ) ;
key . SetValue (
Assembly . GetExecutingAssembly ( ) . GetName ( ) . Name ,
2021-12-27 19:35:39 +13:00
Environment . ProcessPath ) ;
2021-10-23 22:59:39 +13:00
Settings . Default . IsAutostartActivated = true ;
}
else
{
RegistryKey key = Registry . CurrentUser . OpenSubKey (
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" , true ) ;
key . DeleteValue ( "SystemTrayMenu" , false ) ;
Settings . Default . IsAutostartActivated = false ;
}
}
private void ButtonAddTaskManagerStartupTask_Click ( object sender , EventArgs e )
{
_ = AddStartUpAsync ( ) ;
2021-10-24 00:45:22 +13:00
async Task AddStartUpAsync ( )
2021-10-23 22:59:39 +13:00
{
// Pass the task ID you specified in the appxmanifest file
StartupTask startupTask = await StartupTask . GetAsync ( "MyStartupId" ) ;
Log . Info ( $"Autostart {startupTask.State}." ) ;
switch ( startupTask . State )
{
case StartupTaskState . Enabled :
2021-10-24 00:45:22 +13:00
case StartupTaskState . EnabledByPolicy :
UpdateLabelStartupStatus ( startupTask . State ) ;
2021-10-23 22:59:39 +13:00
break ;
case StartupTaskState . Disabled :
// Task is disabled but can be enabled.
StartupTaskState newState = await startupTask . RequestEnableAsync ( ) ;
2021-10-24 00:45:22 +13:00
UpdateLabelStartupStatus ( newState ) ;
2021-10-23 22:59:39 +13:00
break ;
case StartupTaskState . DisabledByUser :
2021-10-24 00:45:22 +13:00
UpdateLabelStartupStatus ( startupTask . State ) ;
2021-10-23 22:59:39 +13:00
break ;
case StartupTaskState . DisabledByPolicy :
2021-10-24 00:45:22 +13:00
UpdateLabelStartupStatus ( startupTask . State ) ;
2021-10-23 22:59:39 +13:00
break ;
default :
break ;
}
}
}
2021-10-24 00:45:22 +13:00
private void UpdateLabelStartupStatus ( StartupTaskState newState )
{
switch ( newState )
{
case StartupTaskState . Disabled :
case StartupTaskState . DisabledByUser :
case StartupTaskState . DisabledByPolicy :
labelStartupTaskStatus . Text = Translator . GetText ( "Deactivated" ) ;
break ;
case StartupTaskState . Enabled :
case StartupTaskState . EnabledByPolicy :
labelStartupTaskStatus . Text = Translator . GetText ( "Activated" ) ;
break ;
default :
break ;
}
}
2021-04-26 02:22:53 +12:00
private void ButtonHotkeyDefault_Click ( object sender , EventArgs e )
2020-07-08 03:05:19 +12:00
{
2021-04-26 02:22:53 +12:00
textBoxHotkey . SetHotkey ( "Ctrl+LWin" ) ;
2020-07-08 03:05:19 +12:00
}
2020-07-07 09:37:55 +12:00
2020-07-08 03:05:19 +12:00
private void ButtonChange_Click ( object sender , EventArgs e )
{
Config . SetFolderByUser ( false ) ;
textBoxFolder . Text = Config . Path ;
}
2021-10-07 08:32:18 +13:00
private void ButtonOpenFolder_Click ( object sender , EventArgs e )
{
2021-10-07 09:49:42 +13:00
Log . ProcessStart ( "explorer.exe" , Config . Path , true ) ;
2021-10-07 08:32:18 +13:00
}
2021-05-09 19:52:37 +12:00
private void ButtonChangeRelativeFolder_Click ( object sender , EventArgs e )
{
Settings . Default . PathDirectory = Path . GetRelativePath (
Directory . GetParent ( Assembly . GetEntryAssembly ( ) . Location ) . FullName ,
Config . Path ) ;
textBoxFolder . Text = Config . Path ;
}
private void ButtonOpenAssemblyLocation_Click ( object sender , EventArgs e )
{
Log . ProcessStart ( Directory . GetParent ( Assembly . GetEntryAssembly ( ) . Location ) . FullName ) ;
}
2020-07-08 03:05:19 +12:00
private void TextBoxHotkeyEnter ( object sender , EventArgs e )
{
2021-04-23 05:18:03 +12:00
UnregisterHotkeys ( ) ;
2020-07-08 03:05:19 +12:00
inHotkey = true ;
}
private void TextBoxHotkey_Leave ( object sender , EventArgs e )
{
2021-05-05 02:18:19 +12:00
Settings . Default . HotKey =
2020-07-08 03:05:19 +12:00
new KeysConverter ( ) . ConvertToInvariantString (
textBoxHotkey . Hotkey | textBoxHotkey . HotkeyModifiers ) ;
RegisterHotkeys ( ) ;
inHotkey = false ;
}
2021-05-03 01:21:07 +12:00
2021-11-13 01:44:02 +13:00
private void ButtonAddSampleStartMenuFolder_Click ( object sender , EventArgs e )
{
dataGridViewFolders . Rows . Clear ( ) ;
string folderPathCommonStartMenu = Environment . GetFolderPath ( Environment . SpecialFolder . CommonStartMenu ) ;
dataGridViewFolders . Rows . Add ( folderPathCommonStartMenu , true , true ) ;
dataGridViewFolders . ClearSelection ( ) ;
}
private void ButtonClearFolders_Click ( object sender , EventArgs e )
{
2022-01-08 23:49:34 +13:00
checkBoxShowOnlyAsSearchResult . Checked = false ;
2021-11-13 01:44:02 +13:00
dataGridViewFolders . Rows . Clear ( ) ;
2021-12-11 03:20:24 +13:00
checkBoxGenerateShortcutsToDrives . Checked = false ;
2021-11-13 01:44:02 +13:00
}
private void ButtonAddFolderToRootFolder_Click ( object sender , EventArgs e )
{
2021-11-17 12:13:46 +13:00
using FolderDialog dialog = new ( ) ;
2021-11-13 01:44:02 +13:00
dialog . InitialFolder = Config . Path ;
if ( dialog . ShowDialog ( ) = = DialogResult . OK )
{
dataGridViewFolders . Rows . Add ( dialog . Folder , false , true ) ;
}
dataGridViewFolders . ClearSelection ( ) ;
}
private void ButtonRemoveFolder_Click ( object sender , EventArgs e )
{
int selectedRowCount = dataGridViewFolders . Rows . GetRowCount ( DataGridViewElementStates . Selected ) ;
if ( selectedRowCount > 0 )
{
for ( int i = 0 ; i < selectedRowCount ; i + + )
{
dataGridViewFolders . Rows . RemoveAt ( dataGridViewFolders . SelectedRows [ 0 ] . Index ) ;
}
}
dataGridViewFolders . ClearSelection ( ) ;
}
private void DataGridViewFolders_SelectionChanged ( object sender , EventArgs e )
{
buttonRemoveFolder . Enabled = dataGridViewFolders . SelectedRows . Count > 0 ;
}
private void DataGridViewFolders_MouseClick ( object sender , MouseEventArgs e )
{
if ( dataGridViewFolders . HitTest ( e . X , e . Y ) . RowIndex < 0 )
{
dataGridViewFolders . ClearSelection ( ) ;
}
}
private void DataGridViewFolders_CellValidating ( object sender , DataGridViewCellValidatingEventArgs e )
{
if ( e . ColumnIndex = = 0 )
{
dataGridViewFolders . CancelEdit ( ) ;
}
}
private void DataGridViewFolders_RowsRemoved ( object sender , DataGridViewRowsRemovedEventArgs e )
{
EnableButtonAddStartMenu ( ) ;
}
private void DataGridViewFolders_RowsAdded ( object sender , DataGridViewRowsAddedEventArgs e )
{
EnableButtonAddStartMenu ( ) ;
}
private void DataGridViewFolders_CurrentCellDirtyStateChanged ( object sender , EventArgs e )
{
EnableButtonAddStartMenu ( ) ;
}
private void EnableButtonAddStartMenu ( )
{
bool doesStartMenuFolderExist = false ;
foreach ( DataGridViewRow row in dataGridViewFolders . Rows )
{
string folderPathCommonStartMenu = Environment . GetFolderPath ( Environment . SpecialFolder . CommonStartMenu ) ;
string pathAddToMainMenu = row . Cells [ 0 ] . Value . ToString ( ) ;
bool recursiv = ( bool ) row . Cells [ 1 ] . EditedFormattedValue ;
bool onlyFiles = ( bool ) row . Cells [ 2 ] . EditedFormattedValue ;
if ( folderPathCommonStartMenu = = pathAddToMainMenu & &
recursiv = = true & &
onlyFiles = = true )
{
doesStartMenuFolderExist = true ;
}
}
buttonAddSampleStartMenuFolder . Enabled = ! doesStartMenuFolderExist ;
}
2022-01-08 03:49:33 +13:00
private void ButtonSizeAndLocationDefault_Click ( object sender , EventArgs e )
2021-10-27 09:09:40 +13:00
{
2022-01-23 03:43:44 +13:00
numericUpDownSizeInPercent . Value = 125 ;
numericUpDownIconSizeInPercent . Value = 100 ;
2021-11-14 04:52:55 +13:00
numericUpDownRowHeighteInPercentage . Value = 100 ;
2021-12-12 02:34:28 +13:00
numericUpDownMenuWidth . Value = 400 ;
2021-10-27 09:09:40 +13:00
numericUpDownMenuHeight . Value = 600 ;
2022-01-08 03:49:33 +13:00
radioButtonAppearAtTheBottomRight . Checked = false ;
2021-12-12 02:34:28 +13:00
radioButtonAppearAtTheBottomLeft . Checked = true ;
2021-11-25 07:01:59 +13:00
radioButtonUseCustomLocation . Checked = false ;
2021-11-21 07:52:16 +13:00
radioButtonAppearAtMouseLocation . Checked = false ;
2022-01-16 02:44:56 +13:00
radioButtonNextToPreviousMenu . Checked = true ;
numericUpDownOverlappingOffsetPixels . Value = 150 ;
2022-01-08 03:49:33 +13:00
}
private void ButtonAdvancedDefault_Click ( object sender , EventArgs e )
{
2022-01-31 02:34:53 +13:00
checkBoxShowInTaskbar . Checked = false ;
2022-01-28 08:44:20 +13:00
checkBoxOpenItemWithOneClick . Checked = true ;
2022-01-16 00:07:02 +13:00
checkBoxOpenDirectoryWithOneClick . Checked = true ;
2022-01-08 03:49:33 +13:00
radioButtonSystemSettingsShowHiddenFiles . Checked = true ;
radioButtonNeverShowHiddenFiles . Checked = false ;
radioButtonAlwaysShowHiddenFiles . Checked = false ;
2021-10-27 09:09:40 +13:00
}
2021-05-03 01:21:07 +12:00
private void CheckBoxStayOpenWhenFocusLost_CheckedChanged ( object sender , EventArgs e )
{
numericUpDownTimeUntilClose . Enabled = checkBoxStayOpenWhenFocusLost . Checked ;
}
2021-05-05 02:18:19 +12:00
2021-10-27 09:09:40 +13:00
private void CheckBoxStayOpenWhenFocusLostAfterEnterPressed_CheckedChanged ( object sender , EventArgs e )
{
numericUpDownTimeUntilClosesAfterEnterPressed . Enabled = checkBoxStayOpenWhenFocusLostAfterEnterPressed . Checked ;
}
private void ButtonExpertDefault_Click ( object sender , EventArgs e )
{
checkBoxStayOpenWhenItemClicked . Checked = true ;
checkBoxStayOpenWhenFocusLost . Checked = true ;
2021-12-12 02:34:28 +13:00
numericUpDownTimeUntilClose . Value = 400 ;
2021-10-27 09:09:40 +13:00
numericUpDownTimeUntilOpens . Value = 100 ;
checkBoxStayOpenWhenFocusLostAfterEnterPressed . Checked = true ;
numericUpDownTimeUntilClosesAfterEnterPressed . Value = 200 ;
2021-12-12 02:34:28 +13:00
checkBoxCacheMainMenu . Checked = true ;
numericUpDownClearCacheIfMoreThanThisNumberOfItems . Value = 200 ;
2021-10-27 09:09:40 +13:00
}
2021-05-05 02:18:19 +12:00
private void TextBoxColorsChanged ( object sender , EventArgs e )
{
TextBox textBox = ( TextBox ) sender ;
2021-06-06 09:57:36 +12:00
PictureBox pictureBox = ( PictureBox ) textBox . Tag ;
pictureBox . BackColor = GetConvertFromStringOrDefault ( textBox . Text . Trim ( ) ) ;
2021-05-05 02:18:19 +12:00
2021-06-06 09:57:36 +12:00
SaveColorsTemporarily ( ) ;
}
2021-05-05 02:58:12 +12:00
2021-06-06 09:57:36 +12:00
private Color GetConvertFromStringOrDefault ( string text )
{
2021-05-05 02:58:12 +12:00
try
2021-05-05 02:18:19 +12:00
{
2021-06-06 09:57:36 +12:00
return ( Color ) colorConverter . ConvertFromString ( text ) ;
2021-05-05 02:18:19 +12:00
}
2021-05-05 02:58:12 +12:00
catch
2021-05-05 02:18:19 +12:00
{
2021-06-06 09:57:36 +12:00
return Color . White ;
2021-05-05 02:18:19 +12:00
}
}
2021-06-06 09:57:36 +12:00
private void SaveColorsTemporarily ( )
2021-05-05 02:18:19 +12:00
{
2021-06-06 09:57:36 +12:00
if ( Visible )
{
Settings . Default . ColorSelectedItem = textBoxColorSelectedItem . Text ;
Settings . Default . ColorDarkModeSelecetedItem = textBoxColorSelecetedItemDarkMode . Text ;
Settings . Default . ColorSelectedItemBorder = textBoxColorSelectedItemBorder . Text ;
Settings . Default . ColorDarkModeSelectedItemBorder = textBoxColorSelectedItemBorderDarkMode . Text ;
Settings . Default . ColorOpenFolder = textBoxColorOpenFolder . Text ;
Settings . Default . ColorDarkModeOpenFolder = textBoxColorOpenFolderDarkMode . Text ;
Settings . Default . ColorOpenFolderBorder = textBoxColorOpenFolderBorder . Text ;
Settings . Default . ColorDarkModeOpenFolderBorder = textBoxColorOpenFolderBorderDarkMode . Text ;
2021-08-16 21:48:35 +12:00
Settings . Default . ColorIcons = textBoxColorIcons . Text ;
Settings . Default . ColorDarkModeIcons = textBoxColorIconsDarkMode . Text ;
2021-06-06 09:57:36 +12:00
Settings . Default . ColorBackground = textBoxColorBackground . Text ;
Settings . Default . ColorDarkModeBackground = textBoxColorBackgroundDarkMode . Text ;
2021-07-04 07:50:59 +12:00
Settings . Default . ColorBackgroundBorder = textBoxColorBackgroundBorder . Text ;
Settings . Default . ColorDarkModeBackgroundBorder = textBoxColorBackgroundBorderDarkMode . Text ;
2021-06-06 09:57:36 +12:00
Settings . Default . ColorSearchField = textBoxColorSearchField . Text ;
Settings . Default . ColorDarkModeSearchField = textBoxColorSearchFieldDarkMode . Text ;
Settings . Default . ColorScrollbarBackground = textBoxColorScrollbarBackground . Text ;
Settings . Default . ColorSlider = textBoxColorSlider . Text ;
Settings . Default . ColorSliderDragging = textBoxColorSliderDragging . Text ;
Settings . Default . ColorSliderHover = textBoxColorSliderHover . Text ;
Settings . Default . ColorSliderArrowsAndTrackHover = textBoxColorSliderArrowsAndTrackHover . Text ;
Settings . Default . ColorArrow = textBoxColorArrow . Text ;
Settings . Default . ColorArrowClick = textBoxColorArrowClick . Text ;
Settings . Default . ColorArrowClickBackground = textBoxColorArrowClickBackground . Text ;
Settings . Default . ColorArrowHover = textBoxColorArrowHover . Text ;
Settings . Default . ColorArrowHoverBackground = textBoxColorArrowHoverBackground . Text ;
Settings . Default . ColorScrollbarBackgroundDarkMode = textBoxColorScrollbarBackgroundDarkMode . Text ;
Settings . Default . ColorSliderDarkMode = textBoxColorSliderDarkMode . Text ;
Settings . Default . ColorSliderDraggingDarkMode = textBoxColorSliderDraggingDarkMode . Text ;
Settings . Default . ColorSliderHoverDarkMode = textBoxColorSliderHoverDarkMode . Text ;
Settings . Default . ColorSliderArrowsAndTrackHoverDarkMode = textBoxColorSliderArrowsAndTrackHoverDarkMode . Text ;
Settings . Default . ColorArrowDarkMode = textBoxColorArrowDarkMode . Text ;
Settings . Default . ColorArrowClickDarkMode = textBoxColorArrowClickDarkMode . Text ;
Settings . Default . ColorArrowClickBackgroundDarkMode = textBoxColorArrowClickBackgroundDarkMode . Text ;
Settings . Default . ColorArrowHoverDarkMode = textBoxColorArrowHoverDarkMode . Text ;
Settings . Default . ColorArrowHoverBackgroundDarkMode = textBoxColorArrowHoverBackgroundDarkMode . Text ;
Config . InitializeColors ( false ) ;
}
}
private void CheckBoxDarkModeAlwaysOnCheckedChanged ( object sender , EventArgs e )
{
Settings . Default . IsDarkModeAlwaysOn = checkBoxDarkModeAlwaysOn . Checked ;
Config . ResetReadDarkModeDone ( ) ;
2021-08-16 21:48:35 +12:00
SaveColorsTemporarily ( ) ;
2021-06-06 09:57:36 +12:00
}
private void PictureBoxClick ( object sender , EventArgs e )
{
PictureBox pictureBox = ( PictureBox ) sender ;
TextBox textBox = ( TextBox ) pictureBox . Tag ;
colorDialog . Color = pictureBox . BackColor ;
2021-05-05 02:58:12 +12:00
if ( colorDialog . ShowDialog ( ) = = DialogResult . OK )
2021-05-05 02:18:19 +12:00
{
2021-05-05 02:58:12 +12:00
textBox . Text = ColorTranslator . ToHtml ( colorDialog . Color ) ;
2021-06-06 09:57:36 +12:00
pictureBox . BackColor = colorDialog . Color ;
2021-05-05 02:18:19 +12:00
}
}
2022-02-05 11:40:07 +13:00
private void ButtonAppearanceDefault_Click ( object sender , EventArgs e )
{
checkBoxRoundCorners . Checked = true ;
checkBoxUseFading . Checked = true ;
checkBoxDarkModeAlwaysOn . Checked = true ;
}
2021-05-05 02:18:19 +12:00
private void ButtonDefaultColors_Click ( object sender , EventArgs e )
{
2021-08-16 21:48:35 +12:00
textBoxColorIcons . Text = "#95a0a6" ;
2021-05-05 07:59:55 +12:00
textBoxColorOpenFolder . Text = "#C2F5DE" ;
textBoxColorOpenFolderBorder . Text = "#99FFA5" ;
textBoxColorBackground . Text = "#ffffff" ;
2021-07-04 07:50:59 +12:00
textBoxColorBackgroundBorder . Text = "#000000" ;
2021-05-05 07:59:55 +12:00
textBoxColorSearchField . Text = "#ffffff" ;
textBoxColorSelectedItem . Text = "#CCE8FF" ;
textBoxColorSelectedItemBorder . Text = "#99D1FF" ;
2021-06-06 09:57:36 +12:00
textBoxColorArrow . Text = "#606060" ;
textBoxColorArrowHoverBackground . Text = "#dadada" ;
textBoxColorArrowHover . Text = "#000000" ;
textBoxColorArrowClick . Text = "#ffffff" ;
textBoxColorArrowClickBackground . Text = "#606060" ;
textBoxColorSliderArrowsAndTrackHover . Text = "#c0c0c0" ;
textBoxColorSlider . Text = "#cdcdcd" ;
textBoxColorSliderHover . Text = "#a6a6a6" ;
textBoxColorSliderDragging . Text = "#606060" ;
textBoxColorScrollbarBackground . Text = "#f0f0f0" ;
2021-05-05 02:18:19 +12:00
}
private void ButtonDefaultColorsDark_Click ( object sender , EventArgs e )
{
2021-08-16 21:48:35 +12:00
textBoxColorIconsDarkMode . Text = "#95a0a6" ;
2021-06-06 09:57:36 +12:00
textBoxColorOpenFolderDarkMode . Text = "#14412A" ;
textBoxColorOpenFolderBorderDarkMode . Text = "#144B55" ;
textBoxColorBackgroundDarkMode . Text = "#202020" ;
2021-07-04 07:50:59 +12:00
textBoxColorBackgroundBorderDarkMode . Text = "#000000" ;
2021-06-06 09:57:36 +12:00
textBoxColorSearchFieldDarkMode . Text = "#191919" ;
textBoxColorSelecetedItemDarkMode . Text = "#333333" ;
textBoxColorSelectedItemBorderDarkMode . Text = "#141D4B" ;
textBoxColorArrowDarkMode . Text = "#676767" ;
textBoxColorArrowHoverBackgroundDarkMode . Text = "#373737" ;
textBoxColorArrowHoverDarkMode . Text = "#676767" ;
textBoxColorArrowClickDarkMode . Text = "#171717" ;
textBoxColorArrowClickBackgroundDarkMode . Text = "#a6a6a6" ;
textBoxColorSliderArrowsAndTrackHoverDarkMode . Text = "#4d4d4d" ;
textBoxColorSliderDarkMode . Text = "#4d4d4d" ;
textBoxColorSliderHoverDarkMode . Text = "#7a7a7a" ;
textBoxColorSliderDraggingDarkMode . Text = "#a6a6a6" ;
textBoxColorScrollbarBackgroundDarkMode . Text = "#171717" ;
2021-05-05 02:18:19 +12:00
}
2021-06-27 21:35:07 +12:00
private void StopPlayingDingSoundEnterKeyPressed_KeyDown ( object sender , KeyEventArgs e )
{
if ( e . KeyCode = = Keys . Enter )
{
e . Handled = e . SuppressKeyPress = true ;
}
}
private void StopPlayingDingSoundEnterKeyPressed_KeyUp ( object sender , KeyEventArgs e )
{
if ( e . KeyCode = = Keys . Enter )
{
e . Handled = e . SuppressKeyPress = true ;
}
}
2021-10-27 09:09:40 +13:00
private void ButtonCancel_Click ( object sender , EventArgs e )
{
Settings . Default . Reload ( ) ;
DialogResult = DialogResult . Cancel ;
Close ( ) ;
}
2021-12-27 19:35:39 +13:00
private void SettingsForm_FormClosed ( object sender , FormClosedEventArgs e )
{
settingsForm . Dispose ( ) ;
settingsForm = null ;
}
2022-01-16 02:44:56 +13:00
private void RadioButtonNextToPreviousMenu_CheckedChanged ( object sender , EventArgs e )
{
radioButtonOverlapping . CheckedChanged - = RadioButtonOverlapping_CheckedChanged ;
radioButtonOverlapping . Checked = false ;
radioButtonOverlapping . CheckedChanged + = RadioButtonOverlapping_CheckedChanged ;
numericUpDownOverlappingOffsetPixels . Enabled = false ;
}
private void RadioButtonOverlapping_CheckedChanged ( object sender , EventArgs e )
{
radioButtonNextToPreviousMenu . CheckedChanged - = RadioButtonNextToPreviousMenu_CheckedChanged ;
radioButtonNextToPreviousMenu . Checked = false ;
radioButtonNextToPreviousMenu . CheckedChanged + = RadioButtonNextToPreviousMenu_CheckedChanged ;
numericUpDownOverlappingOffsetPixels . Enabled = true ;
}
2020-05-05 05:43:47 +12:00
}
}