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" ) ;
2022-05-30 02:41:23 +12:00
groupBoxFolder . Text = Translator . GetText ( "Directory" ) ;
2022-05-30 06:42:42 +12:00
buttonChangeFolder . Text = Translator . GetText ( "Changing directory" ) ;
2022-05-30 02:41:23 +12:00
buttonOpenFolder . Text = Translator . GetText ( "Open directory" ) ;
2022-06-06 01:27:35 +12:00
checkBoxSetFolderByWindowsContextMenu . Text = Translator . GetText ( "Set by context menu " ) ;
groupBoxConfigAndLogfile . Text = Translator . GetText ( "Configuration file and log file" ) ;
2022-05-30 02:41:23 +12:00
buttonChangeRelativeFolder . Text = Translator . GetText ( "Convert to relative directory" ) ;
2022-06-06 01:27:35 +12:00
checkBoxSaveConfigInApplicationDirectory . Text = Translator . GetText ( "Save configuration in application directory" ) ;
checkBoxSaveLogFileInApplicationDirectory . Text = Translator . GetText ( "Saving log file in application directory instead of AppData" ) ;
2022-05-30 02:41:23 +12:00
buttonOpenAssemblyLocation . Text = Translator . GetText ( "Open application directory" ) ;
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
}
2022-05-30 02:41:23 +12:00
checkBoxAutostart . Text = Translator . GetText ( "Start with Windows" ) ;
buttonAddTaskManagerStartupTask . Text = Translator . GetText ( "Start with Windows" ) ;
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" ) ;
2022-05-30 06:42:42 +12:00
groupBoxMenuAppearAt . Text = Translator . GetText ( "Main menu appears" ) ;
2021-11-21 06:16:42 +13:00
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)" ) ;
2022-05-30 06:42:42 +12:00
radioButtonAppearAtMouseLocation . Text = Translator . GetText ( "At mouse location" ) ;
groupBoxSubMenuAppearAt . Text = Translator . GetText ( "Sub menu appears" ) ;
2022-01-16 02:44:56 +13:00
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-02-08 04:41:30 +13:00
checkBoxSendHotkeyInsteadKillOtherInstances . Text = Translator . GetText ( "Send hotkey to other instance" ) ;
2022-05-30 02:41:23 +12:00
checkBoxOpenItemWithOneClick . Text = Translator . GetText ( "Single click to open an element instead of double click" ) ;
2022-01-16 00:07:02 +13:00
checkBoxOpenDirectoryWithOneClick . Text = Translator . GetText ( "Single click to open a directory instead of double click" ) ;
2022-05-03 05:55:15 +12:00
groupBoxDrag . Text = Translator . GetText ( "Drag" ) ;
checkBoxDragDropItems . Text = Translator . GetText ( "Copy row item via drag drop" ) ;
checkBoxSwipeScrolling . Text = Translator . GetText ( "Scroll via swipe" ) ;
2022-06-11 04:41:49 +12:00
groupBoxInternetShortcutIcons . Text = Translator . GetText ( "Directory of Internet Shortcut Icons" ) ;
buttonChangeIcoFolder . Text = Translator . GetText ( "Changing directory" ) ;
groupBoxSorting . Text = Translator . GetText ( "Sorting" ) ;
2022-06-13 11:32:36 +12:00
radioButtonSortByTypeAndName . Text = Translator . GetText ( "Sorted by type and name" ) ;
radioButtonSortByTypeAndDate . Text = Translator . GetText ( "Sorted by type and date" ) ;
radioButtonSortByName . Text = Translator . GetText ( "Sorted by name" ) ;
radioButtonSortByDate . Text = Translator . GetText ( "Sorted by date" ) ;
2022-05-30 02:41:23 +12:00
groupBoxHiddenFilesAndFolders . Text = Translator . GetText ( "Hidden files and directories" ) ;
2022-01-08 03:49:33 +13:00
radioButtonSystemSettingsShowHiddenFiles . Text = Translator . GetText ( "Use operating system settings" ) ;
2022-05-30 02:41:23 +12:00
radioButtonNeverShowHiddenFiles . Text = Translator . GetText ( "Never show hidden files, directories or drives" ) ;
2022-06-01 09:23:26 +12:00
radioButtonAlwaysShowHiddenFiles . Text = Translator . GetText ( "Always show hidden files, directories or drives" ) ;
2021-10-27 09:09:40 +13:00
buttonAdvancedDefault . Text = Translator . GetText ( "Default" ) ;
2022-01-08 03:49:33 +13:00
2022-05-30 02:41:23 +12:00
tabPageFolders . Text = Translator . GetText ( "Directories" ) ;
groupBoxFoldersInRootFolder . Text = Translator . GetText ( "Add content of directory to root directory" ) ;
2022-01-08 23:39:23 +13:00
checkBoxShowOnlyAsSearchResult . Text = Translator . GetText ( "Show only as search result" ) ;
2022-05-30 02:41:23 +12:00
buttonAddFolderToRootFolder . Text = Translator . GetText ( "Add directory" ) ;
buttonRemoveFolder . Text = Translator . GetText ( "Remove directory" ) ;
ColumnFolder . HeaderText = Translator . GetText ( "Directory paths" ) ;
2022-01-08 03:49:33 +13:00
ColumnRecursiveLevel . HeaderText = Translator . GetText ( "Recursive" ) ;
ColumnOnlyFiles . HeaderText = Translator . GetText ( "Only Files" ) ;
2022-05-30 06:42:42 +12:00
buttonAddSampleStartMenuFolder . Text = Translator . GetText ( "Add sample directory 'Start Menu'" ) ;
2022-01-08 03:49:33 +13:00
buttonDefaultFolders . Text = Translator . GetText ( "Default" ) ;
2022-05-30 02:41:23 +12:00
checkBoxGenerateShortcutsToDrives . Text = Translator . GetText ( "Generate drive shortcuts on startup" ) ;
2022-01-08 03:49:33 +13:00
tabPageExpert . Text = Translator . GetText ( "Expert" ) ;
2021-04-26 02:22:53 +12:00
groupBoxStaysOpen . Text = Translator . GetText ( "Stays open" ) ;
2022-05-30 02:41:23 +12:00
checkBoxStayOpenWhenItemClicked . Text = Translator . GetText ( "If an element 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" ) ;
2022-05-26 03:08:11 +12:00
groupBoxSearchPattern . Text = Translator . GetText ( "Filter menu by file type e.g.: *.exe|*.dll" ) ;
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" ) ;
2022-06-06 01:27:35 +12:00
checkBoxUseIconFromRootFolder . Text = Translator . GetText ( "Use icon from directory" ) ;
2021-11-21 06:16:42 +13:00
checkBoxRoundCorners . Text = Translator . GetText ( "Round corners" ) ;
2022-05-30 06:42:42 +12:00
checkBoxDarkModeAlwaysOn . Text = Translator . GetText ( "Color scheme dark always active" ) ;
2022-06-06 01:27:35 +12:00
checkBoxUseFading . Text = Translator . GetText ( "Fading" ) ;
2022-06-07 08:46:13 +12:00
checkBoxShowLinkOverlay . Text = Translator . GetText ( "Show link overlay" ) ;
2022-06-01 09:23:26 +12:00
checkBoxShowDirectoryTitleAtTop . Text = Translator . GetText ( "Show directory title at top" ) ;
checkBoxShowCountOfElementsBelow . Text = Translator . GetText ( "Show count of elements below" ) ;
checkBoxShowSearchBar . Text = Translator . GetText ( "Show search bar" ) ;
checkBoxShowFunctionKeysBelow . Text = Translator . GetText ( "Show function keys below" ) ;
2022-02-05 11:40:07 +13:00
buttonAppearanceDefault . Text = Translator . GetText ( "Default" ) ;
2022-05-30 06:42:42 +12:00
groupBoxColorsLightMode . Text = Translator . GetText ( "Color scheme bright" ) ;
groupBoxColorsDarkMode . Text = Translator . GetText ( "Color scheme dark" ) ;
2022-05-30 02:41:23 +12:00
labelMenuLightMode . Text = Translator . GetText ( "App menu" ) ;
labelMenuDarkMode . Text = Translator . GetText ( "App menu" ) ;
2021-06-06 09:57:36 +12:00
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" ) ;
2022-05-30 02:41:23 +12:00
labelOpenFolder . Text = Translator . GetText ( "Opened directory" ) ;
labelOpenFolderDarkMode . Text = Translator . GetText ( "Opened directory" ) ;
labelOpenFolderBorder . Text = Translator . GetText ( "Border of opened directory" ) ;
labelOpenFolderBorderDarkMode . Text = Translator . GetText ( "Border of opened directory" ) ;
labelSelectedItem . Text = Translator . GetText ( "Selected element" ) ;
labelSelectedItemDarkMode . Text = Translator . GetText ( "Selected element" ) ;
labelSelectedItemBorder . Text = Translator . GetText ( "Border of selected element" ) ;
labelSelectedItemBorderDarkMode . Text = Translator . GetText ( "Border of selected element" ) ;
2021-06-06 09:57:36 +12:00
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" ) ;
2022-05-30 02:41:23 +12:00
labelSliderHover . Text = Translator . GetText ( "Slider while mouse hovers over it 1" ) ;
labelColorDarkModeSliderHover . Text = Translator . GetText ( "Slider while mouse hovers over it 1" ) ;
labelSliderArrowsAndTrackHover . Text = Translator . GetText ( "Slider while mouse hovers over it 2" ) ;
labelColorDarkModeSliderArrowsAndTrackHover . Text = Translator . GetText ( "Slider while mouse hovers over it 2" ) ;
2021-06-06 09:57:36 +12:00
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" ) ;
2022-05-30 02:41:23 +12:00
labelArrowHover . Text = Translator . GetText ( "Arrow while mouse hovers over it" ) ;
labelColorDarkModeArrowHover . Text = Translator . GetText ( "Arrow while mouse hovers over it" ) ;
labelArrowHoverBackground . Text = Translator . GetText ( "Background of arrow while mouse hovers over it" ) ;
labelColorDarkModeArrowHoverBackground . Text = Translator . GetText ( "Background of arrow while mouse hovers over it" ) ;
2021-06-06 09:57:36 +12:00
buttonColorsDefault . Text = Translator . GetText ( "Default" ) ;
buttonColorsDefaultDarkMode . Text = Translator . GetText ( "Default" ) ;
2021-11-29 10:06:55 +13:00
buttonOk . Text = Translator . GetText ( "OK" ) ;
2022-05-30 02:41:23 +12:00
buttonCancel . Text = Translator . GetText ( "Abort" ) ;
2020-05-05 05:43:47 +12:00
}
2022-06-06 01:27:35 +12:00
textBoxFolder . Text = Config . Path ;
checkBoxSetFolderByWindowsContextMenu . Checked = Settings . Default . SetFolderByWindowsContextMenu ;
checkBoxSaveConfigInApplicationDirectory . Checked = CustomSettingsProvider . IsActivatedConfigPathAssembly ( ) ;
checkBoxSaveLogFileInApplicationDirectory . Checked = Settings . Default . SaveLogFileInApplicationDirectory ;
2020-05-05 05:43:47 +12:00
2022-06-06 01:27:35 +12:00
if ( IsStartupTask ( ) )
2020-05-05 05:43:47 +12:00
{
2022-06-06 01:27:35 +12:00
checkBoxAutostart . Visible = false ;
labelStartupTaskStatus . Text = string . Empty ;
2020-05-05 05:43:47 +12:00
}
2022-06-06 01:27:35 +12:00
else
2020-05-05 05:43:47 +12:00
{
2022-06-06 01:27:35 +12:00
buttonAddTaskManagerStartupTask . Visible = false ;
labelStartupTaskStatus . Visible = false ;
checkBoxAutostart . Checked = Settings . Default . IsAutostartActivated ;
2020-05-05 05:43:47 +12:00
}
2022-06-06 01:27:35 +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
{
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Afrikaans" , Value = "af" } ,
new Language ( ) { Name = "Azərbaycan" , Value = "az" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "bahasa Indonesia" , Value = "id" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "català" , Value = "ca" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "čeština" , Value = "cs" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Cymraeg" , Value = "cy" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "dansk" , Value = "da" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Deutsch" , Value = "de" } ,
new Language ( ) { Name = "eesti keel" , Value = "et" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "English" , Value = "en" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Español" , Value = "es" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Esperanto" , Value = "eo" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "euskara" , Value = "eu" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Filipino" , Value = "tl" } ,
2021-05-03 00:51:16 +12:00
new Language ( ) { Name = "Français" , Value = "fr" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Gaeilge" , Value = "it" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "galego" , Value = "gl" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Hrvatski" , Value = "hr" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Irish" , Value = "ga" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "íslenskur" , Value = "is" } ,
new Language ( ) { Name = "kiswahili" , Value = "sw" } ,
new Language ( ) { Name = "Kreyòl ayisyen" , Value = "ht" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Latinus" , Value = "la" } ,
new Language ( ) { Name = "latviski" , Value = "lv" } ,
new Language ( ) { Name = "lietuvių" , Value = "lt" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Magyar" , Value = "hu" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Malti" , Value = "mt" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Melayu" , Value = "ms" } ,
new Language ( ) { Name = "Nederlands" , Value = "nl" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "norsk" , Value = "no" } ,
new Language ( ) { Name = "Polski" , Value = "pl" } ,
2022-05-29 21:08:47 +12:00
new Language ( ) { Name = "Português (Brasil)" , Value = "pt-BR" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "português (Portugal)" , Value = "pt-PT" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Română" , Value = "ro" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "shqiptare" , Value = "sq" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "Slovenščina" , Value = "sl" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "slovenský" , Value = "sk" } ,
new Language ( ) { Name = "Suorittaa loppuun" , Value = "fi" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "svenska" , Value = "sv" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Tiếng Việt" , Value = "vi" } ,
2022-05-29 21:08:47 +12:00
new Language ( ) { Name = "Türkçe " , Value = "tr" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "Ελληνικά" , Value = "el" } ,
new Language ( ) { Name = "беларуская" , Value = "bg" } ,
new Language ( ) { Name = "македонски" , Value = "mk" } ,
new Language ( ) { Name = "русский" , Value = "ru" } ,
new Language ( ) { Name = "Српски" , Value = "sr" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "український" , Value = "uk" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "ქართული" , Value = "ka" } ,
new Language ( ) { Name = "հայերեն" , Value = "hy" } ,
2022-05-30 00:47:53 +12:00
new Language ( ) { Name = "יידיש" , Value = "yi" } ,
2022-06-05 21:36:48 +12:00
new Language ( ) { Name = "עִברִית" , Value = "iw" } ,
new Language ( ) { Name = "اردو" , Value = "ur" } ,
new Language ( ) { Name = "عربي" , Value = "ar" } ,
new Language ( ) { Name = "فارسی" , Value = "fa" } ,
new Language ( ) { Name = "हिन्दी" , Value = "hi" } ,
new Language ( ) { Name = "ગુજરાતી" , Value = "gu" } ,
new Language ( ) { Name = "தமிழ்" , Value = "ta" } ,
new Language ( ) { Name = "తెలుగు" , Value = "te" } ,
new Language ( ) { Name = "ಕನ್ನಡ" , Value = "kn" } ,
new Language ( ) { Name = "ไทย" , Value = "th" } ,
new Language ( ) { Name = "ພາສາລາວ" , Value = "lo" } ,
new Language ( ) { Name = "ខ្មែរ" , Value = "km" } ,
new Language ( ) { Name = "한국어" , Value = "ko" } ,
new Language ( ) { Name = "中文(正體)" , Value = "zh-TW" } ,
new Language ( ) { Name = "中文(简体)" , Value = "zh-CN" } ,
new Language ( ) { Name = "日本語" , Value = "ja" } ,
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
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 ;
2022-02-12 04:10:35 +13:00
numericUpDownMenuWidth . Maximum = 8000 ;
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 ;
2022-02-08 04:41:30 +13:00
checkBoxSendHotkeyInsteadKillOtherInstances . Checked = Settings . Default . SendHotkeyInsteadKillOtherInstances ;
2022-01-08 03:49:33 +13:00
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
2022-05-03 05:55:15 +12:00
if ( DllImports . NativeMethods . IsTouchEnabled ( ) )
{
checkBoxDragDropItems . Checked = Settings . Default . DragDropItemsEnabledTouch ;
checkBoxSwipeScrolling . Checked = Settings . Default . SwipeScrollingEnabledTouch ;
}
else
{
checkBoxDragDropItems . Checked = Settings . Default . DragDropItemsEnabled ;
checkBoxSwipeScrolling . Checked = Settings . Default . SwipeScrollingEnabled ;
}
2022-06-11 04:41:49 +12:00
textBoxIcoFolder . Text = Settings . Default . PathIcoDirectory ;
2022-06-13 11:32:36 +12:00
radioButtonSortByTypeAndName . Checked = Settings . Default . SortByTypeAndNameWindowsExplorerSort ;
radioButtonSortByTypeAndDate . Checked = Settings . Default . SortByTypeAndDate ;
radioButtonSortByName . Checked = Settings . Default . SortByName ;
radioButtonSortByDate . Checked = Settings . Default . SortByDate ;
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 ;
2022-05-26 03:08:11 +12:00
textBoxSearchPattern . Text = Settings . Default . SearchPattern ;
2022-06-06 01:27:35 +12:00
checkBoxUseIconFromRootFolder . Checked = Settings . Default . UseIconFromRootFolder ;
2021-11-21 06:16:42 +13:00
checkBoxRoundCorners . Checked = Settings . Default . RoundCorners ;
2021-05-05 02:18:19 +12:00
checkBoxDarkModeAlwaysOn . Checked = Settings . Default . IsDarkModeAlwaysOn ;
2022-06-06 01:27:35 +12:00
checkBoxUseFading . Checked = Settings . Default . UseFading ;
2022-06-07 08:46:13 +12:00
checkBoxShowLinkOverlay . Checked = Settings . Default . ShowLinkOverlay ;
2022-06-01 09:23:26 +12:00
checkBoxShowDirectoryTitleAtTop . Checked = Settings . Default . ShowDirectoryTitleAtTop ;
checkBoxShowSearchBar . Checked = Settings . Default . ShowSearchBar ;
checkBoxShowCountOfElementsBelow . Checked = Settings . Default . ShowCountOfElementsBelow ;
checkBoxShowFunctionKeysBelow . Checked = Settings . Default . ShowFunctionKeysBelow ;
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
2022-06-06 01:27:35 +12:00
private static void AddSetFolderByWindowsContextMenu ( )
2021-10-11 04:33:54 +13:00
{
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 )
{
2022-05-30 02:41:23 +12:00
registryKeyContextMenu . SetValue ( string . Empty , Translator . GetText ( "Set as directory" ) ) ;
2021-10-11 04:33:54 +13:00
registryKeyContextMenu . SetValue ( "Icon" , binLocation ) ;
}
registryKeyContextMenuCommand = Registry . CurrentUser . CreateSubKey ( Command ) ;
if ( registryKeyContextMenuCommand ! = null )
{
registryKeyContextMenuCommand . SetValue ( string . Empty , binLocation + " \"%1\"" ) ;
}
2022-06-06 01:27:35 +12:00
Settings . Default . SetFolderByWindowsContextMenu = true ;
2021-10-11 04:33:54 +13:00
}
catch ( Exception ex )
{
2022-06-06 01:27:35 +12:00
Log . Warn ( "SaveSetFolderByWindowsContextMenu failed" , ex ) ;
2021-10-11 04:33:54 +13:00
}
finally
{
if ( registryKeyContextMenu ! = null )
{
registryKeyContextMenu . Close ( ) ;
}
if ( registryKeyContextMenuCommand ! = null )
{
registryKeyContextMenuCommand . Close ( ) ;
}
}
2021-05-05 07:59:55 +12:00
}
2022-06-06 01:27:35 +12:00
private static void RemoveSetFolderByWindowsContextMenu ( )
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 ) ;
}
2022-06-06 01:27:35 +12:00
Settings . Default . SetFolderByWindowsContextMenu = false ;
2021-06-06 22:00:06 +12:00
}
2021-10-11 04:33:54 +13:00
catch ( Exception ex )
{
2022-06-06 01:27:35 +12:00
Log . Warn ( "DeleteSetFolderByWindowsContextMenu failed" , ex ) ;
2021-10-11 04:33:54 +13:00
}
}
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 )
{
2022-06-06 01:27:35 +12:00
if ( checkBoxSetFolderByWindowsContextMenu . Checked )
2021-10-24 00:45:22 +13:00
{
2022-06-06 01:27:35 +12:00
AddSetFolderByWindowsContextMenu ( ) ;
2021-10-24 00:45:22 +13:00
}
2022-06-06 01:27:35 +12:00
else
2020-07-08 03:05:19 +12:00
{
2022-06-06 01:27:35 +12:00
RemoveSetFolderByWindowsContextMenu ( ) ;
2020-07-08 03:05:19 +12:00
}
2021-04-26 02:22:53 +12:00
2022-06-06 01:39:54 +12:00
Settings . Default . SaveLogFileInApplicationDirectory = checkBoxSaveLogFileInApplicationDirectory . Checked ;
if ( Settings . Default . SaveLogFileInApplicationDirectory )
2020-07-08 03:05:19 +12:00
{
2022-06-06 01:27:35 +12:00
try
{
string fileNameToCheckWriteAccess = "CheckWriteAccess" ;
File . WriteAllText ( fileNameToCheckWriteAccess , fileNameToCheckWriteAccess ) ;
File . Delete ( fileNameToCheckWriteAccess ) ;
Settings . Default . SaveLogFileInApplicationDirectory = true ;
}
catch ( Exception ex )
{
Settings . Default . SaveLogFileInApplicationDirectory = false ;
Log . Warn ( $"Failed to save log file in application folder {Log.GetLogFilePath()}" , ex ) ;
}
2021-09-23 22:00:50 +12:00
}
2022-06-06 01:27:35 +12:00
if ( ! IsStartupTask ( ) )
2021-09-23 22:00:50 +12:00
{
2022-06-06 01:27:35 +12:00
if ( checkBoxAutostart . Checked )
2021-09-23 22:00:50 +12:00
{
2022-06-06 01:27:35 +12:00
RegistryKey key = Registry . CurrentUser . OpenSubKey (
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" , true ) ;
key . SetValue (
Assembly . GetExecutingAssembly ( ) . GetName ( ) . Name ,
Environment . ProcessPath ) ;
Settings . Default . IsAutostartActivated = true ;
2021-09-23 22:00:50 +12:00
}
else
{
2022-06-06 01:27:35 +12:00
RegistryKey key = Registry . CurrentUser . OpenSubKey (
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run" , true ) ;
key . DeleteValue ( "SystemTrayMenu" , false ) ;
Settings . Default . IsAutostartActivated = false ;
2021-09-23 22:00:50 +12:00
}
2020-07-08 03:05:19 +12:00
}
2022-06-06 01:27:35 +12:00
Settings . Default . HotKey = new KeysConverter ( ) . ConvertToInvariantString ( textBoxHotkey . Hotkey | textBoxHotkey . HotkeyModifiers ) ;
Settings . Default . CurrentCultureInfoName = comboBoxLanguage . SelectedValue . ToString ( ) ;
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 ;
2022-02-08 04:41:30 +13:00
Settings . Default . SendHotkeyInsteadKillOtherInstances = checkBoxSendHotkeyInsteadKillOtherInstances . Checked ;
2022-01-08 03:49:33 +13:00
Settings . Default . OpenItemWithOneClick = checkBoxOpenItemWithOneClick . Checked ;
2022-01-16 00:07:02 +13:00
Settings . Default . OpenDirectoryWithOneClick = checkBoxOpenDirectoryWithOneClick . Checked ;
2022-05-03 05:55:15 +12:00
if ( DllImports . NativeMethods . IsTouchEnabled ( ) )
{
Settings . Default . DragDropItemsEnabledTouch = checkBoxDragDropItems . Checked ;
Settings . Default . SwipeScrollingEnabledTouch = checkBoxSwipeScrolling . Checked ;
}
else
{
Settings . Default . DragDropItemsEnabled = checkBoxDragDropItems . Checked ;
Settings . Default . SwipeScrollingEnabled = checkBoxSwipeScrolling . Checked ;
}
2022-06-11 04:41:49 +12:00
Settings . Default . PathIcoDirectory = textBoxIcoFolder . Text ;
2022-06-13 11:32:36 +12:00
Settings . Default . SortByTypeAndNameWindowsExplorerSort = radioButtonSortByTypeAndName . Checked ;
Settings . Default . SortByTypeAndDate = radioButtonSortByTypeAndDate . Checked ;
Settings . Default . SortByName = radioButtonSortByName . Checked ;
Settings . Default . SortByDate = radioButtonSortByDate . 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-05-26 03:08:11 +12:00
Settings . Default . PathsAddToMainMenu = string . Empty ;
foreach ( DataGridViewRow row in dataGridViewFolders . Rows )
2022-01-08 03:49:33 +13:00
{
2022-05-26 03:08:11 +12:00
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}|" ;
2022-01-08 03:49:33 +13:00
}
2022-05-26 03:08:11 +12:00
Settings . Default . GenerateShortcutsToDrives = checkBoxGenerateShortcutsToDrives . Checked ;
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 ;
2022-05-26 03:08:11 +12:00
Settings . Default . CacheMainMenu = checkBoxCacheMainMenu . Checked ;
Settings . Default . ClearCacheIfMoreThanThisNumberOfItems = ( int ) numericUpDownClearCacheIfMoreThanThisNumberOfItems . Value ;
Settings . Default . SearchPattern = textBoxSearchPattern . Text ;
2021-06-06 09:57:36 +12:00
2022-06-06 01:27:35 +12:00
Settings . Default . UseIconFromRootFolder = checkBoxUseIconFromRootFolder . Checked ;
2021-11-21 06:16:42 +13:00
Settings . Default . RoundCorners = checkBoxRoundCorners . Checked ;
2021-05-05 02:18:19 +12:00
Settings . Default . IsDarkModeAlwaysOn = checkBoxDarkModeAlwaysOn . Checked ;
2022-06-06 01:27:35 +12:00
Settings . Default . UseFading = checkBoxUseFading . Checked ;
2022-06-07 08:46:13 +12:00
Settings . Default . ShowLinkOverlay = checkBoxShowLinkOverlay . Checked ;
2022-06-01 09:23:26 +12:00
Settings . Default . ShowDirectoryTitleAtTop = checkBoxShowDirectoryTitleAtTop . Checked ;
Settings . Default . ShowSearchBar = checkBoxShowSearchBar . Checked ;
Settings . Default . ShowCountOfElementsBelow = checkBoxShowCountOfElementsBelow . Checked ;
Settings . Default . ShowFunctionKeysBelow = checkBoxShowFunctionKeysBelow . Checked ;
2021-05-09 19:52:37 +12:00
2022-06-06 01:27:35 +12:00
if ( checkBoxSaveConfigInApplicationDirectory . Checked )
2021-05-09 19:52:37 +12:00
{
CustomSettingsProvider . ActivateConfigPathAssembly ( ) ;
2022-02-08 08:22:38 +13:00
TrySettingsDefaultSave ( ) ;
2021-05-09 19:52:37 +12:00
}
else
{
2022-02-08 08:22:38 +13:00
TrySettingsDefaultSave ( ) ;
2021-05-09 19:52:37 +12:00
CustomSettingsProvider . DeactivateConfigPathAssembly ( ) ;
}
2022-02-08 08:22:38 +13:00
static void TrySettingsDefaultSave ( )
{
try
{
Settings . Default . Save ( ) ;
}
catch ( Exception ex )
{
2022-06-06 01:27:35 +12:00
Log . Warn ( $"Failed to save configuration file in application folder {CustomSettingsProvider.ConfigPathAssembly}" , ex ) ;
2022-02-08 08:22:38 +13:00
}
}
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 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 )
{
2022-04-30 21:51:50 +12:00
if ( ! string . IsNullOrEmpty ( Config . Path ) )
{
Settings . Default . PathDirectory = Path . GetRelativePath (
Directory . GetParent ( Assembly . GetEntryAssembly ( ) . Location ) . FullName ,
Config . Path ) ;
textBoxFolder . Text = Config . Path ;
}
2021-05-09 19:52:37 +12:00
}
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
2022-06-11 04:41:49 +12:00
private void ButtonChangeIcoFolder_Click ( object sender , EventArgs e )
{
Config . SetFolderIcoByUser ( ) ;
textBoxIcoFolder . Text = Settings . Default . PathIcoDirectory ;
}
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 ;
2022-06-01 09:23:26 +12:00
numericUpDownMenuHeight . Value = 450 ;
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-02-07 02:36:35 +13:00
checkBoxShowInTaskbar . Checked = true ;
2022-02-08 04:41:30 +13:00
checkBoxSendHotkeyInsteadKillOtherInstances . Checked = false ;
2022-01-28 08:44:20 +13:00
checkBoxOpenItemWithOneClick . Checked = true ;
2022-06-07 00:00:17 +12:00
checkBoxOpenDirectoryWithOneClick . Checked = false ;
2022-06-11 04:41:49 +12:00
if ( DllImports . NativeMethods . IsTouchEnabled ( ) )
{
checkBoxDragDropItems . Checked = false ;
checkBoxSwipeScrolling . Checked = true ;
}
else
{
checkBoxDragDropItems . Checked = true ;
checkBoxSwipeScrolling . Checked = false ;
}
2022-01-08 03:49:33 +13:00
2022-06-11 04:41:49 +12:00
textBoxIcoFolder . Text = Path . Combine (
Path . Combine (
Environment . GetFolderPath (
Environment . SpecialFolder . ApplicationData ) , $"SystemTrayMenu" ) , "ico" ) ;
if ( ! Directory . Exists ( Settings . Default . PathIcoDirectory ) )
{
Directory . CreateDirectory ( Settings . Default . PathIcoDirectory ) ;
}
2022-03-29 21:52:10 +13:00
radioButtonSortByName . Checked = true ;
radioButtonSortByDate . Checked = false ;
2022-06-11 04:41:49 +12: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 ;
2022-05-26 03:08:11 +12:00
textBoxSearchPattern . Text = string . Empty ;
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 )
{
2022-06-06 01:27:35 +12:00
checkBoxUseIconFromRootFolder . Checked = false ;
2022-06-01 09:23:26 +12:00
checkBoxRoundCorners . Checked = false ;
checkBoxUseFading . Checked = false ;
2022-02-05 11:40:07 +13:00
checkBoxDarkModeAlwaysOn . Checked = true ;
2022-06-07 08:46:13 +12:00
checkBoxShowLinkOverlay . Checked = false ;
2022-06-01 09:23:26 +12:00
checkBoxShowDirectoryTitleAtTop . Checked = false ;
checkBoxShowSearchBar . Checked = true ;
checkBoxShowCountOfElementsBelow . Checked = false ;
checkBoxShowFunctionKeysBelow . Checked = false ;
2022-02-05 11:40:07 +13:00
}
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
}
}