diff --git a/mRemoteNG/Config/Settings/Registry/CommonRegistrySettings.cs b/mRemoteNG/Config/Settings/Registry/CommonRegistrySettings.cs index 6377f02a..7174d9aa 100644 --- a/mRemoteNG/Config/Settings/Registry/CommonRegistrySettings.cs +++ b/mRemoteNG/Config/Settings/Registry/CommonRegistrySettings.cs @@ -61,6 +61,25 @@ namespace mRemoteNG.Config.Settings.Registry #endregion + #region general notification registry settings + + /// + /// Specifies whether logging to a file is allowed or not. + /// + public static bool AllowLogging { get; } + + /// + /// Specifies whether notifications are allowed or not. + /// + public static bool AllowNotifications { get; } + + /// + /// Specifies whether pop-up notifications are allowed or not. + /// + public static bool AllowPopups { get; } + + #endregion + static CommonRegistrySettings() { IRegistryRead regValueUtility = new WinRegistry(); @@ -87,6 +106,17 @@ namespace mRemoteNG.Config.Settings.Registry AllowSaveUsernames = regValueUtility.GetBoolValue(hive, credentialSubkey, nameof(AllowSaveUsernames), true); #endregion + + #region notification registry settings + + string notificationSubkey = WindowsRegistryInfo.Notification; + + AllowLogging = regValueUtility.GetBoolValue(hive, notificationSubkey, nameof(AllowLogging), true); + AllowNotifications = regValueUtility.GetBoolValue(hive, notificationSubkey, nameof(AllowNotifications), true); + AllowPopups = regValueUtility.GetBoolValue(hive, notificationSubkey, nameof(AllowPopups), true); + + #endregion + } } } \ No newline at end of file diff --git a/mRemoteNG/Config/Settings/Registry/OptRegistryAppearancePage.cs b/mRemoteNG/Config/Settings/Registry/OptRegistryAppearancePage.cs new file mode 100644 index 00000000..8fde136c --- /dev/null +++ b/mRemoteNG/Config/Settings/Registry/OptRegistryAppearancePage.cs @@ -0,0 +1,101 @@ +using System.Runtime.Versioning; +using Microsoft.Win32; +using mRemoteNG.App.Info; +using mRemoteNG.Tools.WindowsRegistry; + +namespace mRemoteNG.Config.Settings.Registry +{ + [SupportedOSPlatform("windows")] + public sealed partial class OptRegistryAppearancePage + { + /// + /// Specifies whether to show tooltips with descriptions in the connection tree view. + /// + public WinRegistryEntry ShowDescriptionTooltipsInConTree { get; private set; } + + /// + /// Specifies whether to show complete connection path in the window title. + /// + public WinRegistryEntry ShowCompleteConFilePathInTitle { get; private set; } + + /// + /// Specifies whether to always show the system tray icon. + /// + public WinRegistryEntry AlwaysShowSystemTrayIcon { get; private set; } + + /// + /// Specifies whether the application should minimize to the system tray. + /// + public WinRegistryEntry MinimizeToTray { get; private set; } + + /// + /// Specifies whether the application should close to the system tray. + /// + public WinRegistryEntry CloseToTray { get; private set; } + + public OptRegistryAppearancePage() + { + RegistryHive hive = WindowsRegistryInfo.Hive; + string subKey = WindowsRegistryInfo.AppearanceOptions; + + ShowDescriptionTooltipsInConTree = new WinRegistryEntry(hive, subKey, nameof(ShowDescriptionTooltipsInConTree)).Read(); + ShowCompleteConFilePathInTitle = new WinRegistryEntry(hive, subKey, nameof(ShowCompleteConFilePathInTitle)).Read(); + AlwaysShowSystemTrayIcon = new WinRegistryEntry(hive, subKey, nameof(AlwaysShowSystemTrayIcon)).Read(); + MinimizeToTray = new WinRegistryEntry(hive, subKey, nameof(MinimizeToTray)).Read(); + CloseToTray = new WinRegistryEntry(hive, subKey, nameof(CloseToTray)).Read(); + + SetupValidation(); + Apply(); + } + + /// + /// Configures validation settings for various parameters + /// + private void SetupValidation() + { + + } + + /// + /// Applies registry settings and overrides various properties. + /// + private void Apply() + { + ApplyShowDescriptionTooltipsInConTree(); + ApplyShowCompleteConFilePathInTitle(); + ApplyAlwaysShowSystemTrayIcon(); + ApplyMinimizeToTray(); + ApplyCloseToTray(); + } + + private void ApplyShowDescriptionTooltipsInConTree() + { + if (ShowDescriptionTooltipsInConTree.IsSet) + Properties.OptionsAppearancePage.Default.ShowDescriptionTooltipsInTree = ShowDescriptionTooltipsInConTree.Value; + } + + private void ApplyShowCompleteConFilePathInTitle() + { + if (ShowCompleteConFilePathInTitle.IsSet) + Properties.OptionsAppearancePage.Default.ShowCompleteConsPathInTitle = ShowCompleteConFilePathInTitle.Value; + } + + private void ApplyAlwaysShowSystemTrayIcon() + { + if (AlwaysShowSystemTrayIcon.IsSet) + Properties.OptionsAppearancePage.Default.ShowSystemTrayIcon = AlwaysShowSystemTrayIcon.Value; + } + + private void ApplyMinimizeToTray() + { + if (MinimizeToTray.IsSet) + Properties.OptionsAppearancePage.Default.MinimizeToTray = MinimizeToTray.Value; + } + + private void ApplyCloseToTray() + { + if (CloseToTray.IsSet) + Properties.OptionsAppearancePage.Default.CloseToTray = CloseToTray.Value; + } + } +} \ No newline at end of file diff --git a/mRemoteNG/Config/Settings/Registry/OptRegistryNotificationsPage.cs b/mRemoteNG/Config/Settings/Registry/OptRegistryNotificationsPage.cs new file mode 100644 index 00000000..d0eeecef --- /dev/null +++ b/mRemoteNG/Config/Settings/Registry/OptRegistryNotificationsPage.cs @@ -0,0 +1,314 @@ +using System.IO; +using System.Linq; +using System.Runtime.Versioning; +using Microsoft.Win32; +using mRemoteNG.App.Info; +using mRemoteNG.Tools.WindowsRegistry; + +namespace mRemoteNG.Config.Settings.Registry +{ + [SupportedOSPlatform("windows")] + public sealed partial class OptRegistryNotificationsPage + { + + #region Notification Panel Settings + + /// + /// Specifies whether debug messages are written to the notification panel. + /// + public WinRegistryEntry NfpWriteDebugMsgs { get; private set; } + + /// + /// Specifies whether information messages are written to the notification panel. + /// + public WinRegistryEntry NfpWriteInfoMsgs { get; private set; } + + /// + /// Specifies whether warning messages are written to the notification panel. + /// + public WinRegistryEntry NfpWriteWarningMsgs { get; private set; } + + /// + /// Specifies whether error messages are written to the notification panel. + /// + public WinRegistryEntry NfpWriteErrorMsgs { get; private set; } + + /// + /// Specifies whether to switch to notification panel when information messages are received. + /// + public WinRegistryEntry SwitchToMCOnInformation { get; private set; } + + /// + /// Specifies whether to switch to notification panel when warning messages are received. + /// + public WinRegistryEntry SwitchToMCOnWarning { get; private set; } + + /// + /// Specifies whether to switch to notification panel when error messages are received. + /// + public WinRegistryEntry SwitchToMCOnError { get; private set; } + + #endregion + + #region Logging Panel Settings + + /// + /// Specifies whether logs should be written to the application directory. + /// + public WinRegistryEntry LogToApplicationDirectory { get; private set; } + + /// + /// Specifies the file path for logging. + /// + public WinRegistryEntry LogFilePath { get; private set; } + + /// + /// Specifies whether debug messages should be written to the text log. + /// + public WinRegistryEntry LfWriteDebugMsgs { get; private set; } + + /// + /// Specifies whether information messages should be written to the text log. + /// + public WinRegistryEntry LfWriteInfoMsgs { get; private set; } + + /// + /// Specifies whether warning messages should be written to the text log. + /// + public WinRegistryEntry LfWriteWarningMsgs { get; private set; } + + /// + /// Specifies whether error messages should be written to the text log. + /// + public WinRegistryEntry LfWriteErrorMsgs { get; private set; } + + #endregion + + #region Popup Panel Settings + + /// + /// Specifies whether debug messages should be displayed as popups. + /// + public WinRegistryEntry PuWriteDebugMsgs { get; private set; } + + /// + /// Specifies whether information messages should be displayed as popups. + /// + public WinRegistryEntry PuWriteInfoMsgs { get; private set; } + + /// + /// Specifies whether warning messages should be displayed as popups. + /// + public WinRegistryEntry PuWriteWarningMsgs { get; private set; } + + /// + /// Specifies whether error messages should be displayed as popups. + /// + public WinRegistryEntry PuWriteErrorMsgs { get; private set; } + + #endregion + + public OptRegistryNotificationsPage() + { + IRegistryRead regValueUtility = new WinRegistry(); + RegistryHive hive = WindowsRegistryInfo.Hive; + string subKey = WindowsRegistryInfo.NotificationOptions; + + // Notification Panel Settings + NfpWriteDebugMsgs = new WinRegistryEntry(hive, subKey, nameof(NfpWriteDebugMsgs)).Read(); + NfpWriteInfoMsgs = new WinRegistryEntry(hive, subKey, nameof(NfpWriteInfoMsgs)).Read(); + NfpWriteWarningMsgs = new WinRegistryEntry(hive, subKey, nameof(NfpWriteWarningMsgs)).Read(); + NfpWriteErrorMsgs = new WinRegistryEntry(hive, subKey, nameof(NfpWriteErrorMsgs)).Read(); + SwitchToMCOnInformation = new WinRegistryEntry(hive, subKey, nameof(SwitchToMCOnInformation)).Read(); + SwitchToMCOnWarning = new WinRegistryEntry(hive, subKey, nameof(SwitchToMCOnWarning)).Read(); + SwitchToMCOnError = new WinRegistryEntry(hive, subKey, nameof(SwitchToMCOnError)).Read(); + + // Logging Panel Settings + LogToApplicationDirectory = new WinRegistryEntry(hive, subKey, nameof(LogToApplicationDirectory)).Read(); + LogFilePath = new WinRegistryEntry(hive, subKey, nameof(LogFilePath)).Read(); + LfWriteDebugMsgs = new WinRegistryEntry(hive, subKey, nameof(LfWriteDebugMsgs)).Read(); + LfWriteInfoMsgs = new WinRegistryEntry(hive, subKey, nameof(LfWriteInfoMsgs)).Read(); + LfWriteWarningMsgs = new WinRegistryEntry(hive, subKey, nameof(LfWriteWarningMsgs)).Read(); + LfWriteErrorMsgs = new WinRegistryEntry(hive, subKey, nameof(LfWriteErrorMsgs)).Read(); + + // Popup Panel Settings + PuWriteDebugMsgs = new WinRegistryEntry(hive, subKey, nameof(PuWriteDebugMsgs)).Read(); + PuWriteInfoMsgs = new WinRegistryEntry(hive, subKey, nameof(PuWriteInfoMsgs)).Read(); + PuWriteWarningMsgs = new WinRegistryEntry(hive, subKey, nameof(PuWriteWarningMsgs)).Read(); + PuWriteErrorMsgs = new WinRegistryEntry(hive, subKey, nameof(PuWriteErrorMsgs)).Read(); + + SetupValidation(); + Apply(); + } + + /// + /// Configures validation settings for various parameters + /// + private void SetupValidation() + { + + } + + /// + /// Applies registry settings and overrides various properties. + /// + private void Apply() + { + LoadNotificationPanelSettings(); + LoadLoggingPanelSettings(); + LoadPopupPanelSettings(); + } + + private void LoadNotificationPanelSettings() + { + // AllowNotifications reg setting: if false disable + if (!CommonRegistrySettings.AllowNotifications) + { + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteDebugMsgs = false; + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteInfoMsgs = false; + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteWarningMsgs = false; + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteErrorMsgs = false; + + Properties.OptionsNotificationsPage.Default.SwitchToMCOnInformation = false; + Properties.OptionsNotificationsPage.Default.SwitchToMCOnWarning = false; + Properties.OptionsNotificationsPage.Default.SwitchToMCOnError = false; + return; + } + + // NfpWriteDebugMsgs reg setting: set NotificationPanelWriterWriteDebugMsgs option based on value + if (NfpWriteDebugMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteDebugMsgs = NfpWriteDebugMsgs.Value; + + // NfpWriteInfoMsgs reg setting: set NotificationPanelWriterWriteInfoMsgs option based on value + if (NfpWriteInfoMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteInfoMsgs = NfpWriteInfoMsgs.Value; + + // NfpWriteWarningMsgs reg setting: set NotificationPanelWriterWriteWarningMsgs option based on value + if (NfpWriteWarningMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteWarningMsgs = NfpWriteWarningMsgs.Value; + + // NfpWriteErrorMsgs reg setting: set NotificationPanelWriterWriteErrorMsgs option based on value + if (NfpWriteErrorMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.NotificationPanelWriterWriteErrorMsgs = NfpWriteErrorMsgs.Value; + + // SwitchToMCOnInformation reg setting: set SwitchToMCOnInformation option based on value + if (SwitchToMCOnInformation.IsSet) + Properties.OptionsNotificationsPage.Default.SwitchToMCOnInformation = SwitchToMCOnInformation.Value; + + // SwitchToMCOnWarning reg setting: set SwitchToMCOnWarning option based on value + if (SwitchToMCOnWarning.IsSet) + Properties.OptionsNotificationsPage.Default.SwitchToMCOnWarning = SwitchToMCOnWarning.Value; + + // SwitchToMCOnError reg setting: set SwitchToMCOnError option based on value + if (SwitchToMCOnError.IsSet) + Properties.OptionsNotificationsPage.Default.SwitchToMCOnError = SwitchToMCOnError.Value; + } + + private void LoadLoggingPanelSettings() + { + // AllowLogging reg setting: if false disable + if (!CommonRegistrySettings.AllowLogging) + { + Properties.OptionsNotificationsPage.Default.LogToApplicationDirectory = true; + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteDebugMsgs = false; + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteInfoMsgs = false; + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteWarningMsgs = false; + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteErrorMsgs = false; + return; + } + + // LogToApplicationDirectory reg setting: set LogToApplicationDirectory option based on value + if (LogToApplicationDirectory.IsSet) + Properties.OptionsNotificationsPage.Default.LogToApplicationDirectory = LogToApplicationDirectory.Value; + + // LogFilePath reg setting: + // 1. Check that configured path is valid + // 2. Set LogFilePath value + // 3. Ensure LogToApplicationDirectory is false + // 4. Disable all controls + if (LogFilePath.IsSet && PathIsValid(LogFilePath.Value)) + { + Properties.OptionsNotificationsPage.Default.LogFilePath = LogFilePath.Value; + Properties.OptionsNotificationsPage.Default.LogToApplicationDirectory = false; + } + + // LfWriteDebugMsgs reg setting: set TextLogMessageWriterWriteDebugMsgs option based on value + if (LfWriteDebugMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteDebugMsgs = LfWriteDebugMsgs.Value; + + // LfWriteInfoMsgs reg setting: set TextLogMessageWriterWriteInfoMsgs option based on value + if (LfWriteInfoMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteInfoMsgs = LfWriteInfoMsgs.Value; + + // LfWriteWarningMsgs reg setting: set TextLogMessageWriterWriteWarningMsgs option based on value + if (LfWriteWarningMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteWarningMsgs = LfWriteWarningMsgs.Value; + + // LfWriteErrorMsgs reg setting: set TextLogMessageWriterWriteErrorMsgs option based on value + if (LfWriteErrorMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.TextLogMessageWriterWriteErrorMsgs = LfWriteErrorMsgs.Value; + } + + private void LoadPopupPanelSettings() + { + // AllowPopups reg setting: if false disable + if (!CommonRegistrySettings.AllowPopups) + { + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteDebugMsgs = false; + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteInfoMsgs = false; + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteWarningMsgs = false; + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteErrorMsgs = false; + return; + } + + // PuWriteDebugMsgs reg setting: set PopupMessageWriterWriteDebugMsgs option based on value + if (PuWriteDebugMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteDebugMsgs = PuWriteDebugMsgs.Value; + + // PuWriteInfoMsgs reg setting: set PopupMessageWriterWriteInfoMsgs option based on value + if (PuWriteInfoMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteInfoMsgs = PuWriteInfoMsgs.Value; + + // PuWriteWarningMsgs reg setting: set PopupMessageWriterWriteWarningMsgs option based on value + if (PuWriteWarningMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteWarningMsgs = PuWriteWarningMsgs.Value; + + // PuWriteErrorMsgs reg setting: set PopupMessageWriterWriteErrorMsgs option based on value + if (PuWriteErrorMsgs.IsSet) + Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteErrorMsgs = PuWriteErrorMsgs.Value; + } + + /// + /// Validates if a path is a valid absolute path to a file from the root of a drive. + /// + /// The path to validate. + /// True if the path is valid; otherwise, false. + private static bool PathIsValid(string path) + { + // Check if the path is rooted in a drive + if (string.IsNullOrEmpty(path) || !Path.IsPathRooted(path) || path.Length < 3) + return false; + + // Convert the path to uppercase for case-insensitive comparison + path = path.ToUpper(); + + // Check if the drive letter is valid + char driveLetter = path[0]; + if (!char.IsLetter(driveLetter) || path[1] != ':' || path[2] != '\\') + return false; + + // Check if such driver exists + if (!DriveInfo.GetDrives().Any(drive => drive.Name[0] == driveLetter)) + return false; + + // Check if the rest of the path is valid + string invalidFileNameChars = new string(Path.GetInvalidPathChars()) + @":/?*""<>|"; + if (path.Substring(3).Any(ch => invalidFileNameChars.Contains(ch))) + return false; + if (path.EndsWith(".")) + return false; + + return true; + } + } +} \ No newline at end of file diff --git a/mRemoteNG/Config/Settings/Registry/OptRegistryStartupExitPage.cs b/mRemoteNG/Config/Settings/Registry/OptRegistryStartupExitPage.cs new file mode 100644 index 00000000..b3462720 --- /dev/null +++ b/mRemoteNG/Config/Settings/Registry/OptRegistryStartupExitPage.cs @@ -0,0 +1,97 @@ +using System.Runtime.Versioning; +using Microsoft.Win32; +using mRemoteNG.App.Info; +using mRemoteNG.Tools.WindowsRegistry; + +namespace mRemoteNG.Config.Settings.Registry +{ + [SupportedOSPlatform("windows")] + public sealed partial class OptRegistryStartupExitPage + { + /// + /// Specifies whether the application should start minimized or fullscreen. + /// + /// /// + /// Default value is null, which has no effect. + /// + public WinRegistryEntry StartupBehavior { get; private set; } + + /// + /// Specifies whether sessions should be automatically reconnected on application startup. + /// + public WinRegistryEntry OpenConnectionsFromLastSession { get; private set; } + + /// + /// Ensures that only a single instance of the application is allowed to run. + /// + public WinRegistryEntry EnforceSingleApplicationInstance { get; private set; } + + public OptRegistryStartupExitPage() + { + RegistryHive hive = WindowsRegistryInfo.Hive; + string subKey = WindowsRegistryInfo.StartupExitOptions; + + StartupBehavior = new WinRegistryEntry(hive, subKey, nameof(StartupBehavior)).Read(); + OpenConnectionsFromLastSession = new WinRegistryEntry(hive, subKey, nameof(OpenConnectionsFromLastSession)).Read(); + EnforceSingleApplicationInstance = new WinRegistryEntry(hive, subKey, nameof(EnforceSingleApplicationInstance)).Read(); + + SetupValidation(); + Apply(); + } + + /// + /// Configures validation settings for various parameters + /// + private void SetupValidation() + { + StartupBehavior.SetValidation( + new string[] { + "None", + "Minimized", + "FullScreen" + }); + } + + /// + /// Applies registry settings and overrides various properties. + /// + private void Apply() + { + ApplyStartupBehavior(); + ApplyOpenConnectionsFromLastSession(); + ApplyEnforceSingleApplicationInstance(); + } + + private void ApplyStartupBehavior() + { + if (StartupBehavior.IsSet) + { + switch (StartupBehavior.Value) + { + case "None": + Properties.OptionsStartupExitPage.Default.StartMinimized = false; + Properties.OptionsStartupExitPage.Default.StartFullScreen = false; + break; + case "Minimized": + Properties.OptionsStartupExitPage.Default.StartMinimized = true; + break; + case "FullScreen": + Properties.OptionsStartupExitPage.Default.StartFullScreen = true; + break; + } + } + } + + private void ApplyOpenConnectionsFromLastSession() + { + if (OpenConnectionsFromLastSession.IsSet) + Properties.OptionsStartupExitPage.Default.OpenConsFromLastSession = OpenConnectionsFromLastSession.Value; + } + + private void ApplyEnforceSingleApplicationInstance() + { + if (EnforceSingleApplicationInstance.IsSet) + Properties.OptionsStartupExitPage.Default.SingleInstance = EnforceSingleApplicationInstance.Value; + } + } +} \ No newline at end of file diff --git a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.Designer.cs b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.Designer.cs index e6ce7935..f01ef3b7 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.Designer.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.Designer.cs @@ -42,12 +42,15 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkShowSystemTrayIcon = new MrngCheckBox(); chkMinimizeToSystemTray = new MrngCheckBox(); chkCloseToSystemTray = new MrngCheckBox(); + pnlOptions = new System.Windows.Forms.Panel(); + lblRegistrySettingsUsedInfo = new System.Windows.Forms.Label(); + pnlOptions.SuspendLayout(); SuspendLayout(); // // lblLanguageRestartRequired // lblLanguageRestartRequired.AutoSize = true; - lblLanguageRestartRequired.Location = new System.Drawing.Point(8, 61); + lblLanguageRestartRequired.Location = new System.Drawing.Point(3, 59); lblLanguageRestartRequired.Name = "lblLanguageRestartRequired"; lblLanguageRestartRequired.Size = new System.Drawing.Size(414, 13); lblLanguageRestartRequired.TabIndex = 2; @@ -58,7 +61,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages cboLanguage._mice = MrngComboBox.MouseState.HOVER; cboLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cboLanguage.FormattingEnabled = true; - cboLanguage.Location = new System.Drawing.Point(8, 29); + cboLanguage.Location = new System.Drawing.Point(3, 27); cboLanguage.Name = "cboLanguage"; cboLanguage.Size = new System.Drawing.Size(304, 21); cboLanguage.Sorted = true; @@ -67,7 +70,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // lblLanguage // lblLanguage.AutoSize = true; - lblLanguage.Location = new System.Drawing.Point(8, 8); + lblLanguage.Location = new System.Drawing.Point(3, 6); lblLanguage.Name = "lblLanguage"; lblLanguage.Size = new System.Drawing.Size(58, 13); lblLanguage.TabIndex = 0; @@ -78,7 +81,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkShowFullConnectionsFilePathInTitle._mice = MrngCheckBox.MouseState.OUT; chkShowFullConnectionsFilePathInTitle.AutoSize = true; chkShowFullConnectionsFilePathInTitle.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkShowFullConnectionsFilePathInTitle.Location = new System.Drawing.Point(8, 132); + chkShowFullConnectionsFilePathInTitle.Location = new System.Drawing.Point(3, 130); chkShowFullConnectionsFilePathInTitle.Name = "chkShowFullConnectionsFilePathInTitle"; chkShowFullConnectionsFilePathInTitle.Size = new System.Drawing.Size(268, 17); chkShowFullConnectionsFilePathInTitle.TabIndex = 4; @@ -90,7 +93,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkShowDescriptionTooltipsInTree._mice = MrngCheckBox.MouseState.OUT; chkShowDescriptionTooltipsInTree.AutoSize = true; chkShowDescriptionTooltipsInTree.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkShowDescriptionTooltipsInTree.Location = new System.Drawing.Point(8, 109); + chkShowDescriptionTooltipsInTree.Location = new System.Drawing.Point(3, 107); chkShowDescriptionTooltipsInTree.Name = "chkShowDescriptionTooltipsInTree"; chkShowDescriptionTooltipsInTree.Size = new System.Drawing.Size(256, 17); chkShowDescriptionTooltipsInTree.TabIndex = 3; @@ -102,7 +105,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkShowSystemTrayIcon._mice = MrngCheckBox.MouseState.OUT; chkShowSystemTrayIcon.AutoSize = true; chkShowSystemTrayIcon.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkShowSystemTrayIcon.Location = new System.Drawing.Point(8, 178); + chkShowSystemTrayIcon.Location = new System.Drawing.Point(3, 176); chkShowSystemTrayIcon.Name = "chkShowSystemTrayIcon"; chkShowSystemTrayIcon.Size = new System.Drawing.Size(178, 17); chkShowSystemTrayIcon.TabIndex = 5; @@ -114,7 +117,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkMinimizeToSystemTray._mice = MrngCheckBox.MouseState.OUT; chkMinimizeToSystemTray.AutoSize = true; chkMinimizeToSystemTray.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkMinimizeToSystemTray.Location = new System.Drawing.Point(8, 201); + chkMinimizeToSystemTray.Location = new System.Drawing.Point(3, 199); chkMinimizeToSystemTray.Name = "chkMinimizeToSystemTray"; chkMinimizeToSystemTray.Size = new System.Drawing.Size(147, 17); chkMinimizeToSystemTray.TabIndex = 6; @@ -126,29 +129,53 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkCloseToSystemTray._mice = MrngCheckBox.MouseState.OUT; chkCloseToSystemTray.AutoSize = true; chkCloseToSystemTray.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkCloseToSystemTray.Location = new System.Drawing.Point(8, 224); + chkCloseToSystemTray.Location = new System.Drawing.Point(3, 222); chkCloseToSystemTray.Name = "chkCloseToSystemTray"; chkCloseToSystemTray.Size = new System.Drawing.Size(129, 17); chkCloseToSystemTray.TabIndex = 7; chkCloseToSystemTray.Text = "Close to System Tray"; chkCloseToSystemTray.UseVisualStyleBackColor = true; // + // pnlOptions + // + pnlOptions.Controls.Add(cboLanguage); + pnlOptions.Controls.Add(chkCloseToSystemTray); + pnlOptions.Controls.Add(chkMinimizeToSystemTray); + pnlOptions.Controls.Add(lblLanguageRestartRequired); + pnlOptions.Controls.Add(chkShowSystemTrayIcon); + pnlOptions.Controls.Add(chkShowDescriptionTooltipsInTree); + pnlOptions.Controls.Add(lblLanguage); + pnlOptions.Controls.Add(chkShowFullConnectionsFilePathInTitle); + pnlOptions.Dock = System.Windows.Forms.DockStyle.Top; + pnlOptions.Location = new System.Drawing.Point(0, 30); + pnlOptions.Name = "pnlOptions"; + pnlOptions.Size = new System.Drawing.Size(610, 267); + pnlOptions.TabIndex = 8; + // + // lblRegistrySettingsUsedInfo + // + lblRegistrySettingsUsedInfo.BackColor = System.Drawing.SystemColors.ControlLight; + lblRegistrySettingsUsedInfo.Dock = System.Windows.Forms.DockStyle.Top; + lblRegistrySettingsUsedInfo.ForeColor = System.Drawing.SystemColors.ControlText; + lblRegistrySettingsUsedInfo.Location = new System.Drawing.Point(0, 0); + lblRegistrySettingsUsedInfo.Name = "lblRegistrySettingsUsedInfo"; + lblRegistrySettingsUsedInfo.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0); + lblRegistrySettingsUsedInfo.Size = new System.Drawing.Size(610, 30); + lblRegistrySettingsUsedInfo.TabIndex = 9; + lblRegistrySettingsUsedInfo.Text = "Some settings are configured by your Administrator. Please contact your administrator for more information."; + lblRegistrySettingsUsedInfo.Visible = false; + // // AppearancePage // AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - Controls.Add(chkCloseToSystemTray); - Controls.Add(lblLanguageRestartRequired); - Controls.Add(cboLanguage); - Controls.Add(lblLanguage); - Controls.Add(chkShowFullConnectionsFilePathInTitle); - Controls.Add(chkShowDescriptionTooltipsInTree); - Controls.Add(chkShowSystemTrayIcon); - Controls.Add(chkMinimizeToSystemTray); + Controls.Add(pnlOptions); + Controls.Add(lblRegistrySettingsUsedInfo); Name = "AppearancePage"; Size = new System.Drawing.Size(610, 490); + pnlOptions.ResumeLayout(false); + pnlOptions.PerformLayout(); ResumeLayout(false); - PerformLayout(); } internal Controls.MrngLabel lblLanguageRestartRequired; @@ -159,5 +186,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages internal MrngCheckBox chkShowSystemTrayIcon; internal MrngCheckBox chkMinimizeToSystemTray; internal MrngCheckBox chkCloseToSystemTray; + private System.Windows.Forms.Panel pnlOptions; + internal System.Windows.Forms.Label lblRegistrySettingsUsedInfo; } } diff --git a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.cs b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.cs index 81c8d2fb..5d9e18df 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.cs @@ -5,12 +5,14 @@ using mRemoteNG.Properties; using mRemoteNG.Tools; using mRemoteNG.Resources.Language; using System.Runtime.Versioning; +using mRemoteNG.Config.Settings.Registry; namespace mRemoteNG.UI.Forms.OptionsPages { [SupportedOSPlatform("windows")] public sealed partial class AppearancePage { + private OptRegistryAppearancePage pageRegSettingsInstance; public AppearancePage() { InitializeComponent(); @@ -36,6 +38,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkShowSystemTrayIcon.Text = Language.AlwaysShowSysTrayIcon; chkMinimizeToSystemTray.Text = Language.MinimizeToSysTray; chkCloseToSystemTray.Text = Language.CloseToSysTray; + lblRegistrySettingsUsedInfo.Text = Language.OptionsCompanyPolicyMessage; } public override void LoadSettings() @@ -102,5 +105,47 @@ namespace mRemoteNG.UI.Forms.OptionsPages Properties.OptionsAppearancePage.Default.MinimizeToTray = chkMinimizeToSystemTray.Checked; Properties.OptionsAppearancePage.Default.CloseToTray = chkCloseToSystemTray.Checked; } + + public override void LoadRegistrySettings() + { + Type settingsType = typeof(OptRegistryAppearancePage); + RegistryLoader.RegistrySettings.TryGetValue(settingsType, out var settings); + pageRegSettingsInstance = settings as OptRegistryAppearancePage; + + RegistryLoader.Cleanup(settingsType); + + // *** + // Disable controls based on the registry settings. + // + if (pageRegSettingsInstance.ShowDescriptionTooltipsInConTree.IsSet) + DisableControl(chkShowDescriptionTooltipsInTree); + + if (pageRegSettingsInstance.ShowCompleteConFilePathInTitle.IsSet) + DisableControl(chkShowFullConnectionsFilePathInTitle); + + if (pageRegSettingsInstance.AlwaysShowSystemTrayIcon.IsSet) + DisableControl(chkShowSystemTrayIcon); + + if (pageRegSettingsInstance.MinimizeToTray.IsSet) + DisableControl(chkMinimizeToSystemTray); + + if (pageRegSettingsInstance.CloseToTray.IsSet) + DisableControl(chkCloseToSystemTray); + + // Updates the visibility of the information label indicating whether registry settings are used. + lblRegistrySettingsUsedInfo.Visible = ShowRegistrySettingsUsedInfo(); + } + + /// + /// Checks if specific registry settings related to appearence page are used. + /// + public bool ShowRegistrySettingsUsedInfo() + { + return pageRegSettingsInstance.ShowDescriptionTooltipsInConTree.IsSet + || pageRegSettingsInstance.ShowCompleteConFilePathInTitle.IsSet + || pageRegSettingsInstance.AlwaysShowSystemTrayIcon.IsSet + || pageRegSettingsInstance.MinimizeToTray.IsSet + || pageRegSettingsInstance.CloseToTray.IsSet; + } } } \ No newline at end of file diff --git a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.resx b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.resx index f298a7be..af32865e 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.resx +++ b/mRemoteNG/UI/Forms/OptionsPages/AppearancePage.resx @@ -1,4 +1,64 @@ - + + + diff --git a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.Designer.cs b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.Designer.cs index 319bb0c0..d382917d 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.Designer.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.Designer.cs @@ -4,460 +4,479 @@ using mRemoteNG.UI.Controls; namespace mRemoteNG.UI.Forms.OptionsPages { - + public sealed partial class NotificationsPage : OptionsPage - { - - //UserControl overrides dispose to clean up the component list. - [System.Diagnostics.DebuggerNonUserCode()]protected override void Dispose(bool disposing) - { - try - { - if (disposing && components != null) - { - components.Dispose(); - } - } - finally - { - base.Dispose(disposing); - } - } - - //Required by the Windows Form Designer - private System.ComponentModel.Container components = null; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - [System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent() - { - this.labelSwitchToErrorsAndInfos = new mRemoteNG.UI.Controls.MrngLabel(); - this.chkSwitchToMCInformation = new MrngCheckBox(); - this.chkSwitchToMCErrors = new MrngCheckBox(); - this.chkSwitchToMCWarnings = new MrngCheckBox(); - this.groupBoxNotifications = new MrngGroupBox(); - this.labelNotificationsShowTypes = new mRemoteNG.UI.Controls.MrngLabel(); - this.chkShowErrorInMC = new MrngCheckBox(); - this.chkShowWarningInMC = new MrngCheckBox(); - this.chkShowInfoInMC = new MrngCheckBox(); - this.chkShowDebugInMC = new MrngCheckBox(); - this.groupBoxLogging = new MrngGroupBox(); - this.tblLogging = new System.Windows.Forms.TableLayoutPanel(); - this.chkLogDebugMsgs = new MrngCheckBox(); - this.chkLogInfoMsgs = new MrngCheckBox(); - this.chkLogWarningMsgs = new MrngCheckBox(); - this.chkLogErrorMsgs = new MrngCheckBox(); - this.chkLogToCurrentDir = new MrngCheckBox(); - this.buttonRestoreDefaultLogPath = new MrngButton(); - this.buttonOpenLogFile = new MrngButton(); - this.buttonSelectLogPath = new MrngButton(); - this.labelLogTheseMsgTypes = new mRemoteNG.UI.Controls.MrngLabel(); - this.labelLogFilePath = new mRemoteNG.UI.Controls.MrngLabel(); - this.textBoxLogPath = new mRemoteNG.UI.Controls.MrngTextBox(); - this.saveFileDialogLogging = new System.Windows.Forms.SaveFileDialog(); - this.groupBoxPopups = new MrngGroupBox(); - this.tblPopups = new System.Windows.Forms.TableLayoutPanel(); - this.chkPopupDebug = new MrngCheckBox(); - this.chkPopupError = new MrngCheckBox(); - this.chkPopupInfo = new MrngCheckBox(); - this.chkPopupWarning = new MrngCheckBox(); - this.labelPopupShowTypes = new mRemoteNG.UI.Controls.MrngLabel(); - this.groupBoxNotifications.SuspendLayout(); - this.groupBoxLogging.SuspendLayout(); - this.tblLogging.SuspendLayout(); - this.groupBoxPopups.SuspendLayout(); - this.tblPopups.SuspendLayout(); - this.SuspendLayout(); + { + + //UserControl overrides dispose to clean up the component list. + [System.Diagnostics.DebuggerNonUserCode()] + protected override void Dispose(bool disposing) + { + try + { + if (disposing && components != null) + { + components.Dispose(); + } + } + finally + { + base.Dispose(disposing); + } + } + + //Required by the Windows Form Designer + private System.ComponentModel.Container components = null; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + [System.Diagnostics.DebuggerStepThrough()] + private void InitializeComponent() + { + labelSwitchToErrorsAndInfos = new MrngLabel(); + chkSwitchToMCInformation = new MrngCheckBox(); + chkSwitchToMCErrors = new MrngCheckBox(); + chkSwitchToMCWarnings = new MrngCheckBox(); + groupBoxNotifications = new MrngGroupBox(); + labelNotificationsShowTypes = new MrngLabel(); + chkShowErrorInMC = new MrngCheckBox(); + chkShowWarningInMC = new MrngCheckBox(); + chkShowInfoInMC = new MrngCheckBox(); + chkShowDebugInMC = new MrngCheckBox(); + groupBoxLogging = new MrngGroupBox(); + tblLogging = new System.Windows.Forms.TableLayoutPanel(); + chkLogDebugMsgs = new MrngCheckBox(); + chkLogInfoMsgs = new MrngCheckBox(); + chkLogWarningMsgs = new MrngCheckBox(); + chkLogErrorMsgs = new MrngCheckBox(); + chkLogToCurrentDir = new MrngCheckBox(); + buttonRestoreDefaultLogPath = new MrngButton(); + buttonOpenLogFile = new MrngButton(); + buttonSelectLogPath = new MrngButton(); + labelLogTheseMsgTypes = new MrngLabel(); + labelLogFilePath = new MrngLabel(); + textBoxLogPath = new MrngTextBox(); + saveFileDialogLogging = new System.Windows.Forms.SaveFileDialog(); + groupBoxPopups = new MrngGroupBox(); + tblPopups = new System.Windows.Forms.TableLayoutPanel(); + chkPopupDebug = new MrngCheckBox(); + chkPopupError = new MrngCheckBox(); + chkPopupInfo = new MrngCheckBox(); + chkPopupWarning = new MrngCheckBox(); + labelPopupShowTypes = new MrngLabel(); + lblRegistrySettingsUsedInfo = new System.Windows.Forms.Label(); + groupBoxNotifications.SuspendLayout(); + groupBoxLogging.SuspendLayout(); + tblLogging.SuspendLayout(); + groupBoxPopups.SuspendLayout(); + tblPopups.SuspendLayout(); + SuspendLayout(); // // labelSwitchToErrorsAndInfos // - this.labelSwitchToErrorsAndInfos.AutoSize = true; - this.labelSwitchToErrorsAndInfos.Location = new System.Drawing.Point(177, 25); - this.labelSwitchToErrorsAndInfos.Name = "labelSwitchToErrorsAndInfos"; - this.labelSwitchToErrorsAndInfos.Size = new System.Drawing.Size(176, 13); - this.labelSwitchToErrorsAndInfos.TabIndex = 5; - this.labelSwitchToErrorsAndInfos.Text = "Switch to Notifications panel on:"; + labelSwitchToErrorsAndInfos.AutoSize = true; + labelSwitchToErrorsAndInfos.Location = new System.Drawing.Point(177, 25); + labelSwitchToErrorsAndInfos.Name = "labelSwitchToErrorsAndInfos"; + labelSwitchToErrorsAndInfos.Size = new System.Drawing.Size(176, 13); + labelSwitchToErrorsAndInfos.TabIndex = 5; + labelSwitchToErrorsAndInfos.Text = "Switch to Notifications panel on:"; // // chkSwitchToMCInformation // - this.chkSwitchToMCInformation._mice = MrngCheckBox.MouseState.OUT; - this.chkSwitchToMCInformation.AutoSize = true; - this.chkSwitchToMCInformation.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkSwitchToMCInformation.Location = new System.Drawing.Point(195, 64); - this.chkSwitchToMCInformation.Name = "chkSwitchToMCInformation"; - this.chkSwitchToMCInformation.Size = new System.Drawing.Size(87, 17); - this.chkSwitchToMCInformation.TabIndex = 6; - this.chkSwitchToMCInformation.Text = "Information"; - this.chkSwitchToMCInformation.UseVisualStyleBackColor = true; + chkSwitchToMCInformation._mice = MrngCheckBox.MouseState.OUT; + chkSwitchToMCInformation.AutoSize = true; + chkSwitchToMCInformation.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkSwitchToMCInformation.Location = new System.Drawing.Point(195, 64); + chkSwitchToMCInformation.Name = "chkSwitchToMCInformation"; + chkSwitchToMCInformation.Size = new System.Drawing.Size(87, 17); + chkSwitchToMCInformation.TabIndex = 6; + chkSwitchToMCInformation.Text = "Information"; + chkSwitchToMCInformation.UseVisualStyleBackColor = true; // // chkSwitchToMCErrors // - this.chkSwitchToMCErrors._mice = MrngCheckBox.MouseState.OUT; - this.chkSwitchToMCErrors.AutoSize = true; - this.chkSwitchToMCErrors.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkSwitchToMCErrors.Location = new System.Drawing.Point(195, 110); - this.chkSwitchToMCErrors.Name = "chkSwitchToMCErrors"; - this.chkSwitchToMCErrors.Size = new System.Drawing.Size(51, 17); - this.chkSwitchToMCErrors.TabIndex = 8; - this.chkSwitchToMCErrors.Text = "Error"; - this.chkSwitchToMCErrors.UseVisualStyleBackColor = true; + chkSwitchToMCErrors._mice = MrngCheckBox.MouseState.OUT; + chkSwitchToMCErrors.AutoSize = true; + chkSwitchToMCErrors.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkSwitchToMCErrors.Location = new System.Drawing.Point(195, 110); + chkSwitchToMCErrors.Name = "chkSwitchToMCErrors"; + chkSwitchToMCErrors.Size = new System.Drawing.Size(51, 17); + chkSwitchToMCErrors.TabIndex = 8; + chkSwitchToMCErrors.Text = "Error"; + chkSwitchToMCErrors.UseVisualStyleBackColor = true; // // chkSwitchToMCWarnings // - this.chkSwitchToMCWarnings._mice = MrngCheckBox.MouseState.OUT; - this.chkSwitchToMCWarnings.AutoSize = true; - this.chkSwitchToMCWarnings.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkSwitchToMCWarnings.Location = new System.Drawing.Point(195, 87); - this.chkSwitchToMCWarnings.Name = "chkSwitchToMCWarnings"; - this.chkSwitchToMCWarnings.Size = new System.Drawing.Size(71, 17); - this.chkSwitchToMCWarnings.TabIndex = 7; - this.chkSwitchToMCWarnings.Text = "Warning"; - this.chkSwitchToMCWarnings.UseVisualStyleBackColor = true; + chkSwitchToMCWarnings._mice = MrngCheckBox.MouseState.OUT; + chkSwitchToMCWarnings.AutoSize = true; + chkSwitchToMCWarnings.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkSwitchToMCWarnings.Location = new System.Drawing.Point(195, 87); + chkSwitchToMCWarnings.Name = "chkSwitchToMCWarnings"; + chkSwitchToMCWarnings.Size = new System.Drawing.Size(71, 17); + chkSwitchToMCWarnings.TabIndex = 7; + chkSwitchToMCWarnings.Text = "Warning"; + chkSwitchToMCWarnings.UseVisualStyleBackColor = true; // // groupBoxNotifications // - this.groupBoxNotifications.Controls.Add(this.labelNotificationsShowTypes); - this.groupBoxNotifications.Controls.Add(this.labelSwitchToErrorsAndInfos); - this.groupBoxNotifications.Controls.Add(this.chkSwitchToMCErrors); - this.groupBoxNotifications.Controls.Add(this.chkShowErrorInMC); - this.groupBoxNotifications.Controls.Add(this.chkSwitchToMCInformation); - this.groupBoxNotifications.Controls.Add(this.chkShowWarningInMC); - this.groupBoxNotifications.Controls.Add(this.chkSwitchToMCWarnings); - this.groupBoxNotifications.Controls.Add(this.chkShowInfoInMC); - this.groupBoxNotifications.Controls.Add(this.chkShowDebugInMC); - this.groupBoxNotifications.Location = new System.Drawing.Point(6, 2); - this.groupBoxNotifications.Name = "groupBoxNotifications"; - this.groupBoxNotifications.Size = new System.Drawing.Size(601, 132); - this.groupBoxNotifications.TabIndex = 0; - this.groupBoxNotifications.TabStop = false; - this.groupBoxNotifications.Text = "Notifications Panel"; + groupBoxNotifications.Controls.Add(labelNotificationsShowTypes); + groupBoxNotifications.Controls.Add(labelSwitchToErrorsAndInfos); + groupBoxNotifications.Controls.Add(chkSwitchToMCErrors); + groupBoxNotifications.Controls.Add(chkShowErrorInMC); + groupBoxNotifications.Controls.Add(chkSwitchToMCInformation); + groupBoxNotifications.Controls.Add(chkShowWarningInMC); + groupBoxNotifications.Controls.Add(chkSwitchToMCWarnings); + groupBoxNotifications.Controls.Add(chkShowInfoInMC); + groupBoxNotifications.Controls.Add(chkShowDebugInMC); + groupBoxNotifications.Dock = System.Windows.Forms.DockStyle.Top; + groupBoxNotifications.Location = new System.Drawing.Point(0, 0); + groupBoxNotifications.Name = "groupBoxNotifications"; + groupBoxNotifications.Size = new System.Drawing.Size(610, 132); + groupBoxNotifications.TabIndex = 0; + groupBoxNotifications.TabStop = false; + groupBoxNotifications.Text = "Notifications Panel"; // // labelNotificationsShowTypes // - this.labelNotificationsShowTypes.AutoSize = true; - this.labelNotificationsShowTypes.Location = new System.Drawing.Point(6, 25); - this.labelNotificationsShowTypes.Name = "labelNotificationsShowTypes"; - this.labelNotificationsShowTypes.Size = new System.Drawing.Size(147, 13); - this.labelNotificationsShowTypes.TabIndex = 0; - this.labelNotificationsShowTypes.Text = "Show these message types:"; + labelNotificationsShowTypes.AutoSize = true; + labelNotificationsShowTypes.Location = new System.Drawing.Point(6, 25); + labelNotificationsShowTypes.Name = "labelNotificationsShowTypes"; + labelNotificationsShowTypes.Size = new System.Drawing.Size(147, 13); + labelNotificationsShowTypes.TabIndex = 0; + labelNotificationsShowTypes.Text = "Show these message types:"; // // chkShowErrorInMC // - this.chkShowErrorInMC._mice = MrngCheckBox.MouseState.OUT; - this.chkShowErrorInMC.AutoSize = true; - this.chkShowErrorInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkShowErrorInMC.Location = new System.Drawing.Point(20, 110); - this.chkShowErrorInMC.Name = "chkShowErrorInMC"; - this.chkShowErrorInMC.Size = new System.Drawing.Size(51, 17); - this.chkShowErrorInMC.TabIndex = 4; - this.chkShowErrorInMC.Text = "Error"; - this.chkShowErrorInMC.UseVisualStyleBackColor = true; + chkShowErrorInMC._mice = MrngCheckBox.MouseState.OUT; + chkShowErrorInMC.AutoSize = true; + chkShowErrorInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkShowErrorInMC.Location = new System.Drawing.Point(20, 110); + chkShowErrorInMC.Name = "chkShowErrorInMC"; + chkShowErrorInMC.Size = new System.Drawing.Size(51, 17); + chkShowErrorInMC.TabIndex = 4; + chkShowErrorInMC.Text = "Error"; + chkShowErrorInMC.UseVisualStyleBackColor = true; // // chkShowWarningInMC // - this.chkShowWarningInMC._mice = MrngCheckBox.MouseState.OUT; - this.chkShowWarningInMC.AutoSize = true; - this.chkShowWarningInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkShowWarningInMC.Location = new System.Drawing.Point(20, 87); - this.chkShowWarningInMC.Name = "chkShowWarningInMC"; - this.chkShowWarningInMC.Size = new System.Drawing.Size(71, 17); - this.chkShowWarningInMC.TabIndex = 3; - this.chkShowWarningInMC.Text = "Warning"; - this.chkShowWarningInMC.UseVisualStyleBackColor = true; + chkShowWarningInMC._mice = MrngCheckBox.MouseState.OUT; + chkShowWarningInMC.AutoSize = true; + chkShowWarningInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkShowWarningInMC.Location = new System.Drawing.Point(20, 87); + chkShowWarningInMC.Name = "chkShowWarningInMC"; + chkShowWarningInMC.Size = new System.Drawing.Size(71, 17); + chkShowWarningInMC.TabIndex = 3; + chkShowWarningInMC.Text = "Warning"; + chkShowWarningInMC.UseVisualStyleBackColor = true; // // chkShowInfoInMC // - this.chkShowInfoInMC._mice = MrngCheckBox.MouseState.OUT; - this.chkShowInfoInMC.AutoSize = true; - this.chkShowInfoInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkShowInfoInMC.Location = new System.Drawing.Point(20, 64); - this.chkShowInfoInMC.Name = "chkShowInfoInMC"; - this.chkShowInfoInMC.Size = new System.Drawing.Size(87, 17); - this.chkShowInfoInMC.TabIndex = 2; - this.chkShowInfoInMC.Text = "Information"; - this.chkShowInfoInMC.UseVisualStyleBackColor = true; + chkShowInfoInMC._mice = MrngCheckBox.MouseState.OUT; + chkShowInfoInMC.AutoSize = true; + chkShowInfoInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkShowInfoInMC.Location = new System.Drawing.Point(20, 64); + chkShowInfoInMC.Name = "chkShowInfoInMC"; + chkShowInfoInMC.Size = new System.Drawing.Size(87, 17); + chkShowInfoInMC.TabIndex = 2; + chkShowInfoInMC.Text = "Information"; + chkShowInfoInMC.UseVisualStyleBackColor = true; // // chkShowDebugInMC // - this.chkShowDebugInMC._mice = MrngCheckBox.MouseState.OUT; - this.chkShowDebugInMC.AutoSize = true; - this.chkShowDebugInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkShowDebugInMC.Location = new System.Drawing.Point(20, 41); - this.chkShowDebugInMC.Name = "chkShowDebugInMC"; - this.chkShowDebugInMC.Size = new System.Drawing.Size(61, 17); - this.chkShowDebugInMC.TabIndex = 1; - this.chkShowDebugInMC.Text = "Debug"; - this.chkShowDebugInMC.UseVisualStyleBackColor = true; + chkShowDebugInMC._mice = MrngCheckBox.MouseState.OUT; + chkShowDebugInMC.AutoSize = true; + chkShowDebugInMC.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkShowDebugInMC.Location = new System.Drawing.Point(20, 41); + chkShowDebugInMC.Name = "chkShowDebugInMC"; + chkShowDebugInMC.Size = new System.Drawing.Size(61, 17); + chkShowDebugInMC.TabIndex = 1; + chkShowDebugInMC.Text = "Debug"; + chkShowDebugInMC.UseVisualStyleBackColor = true; // // groupBoxLogging // - this.groupBoxLogging.Controls.Add(this.tblLogging); - this.groupBoxLogging.Controls.Add(this.chkLogToCurrentDir); - this.groupBoxLogging.Controls.Add(this.buttonRestoreDefaultLogPath); - this.groupBoxLogging.Controls.Add(this.buttonOpenLogFile); - this.groupBoxLogging.Controls.Add(this.buttonSelectLogPath); - this.groupBoxLogging.Controls.Add(this.labelLogTheseMsgTypes); - this.groupBoxLogging.Controls.Add(this.labelLogFilePath); - this.groupBoxLogging.Controls.Add(this.textBoxLogPath); - this.groupBoxLogging.Location = new System.Drawing.Point(6, 140); - this.groupBoxLogging.Name = "groupBoxLogging"; - this.groupBoxLogging.Size = new System.Drawing.Size(601, 173); - this.groupBoxLogging.TabIndex = 1; - this.groupBoxLogging.TabStop = false; - this.groupBoxLogging.Text = "Logging"; + groupBoxLogging.Controls.Add(tblLogging); + groupBoxLogging.Controls.Add(chkLogToCurrentDir); + groupBoxLogging.Controls.Add(buttonRestoreDefaultLogPath); + groupBoxLogging.Controls.Add(buttonOpenLogFile); + groupBoxLogging.Controls.Add(buttonSelectLogPath); + groupBoxLogging.Controls.Add(labelLogTheseMsgTypes); + groupBoxLogging.Controls.Add(labelLogFilePath); + groupBoxLogging.Controls.Add(textBoxLogPath); + groupBoxLogging.Dock = System.Windows.Forms.DockStyle.Top; + groupBoxLogging.Location = new System.Drawing.Point(0, 132); + groupBoxLogging.Name = "groupBoxLogging"; + groupBoxLogging.Size = new System.Drawing.Size(610, 173); + groupBoxLogging.TabIndex = 1; + groupBoxLogging.TabStop = false; + groupBoxLogging.Text = "Logging"; // // tblLogging // - this.tblLogging.ColumnCount = 4; - this.tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblLogging.Controls.Add(this.chkLogDebugMsgs, 0, 0); - this.tblLogging.Controls.Add(this.chkLogInfoMsgs, 1, 0); - this.tblLogging.Controls.Add(this.chkLogWarningMsgs, 2, 0); - this.tblLogging.Controls.Add(this.chkLogErrorMsgs, 3, 0); - this.tblLogging.Location = new System.Drawing.Point(9, 138); - this.tblLogging.Name = "tblLogging"; - this.tblLogging.RowCount = 1; - this.tblLogging.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tblLogging.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); - this.tblLogging.Size = new System.Drawing.Size(585, 25); - this.tblLogging.TabIndex = 7; + tblLogging.ColumnCount = 4; + tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblLogging.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblLogging.Controls.Add(chkLogDebugMsgs, 0, 0); + tblLogging.Controls.Add(chkLogInfoMsgs, 1, 0); + tblLogging.Controls.Add(chkLogWarningMsgs, 2, 0); + tblLogging.Controls.Add(chkLogErrorMsgs, 3, 0); + tblLogging.Location = new System.Drawing.Point(9, 138); + tblLogging.Name = "tblLogging"; + tblLogging.RowCount = 1; + tblLogging.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tblLogging.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + tblLogging.Size = new System.Drawing.Size(585, 25); + tblLogging.TabIndex = 7; // // chkLogDebugMsgs // - this.chkLogDebugMsgs._mice = MrngCheckBox.MouseState.OUT; - this.chkLogDebugMsgs.AutoSize = true; - this.chkLogDebugMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkLogDebugMsgs.Location = new System.Drawing.Point(3, 3); - this.chkLogDebugMsgs.Name = "chkLogDebugMsgs"; - this.chkLogDebugMsgs.Size = new System.Drawing.Size(61, 17); - this.chkLogDebugMsgs.TabIndex = 0; - this.chkLogDebugMsgs.Text = "Debug"; - this.chkLogDebugMsgs.UseVisualStyleBackColor = true; + chkLogDebugMsgs._mice = MrngCheckBox.MouseState.OUT; + chkLogDebugMsgs.AutoSize = true; + chkLogDebugMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkLogDebugMsgs.Location = new System.Drawing.Point(3, 3); + chkLogDebugMsgs.Name = "chkLogDebugMsgs"; + chkLogDebugMsgs.Size = new System.Drawing.Size(61, 17); + chkLogDebugMsgs.TabIndex = 0; + chkLogDebugMsgs.Text = "Debug"; + chkLogDebugMsgs.UseVisualStyleBackColor = true; // // chkLogInfoMsgs // - this.chkLogInfoMsgs._mice = MrngCheckBox.MouseState.OUT; - this.chkLogInfoMsgs.AutoSize = true; - this.chkLogInfoMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkLogInfoMsgs.Location = new System.Drawing.Point(149, 3); - this.chkLogInfoMsgs.Name = "chkLogInfoMsgs"; - this.chkLogInfoMsgs.Size = new System.Drawing.Size(87, 17); - this.chkLogInfoMsgs.TabIndex = 1; - this.chkLogInfoMsgs.Text = "Information"; - this.chkLogInfoMsgs.UseVisualStyleBackColor = true; + chkLogInfoMsgs._mice = MrngCheckBox.MouseState.OUT; + chkLogInfoMsgs.AutoSize = true; + chkLogInfoMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkLogInfoMsgs.Location = new System.Drawing.Point(149, 3); + chkLogInfoMsgs.Name = "chkLogInfoMsgs"; + chkLogInfoMsgs.Size = new System.Drawing.Size(87, 17); + chkLogInfoMsgs.TabIndex = 1; + chkLogInfoMsgs.Text = "Information"; + chkLogInfoMsgs.UseVisualStyleBackColor = true; // // chkLogWarningMsgs // - this.chkLogWarningMsgs._mice = MrngCheckBox.MouseState.OUT; - this.chkLogWarningMsgs.AutoSize = true; - this.chkLogWarningMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkLogWarningMsgs.Location = new System.Drawing.Point(295, 3); - this.chkLogWarningMsgs.Name = "chkLogWarningMsgs"; - this.chkLogWarningMsgs.Size = new System.Drawing.Size(71, 17); - this.chkLogWarningMsgs.TabIndex = 2; - this.chkLogWarningMsgs.Text = "Warning"; - this.chkLogWarningMsgs.UseVisualStyleBackColor = true; + chkLogWarningMsgs._mice = MrngCheckBox.MouseState.OUT; + chkLogWarningMsgs.AutoSize = true; + chkLogWarningMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkLogWarningMsgs.Location = new System.Drawing.Point(295, 3); + chkLogWarningMsgs.Name = "chkLogWarningMsgs"; + chkLogWarningMsgs.Size = new System.Drawing.Size(71, 17); + chkLogWarningMsgs.TabIndex = 2; + chkLogWarningMsgs.Text = "Warning"; + chkLogWarningMsgs.UseVisualStyleBackColor = true; // // chkLogErrorMsgs // - this.chkLogErrorMsgs._mice = MrngCheckBox.MouseState.OUT; - this.chkLogErrorMsgs.AutoSize = true; - this.chkLogErrorMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkLogErrorMsgs.Location = new System.Drawing.Point(441, 3); - this.chkLogErrorMsgs.Name = "chkLogErrorMsgs"; - this.chkLogErrorMsgs.Size = new System.Drawing.Size(51, 17); - this.chkLogErrorMsgs.TabIndex = 3; - this.chkLogErrorMsgs.Text = "Error"; - this.chkLogErrorMsgs.UseVisualStyleBackColor = true; + chkLogErrorMsgs._mice = MrngCheckBox.MouseState.OUT; + chkLogErrorMsgs.AutoSize = true; + chkLogErrorMsgs.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkLogErrorMsgs.Location = new System.Drawing.Point(441, 3); + chkLogErrorMsgs.Name = "chkLogErrorMsgs"; + chkLogErrorMsgs.Size = new System.Drawing.Size(51, 17); + chkLogErrorMsgs.TabIndex = 3; + chkLogErrorMsgs.Text = "Error"; + chkLogErrorMsgs.UseVisualStyleBackColor = true; // // chkLogToCurrentDir // - this.chkLogToCurrentDir._mice = MrngCheckBox.MouseState.OUT; - this.chkLogToCurrentDir.AutoSize = true; - this.chkLogToCurrentDir.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkLogToCurrentDir.Location = new System.Drawing.Point(9, 18); - this.chkLogToCurrentDir.Name = "chkLogToCurrentDir"; - this.chkLogToCurrentDir.Size = new System.Drawing.Size(168, 17); - this.chkLogToCurrentDir.TabIndex = 0; - this.chkLogToCurrentDir.Text = "Log to application directory"; - this.chkLogToCurrentDir.UseVisualStyleBackColor = true; - this.chkLogToCurrentDir.CheckedChanged += new System.EventHandler(this.chkLogToCurrentDir_CheckedChanged); + chkLogToCurrentDir._mice = MrngCheckBox.MouseState.OUT; + chkLogToCurrentDir.AutoSize = true; + chkLogToCurrentDir.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkLogToCurrentDir.Location = new System.Drawing.Point(9, 18); + chkLogToCurrentDir.Name = "chkLogToCurrentDir"; + chkLogToCurrentDir.Size = new System.Drawing.Size(168, 17); + chkLogToCurrentDir.TabIndex = 0; + chkLogToCurrentDir.Text = "Log to application directory"; + chkLogToCurrentDir.UseVisualStyleBackColor = true; + chkLogToCurrentDir.CheckedChanged += chkLogToCurrentDir_CheckedChanged; // // buttonRestoreDefaultLogPath // - this.buttonRestoreDefaultLogPath._mice = MrngButton.MouseState.OUT; - this.buttonRestoreDefaultLogPath.Location = new System.Drawing.Point(9, 85); - this.buttonRestoreDefaultLogPath.Name = "buttonRestoreDefaultLogPath"; - this.buttonRestoreDefaultLogPath.Size = new System.Drawing.Size(179, 25); - this.buttonRestoreDefaultLogPath.TabIndex = 5; - this.buttonRestoreDefaultLogPath.Text = "Use Default"; - this.buttonRestoreDefaultLogPath.UseVisualStyleBackColor = true; - this.buttonRestoreDefaultLogPath.Click += new System.EventHandler(this.buttonRestoreDefaultLogPath_Click); + buttonRestoreDefaultLogPath._mice = MrngButton.MouseState.OUT; + buttonRestoreDefaultLogPath.Location = new System.Drawing.Point(9, 85); + buttonRestoreDefaultLogPath.Name = "buttonRestoreDefaultLogPath"; + buttonRestoreDefaultLogPath.Size = new System.Drawing.Size(179, 25); + buttonRestoreDefaultLogPath.TabIndex = 5; + buttonRestoreDefaultLogPath.Text = "Use Default"; + buttonRestoreDefaultLogPath.UseVisualStyleBackColor = true; + buttonRestoreDefaultLogPath.Click += buttonRestoreDefaultLogPath_Click; // // buttonOpenLogFile // - this.buttonOpenLogFile._mice = MrngButton.MouseState.OUT; - this.buttonOpenLogFile.Location = new System.Drawing.Point(378, 85); - this.buttonOpenLogFile.Name = "buttonOpenLogFile"; - this.buttonOpenLogFile.Size = new System.Drawing.Size(105, 25); - this.buttonOpenLogFile.TabIndex = 3; - this.buttonOpenLogFile.Text = "Open File"; - this.buttonOpenLogFile.UseVisualStyleBackColor = true; - this.buttonOpenLogFile.Click += new System.EventHandler(this.buttonOpenLogFile_Click); + buttonOpenLogFile._mice = MrngButton.MouseState.OUT; + buttonOpenLogFile.Location = new System.Drawing.Point(378, 85); + buttonOpenLogFile.Name = "buttonOpenLogFile"; + buttonOpenLogFile.Size = new System.Drawing.Size(105, 25); + buttonOpenLogFile.TabIndex = 3; + buttonOpenLogFile.Text = "Open File"; + buttonOpenLogFile.UseVisualStyleBackColor = true; + buttonOpenLogFile.Click += buttonOpenLogFile_Click; // // buttonSelectLogPath // - this.buttonSelectLogPath._mice = MrngButton.MouseState.OUT; - this.buttonSelectLogPath.Location = new System.Drawing.Point(489, 85); - this.buttonSelectLogPath.Name = "buttonSelectLogPath"; - this.buttonSelectLogPath.Size = new System.Drawing.Size(105, 25); - this.buttonSelectLogPath.TabIndex = 4; - this.buttonSelectLogPath.Text = "Choose Path"; - this.buttonSelectLogPath.UseVisualStyleBackColor = true; - this.buttonSelectLogPath.Click += new System.EventHandler(this.buttonSelectLogPath_Click); + buttonSelectLogPath._mice = MrngButton.MouseState.OUT; + buttonSelectLogPath.Location = new System.Drawing.Point(489, 85); + buttonSelectLogPath.Name = "buttonSelectLogPath"; + buttonSelectLogPath.Size = new System.Drawing.Size(105, 25); + buttonSelectLogPath.TabIndex = 4; + buttonSelectLogPath.Text = "Choose Path"; + buttonSelectLogPath.UseVisualStyleBackColor = true; + buttonSelectLogPath.Click += buttonSelectLogPath_Click; // // labelLogTheseMsgTypes // - this.labelLogTheseMsgTypes.AutoSize = true; - this.labelLogTheseMsgTypes.Location = new System.Drawing.Point(6, 122); - this.labelLogTheseMsgTypes.Name = "labelLogTheseMsgTypes"; - this.labelLogTheseMsgTypes.Size = new System.Drawing.Size(137, 13); - this.labelLogTheseMsgTypes.TabIndex = 6; - this.labelLogTheseMsgTypes.Text = "Log these message types:"; + labelLogTheseMsgTypes.AutoSize = true; + labelLogTheseMsgTypes.Location = new System.Drawing.Point(6, 122); + labelLogTheseMsgTypes.Name = "labelLogTheseMsgTypes"; + labelLogTheseMsgTypes.Size = new System.Drawing.Size(137, 13); + labelLogTheseMsgTypes.TabIndex = 6; + labelLogTheseMsgTypes.Text = "Log these message types:"; // // labelLogFilePath // - this.labelLogFilePath.AutoSize = true; - this.labelLogFilePath.Location = new System.Drawing.Point(6, 38); - this.labelLogFilePath.Name = "labelLogFilePath"; - this.labelLogFilePath.Size = new System.Drawing.Size(75, 13); - this.labelLogFilePath.TabIndex = 1; - this.labelLogFilePath.Text = "Log file path:"; + labelLogFilePath.AutoSize = true; + labelLogFilePath.Location = new System.Drawing.Point(6, 38); + labelLogFilePath.Name = "labelLogFilePath"; + labelLogFilePath.Size = new System.Drawing.Size(75, 13); + labelLogFilePath.TabIndex = 1; + labelLogFilePath.Text = "Log file path:"; // // textBoxLogPath // - this.textBoxLogPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.textBoxLogPath.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxLogPath.Location = new System.Drawing.Point(9, 57); - this.textBoxLogPath.Name = "textBoxLogPath"; - this.textBoxLogPath.ReadOnly = true; - this.textBoxLogPath.Size = new System.Drawing.Size(585, 22); - this.textBoxLogPath.TabIndex = 2; + textBoxLogPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + textBoxLogPath.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + textBoxLogPath.Location = new System.Drawing.Point(9, 57); + textBoxLogPath.Name = "textBoxLogPath"; + textBoxLogPath.ReadOnly = true; + textBoxLogPath.Size = new System.Drawing.Size(585, 22); + textBoxLogPath.TabIndex = 2; // // groupBoxPopups // - this.groupBoxPopups.Controls.Add(this.tblPopups); - this.groupBoxPopups.Controls.Add(this.labelPopupShowTypes); - this.groupBoxPopups.Location = new System.Drawing.Point(6, 319); - this.groupBoxPopups.Name = "groupBoxPopups"; - this.groupBoxPopups.Size = new System.Drawing.Size(601, 74); - this.groupBoxPopups.TabIndex = 2; - this.groupBoxPopups.TabStop = false; - this.groupBoxPopups.Text = "Pop-ups"; + groupBoxPopups.Controls.Add(tblPopups); + groupBoxPopups.Controls.Add(labelPopupShowTypes); + groupBoxPopups.Dock = System.Windows.Forms.DockStyle.Top; + groupBoxPopups.Location = new System.Drawing.Point(0, 305); + groupBoxPopups.Name = "groupBoxPopups"; + groupBoxPopups.Size = new System.Drawing.Size(610, 74); + groupBoxPopups.TabIndex = 2; + groupBoxPopups.TabStop = false; + groupBoxPopups.Text = "Pop-ups"; // // tblPopups // - this.tblPopups.ColumnCount = 4; - this.tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tblPopups.Controls.Add(this.chkPopupDebug, 0, 0); - this.tblPopups.Controls.Add(this.chkPopupError, 3, 0); - this.tblPopups.Controls.Add(this.chkPopupInfo, 1, 0); - this.tblPopups.Controls.Add(this.chkPopupWarning, 2, 0); - this.tblPopups.Location = new System.Drawing.Point(11, 40); - this.tblPopups.Name = "tblPopups"; - this.tblPopups.RowCount = 1; - this.tblPopups.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tblPopups.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); - this.tblPopups.Size = new System.Drawing.Size(584, 25); - this.tblPopups.TabIndex = 1; + tblPopups.ColumnCount = 4; + tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblPopups.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + tblPopups.Controls.Add(chkPopupDebug, 0, 0); + tblPopups.Controls.Add(chkPopupError, 3, 0); + tblPopups.Controls.Add(chkPopupInfo, 1, 0); + tblPopups.Controls.Add(chkPopupWarning, 2, 0); + tblPopups.Location = new System.Drawing.Point(11, 40); + tblPopups.Name = "tblPopups"; + tblPopups.RowCount = 1; + tblPopups.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tblPopups.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + tblPopups.Size = new System.Drawing.Size(584, 25); + tblPopups.TabIndex = 1; // // chkPopupDebug // - this.chkPopupDebug._mice = MrngCheckBox.MouseState.OUT; - this.chkPopupDebug.AutoSize = true; - this.chkPopupDebug.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPopupDebug.Location = new System.Drawing.Point(3, 3); - this.chkPopupDebug.Name = "chkPopupDebug"; - this.chkPopupDebug.Size = new System.Drawing.Size(61, 17); - this.chkPopupDebug.TabIndex = 0; - this.chkPopupDebug.Text = "Debug"; - this.chkPopupDebug.UseVisualStyleBackColor = true; + chkPopupDebug._mice = MrngCheckBox.MouseState.OUT; + chkPopupDebug.AutoSize = true; + chkPopupDebug.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkPopupDebug.Location = new System.Drawing.Point(3, 3); + chkPopupDebug.Name = "chkPopupDebug"; + chkPopupDebug.Size = new System.Drawing.Size(61, 17); + chkPopupDebug.TabIndex = 0; + chkPopupDebug.Text = "Debug"; + chkPopupDebug.UseVisualStyleBackColor = true; // // chkPopupError // - this.chkPopupError._mice = MrngCheckBox.MouseState.OUT; - this.chkPopupError.AutoSize = true; - this.chkPopupError.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPopupError.Location = new System.Drawing.Point(441, 3); - this.chkPopupError.Name = "chkPopupError"; - this.chkPopupError.Size = new System.Drawing.Size(51, 17); - this.chkPopupError.TabIndex = 3; - this.chkPopupError.Text = "Error"; - this.chkPopupError.UseVisualStyleBackColor = true; + chkPopupError._mice = MrngCheckBox.MouseState.OUT; + chkPopupError.AutoSize = true; + chkPopupError.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkPopupError.Location = new System.Drawing.Point(441, 3); + chkPopupError.Name = "chkPopupError"; + chkPopupError.Size = new System.Drawing.Size(51, 17); + chkPopupError.TabIndex = 3; + chkPopupError.Text = "Error"; + chkPopupError.UseVisualStyleBackColor = true; // // chkPopupInfo // - this.chkPopupInfo._mice = MrngCheckBox.MouseState.OUT; - this.chkPopupInfo.AutoSize = true; - this.chkPopupInfo.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPopupInfo.Location = new System.Drawing.Point(149, 3); - this.chkPopupInfo.Name = "chkPopupInfo"; - this.chkPopupInfo.Size = new System.Drawing.Size(87, 17); - this.chkPopupInfo.TabIndex = 1; - this.chkPopupInfo.Text = "Information"; - this.chkPopupInfo.UseVisualStyleBackColor = true; + chkPopupInfo._mice = MrngCheckBox.MouseState.OUT; + chkPopupInfo.AutoSize = true; + chkPopupInfo.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkPopupInfo.Location = new System.Drawing.Point(149, 3); + chkPopupInfo.Name = "chkPopupInfo"; + chkPopupInfo.Size = new System.Drawing.Size(87, 17); + chkPopupInfo.TabIndex = 1; + chkPopupInfo.Text = "Information"; + chkPopupInfo.UseVisualStyleBackColor = true; // // chkPopupWarning // - this.chkPopupWarning._mice = MrngCheckBox.MouseState.OUT; - this.chkPopupWarning.AutoSize = true; - this.chkPopupWarning.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPopupWarning.Location = new System.Drawing.Point(295, 3); - this.chkPopupWarning.Name = "chkPopupWarning"; - this.chkPopupWarning.Size = new System.Drawing.Size(71, 17); - this.chkPopupWarning.TabIndex = 2; - this.chkPopupWarning.Text = "Warning"; - this.chkPopupWarning.UseVisualStyleBackColor = true; + chkPopupWarning._mice = MrngCheckBox.MouseState.OUT; + chkPopupWarning.AutoSize = true; + chkPopupWarning.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + chkPopupWarning.Location = new System.Drawing.Point(295, 3); + chkPopupWarning.Name = "chkPopupWarning"; + chkPopupWarning.Size = new System.Drawing.Size(71, 17); + chkPopupWarning.TabIndex = 2; + chkPopupWarning.Text = "Warning"; + chkPopupWarning.UseVisualStyleBackColor = true; // // labelPopupShowTypes // - this.labelPopupShowTypes.AutoSize = true; - this.labelPopupShowTypes.Location = new System.Drawing.Point(8, 24); - this.labelPopupShowTypes.Name = "labelPopupShowTypes"; - this.labelPopupShowTypes.Size = new System.Drawing.Size(147, 13); - this.labelPopupShowTypes.TabIndex = 0; - this.labelPopupShowTypes.Text = "Show these message types:"; + labelPopupShowTypes.AutoSize = true; + labelPopupShowTypes.Location = new System.Drawing.Point(8, 24); + labelPopupShowTypes.Name = "labelPopupShowTypes"; + labelPopupShowTypes.Size = new System.Drawing.Size(147, 13); + labelPopupShowTypes.TabIndex = 0; + labelPopupShowTypes.Text = "Show these message types:"; + // + // lblRegistrySettingsUsedInfo + // + lblRegistrySettingsUsedInfo.BackColor = System.Drawing.SystemColors.ControlLight; + lblRegistrySettingsUsedInfo.Dock = System.Windows.Forms.DockStyle.Top; + lblRegistrySettingsUsedInfo.ForeColor = System.Drawing.SystemColors.ControlText; + lblRegistrySettingsUsedInfo.Location = new System.Drawing.Point(0, 379); + lblRegistrySettingsUsedInfo.Name = "lblRegistrySettingsUsedInfo"; + lblRegistrySettingsUsedInfo.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0); + lblRegistrySettingsUsedInfo.Size = new System.Drawing.Size(610, 30); + lblRegistrySettingsUsedInfo.TabIndex = 3; + lblRegistrySettingsUsedInfo.Text = "Some settings are configured by your Administrator. Please contact your administrator for more information."; + lblRegistrySettingsUsedInfo.Visible = false; // // NotificationsPage // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.groupBoxPopups); - this.Controls.Add(this.groupBoxLogging); - this.Controls.Add(this.groupBoxNotifications); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Name = "NotificationsPage"; - this.Size = new System.Drawing.Size(610, 490); - this.groupBoxNotifications.ResumeLayout(false); - this.groupBoxNotifications.PerformLayout(); - this.groupBoxLogging.ResumeLayout(false); - this.groupBoxLogging.PerformLayout(); - this.tblLogging.ResumeLayout(false); - this.tblLogging.PerformLayout(); - this.groupBoxPopups.ResumeLayout(false); - this.groupBoxPopups.PerformLayout(); - this.tblPopups.ResumeLayout(false); - this.tblPopups.PerformLayout(); - this.ResumeLayout(false); - - } + AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + Controls.Add(groupBoxPopups); + Controls.Add(groupBoxLogging); + Controls.Add(groupBoxNotifications); + Controls.Add(lblRegistrySettingsUsedInfo); + Margin = new System.Windows.Forms.Padding(4); + Name = "NotificationsPage"; + Size = new System.Drawing.Size(610, 490); + groupBoxNotifications.ResumeLayout(false); + groupBoxNotifications.PerformLayout(); + groupBoxLogging.ResumeLayout(false); + groupBoxLogging.PerformLayout(); + tblLogging.ResumeLayout(false); + tblLogging.PerformLayout(); + groupBoxPopups.ResumeLayout(false); + groupBoxPopups.PerformLayout(); + tblPopups.ResumeLayout(false); + tblPopups.PerformLayout(); + ResumeLayout(false); + } internal Controls.MrngLabel labelSwitchToErrorsAndInfos; internal MrngCheckBox chkSwitchToMCInformation; @@ -490,5 +509,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages private MrngGroupBox groupBoxNotifications; private MrngGroupBox groupBoxLogging; private MrngGroupBox groupBoxPopups; + internal System.Windows.Forms.Label lblRegistrySettingsUsedInfo; } } diff --git a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.cs b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.cs index 7a40c08d..0fdcf6b4 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.cs @@ -1,8 +1,10 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.IO; using System.Runtime.Versioning; using System.Windows.Forms; using mRemoteNG.App; +using mRemoteNG.Config.Settings.Registry; using mRemoteNG.Properties; using mRemoteNG.Resources.Language; @@ -11,6 +13,10 @@ namespace mRemoteNG.UI.Forms.OptionsPages [SupportedOSPlatform("windows")] public sealed partial class NotificationsPage { + #region Private Fields + private OptRegistryNotificationsPage pageRegSettingsInstance; + #endregion + public NotificationsPage() { InitializeComponent(); @@ -60,6 +66,9 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkPopupInfo.Text = Language.Informations; chkPopupWarning.Text = Language.Warnings; chkPopupError.Text = Language.Errors; + + // Registry Settings Used Info + lblRegistrySettingsUsedInfo.Text = Language.OptionsCompanyPolicyMessage; } public override void LoadSettings() @@ -135,6 +144,148 @@ namespace mRemoteNG.UI.Forms.OptionsPages Properties.OptionsNotificationsPage.Default.PopupMessageWriterWriteErrorMsgs = chkPopupError.Checked; } + public override void LoadRegistrySettings() + { + Type settingsType = typeof(OptRegistryNotificationsPage); + RegistryLoader.RegistrySettings.TryGetValue(settingsType, out var settings); + pageRegSettingsInstance = settings as OptRegistryNotificationsPage; + + RegistryLoader.Cleanup(settingsType); + + LoadRegistryNotificationPanelSettings(); + LoadRegistryLoggingSettings(); + LoadRegistryPopupSettings(); + + // Updates the visibility of the information label indicating whether registry settings are used. + lblRegistrySettingsUsedInfo.Visible = ShowRegistrySettingsUsedInfo(); + } + + private void LoadRegistryNotificationPanelSettings() + { + if (!CommonRegistrySettings.AllowNotifications) + { + DisableControl(groupBoxNotifications); + return; + } + + // *** + // Disable controls based on the registry settings. + // + if (pageRegSettingsInstance.NfpWriteDebugMsgs.IsSet) + DisableControl(chkShowDebugInMC); + + if (pageRegSettingsInstance.NfpWriteInfoMsgs.IsSet) + DisableControl(chkShowInfoInMC); + + if (pageRegSettingsInstance.NfpWriteWarningMsgs.IsSet) + DisableControl(chkShowWarningInMC); + + if (pageRegSettingsInstance.NfpWriteErrorMsgs.IsSet) + DisableControl(chkShowErrorInMC); + + if (pageRegSettingsInstance.SwitchToMCOnInformation.IsSet) + DisableControl(chkSwitchToMCInformation); + + if (pageRegSettingsInstance.SwitchToMCOnWarning.IsSet) + DisableControl(chkSwitchToMCWarnings); + + if (pageRegSettingsInstance.SwitchToMCOnError.IsSet) + DisableControl(chkSwitchToMCErrors); + + } + + private void LoadRegistryLoggingSettings() + { + if (!CommonRegistrySettings.AllowLogging) + { + DisableControl(groupBoxLogging); + return; + } + + // *** + // Disable controls based on the registry settings. + // + if (pageRegSettingsInstance.LogToApplicationDirectory.IsSet) + DisableControl(chkLogToCurrentDir); + + if (pageRegSettingsInstance.LogFilePath.IsSet) + { + DisableControl(textBoxLogPath); + DisableControl(buttonRestoreDefaultLogPath); + DisableControl(buttonSelectLogPath); + DisableControl(chkLogToCurrentDir); + } + + if (pageRegSettingsInstance.LfWriteDebugMsgs.IsSet) + DisableControl(chkLogDebugMsgs); + + if (pageRegSettingsInstance.LfWriteInfoMsgs.IsSet) + DisableControl(chkLogInfoMsgs); + + if (pageRegSettingsInstance.LfWriteWarningMsgs.IsSet) + DisableControl(chkLogWarningMsgs); + + if (pageRegSettingsInstance.LfWriteErrorMsgs.IsSet) + DisableControl(chkLogErrorMsgs); + } + + private void LoadRegistryPopupSettings() + { + if (!CommonRegistrySettings.AllowPopups) + { + DisableControl(groupBoxPopups); + return; + } + + // *** + // Disable controls based on the registry settings. + // + if (pageRegSettingsInstance.PuWriteDebugMsgs.IsSet) + DisableControl(chkPopupDebug); + + if (pageRegSettingsInstance.PuWriteInfoMsgs.IsSet) + DisableControl(chkPopupInfo); + + if (pageRegSettingsInstance.PuWriteWarningMsgs.IsSet) + DisableControl(chkPopupWarning); + + if (pageRegSettingsInstance.PuWriteErrorMsgs.IsSet) + DisableControl(chkPopupError); + } + + public bool ShowRegistrySettingsUsedInfo() + { + bool CommonSettings = + !CommonRegistrySettings.AllowNotifications + || !CommonRegistrySettings.AllowLogging + || !CommonRegistrySettings.AllowPopups; + + bool NotificationPanelSettings = + pageRegSettingsInstance.NfpWriteDebugMsgs.IsSet + || pageRegSettingsInstance.NfpWriteInfoMsgs.IsSet + || pageRegSettingsInstance.NfpWriteWarningMsgs.IsSet + || pageRegSettingsInstance.NfpWriteErrorMsgs.IsSet + || pageRegSettingsInstance.SwitchToMCOnInformation.IsSet + || pageRegSettingsInstance.SwitchToMCOnWarning.IsSet + || pageRegSettingsInstance.SwitchToMCOnError.IsSet; + + bool LoggingSettings = + pageRegSettingsInstance.LogToApplicationDirectory.IsSet + || pageRegSettingsInstance.LogFilePath.IsSet + || pageRegSettingsInstance.LfWriteDebugMsgs.IsSet + || pageRegSettingsInstance.LfWriteInfoMsgs.IsSet + || pageRegSettingsInstance.LfWriteWarningMsgs.IsSet + || pageRegSettingsInstance.LfWriteErrorMsgs.IsSet; + + bool PopupSettings = + pageRegSettingsInstance.PuWriteDebugMsgs.IsSet + || pageRegSettingsInstance.PuWriteInfoMsgs.IsSet + || pageRegSettingsInstance.PuWriteWarningMsgs.IsSet + || pageRegSettingsInstance.PuWriteErrorMsgs.IsSet; + + return CommonSettings || NotificationPanelSettings || LoggingSettings || PopupSettings; + } + private void buttonSelectLogPath_Click(object sender, System.EventArgs e) { string currentFile = textBoxLogPath.Text; @@ -189,7 +340,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages return true; } catch - { + { // If necessary, the error can be logged here. return false; } @@ -225,11 +376,11 @@ namespace mRemoteNG.UI.Forms.OptionsPages { try { - /// when all fails open filelocation to logfile... + // when all fails open filelocation to logfile... // Open Windows Explorer to the directory containing the file Process.Start("explorer.exe", $"/select,\"{path}\""); - return true; - } + return true; + } catch { // If necessary, the error can be logged here. diff --git a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.resx b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.resx index 5324ee22..53dd5f2d 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.resx +++ b/mRemoteNG/UI/Forms/OptionsPages/NotificationsPage.resx @@ -1,17 +1,17 @@  - diff --git a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.Designer.cs b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.Designer.cs index a6ea557a..8580e639 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.Designer.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.Designer.cs @@ -35,10 +35,12 @@ namespace mRemoteNG.UI.Forms.OptionsPages private void InitializeComponent() { chkReconnectOnStart = new MrngCheckBox(); - chkSaveConsOnExit = new MrngCheckBox(); chkSingleInstance = new MrngCheckBox(); chkStartMinimized = new MrngCheckBox(); chkStartFullScreen = new MrngCheckBox(); + pnlOptions = new System.Windows.Forms.Panel(); + lblRegistrySettingsUsedInfo = new System.Windows.Forms.Label(); + pnlOptions.SuspendLayout(); SuspendLayout(); // // chkReconnectOnStart @@ -46,31 +48,19 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkReconnectOnStart._mice = MrngCheckBox.MouseState.OUT; chkReconnectOnStart.AutoSize = true; chkReconnectOnStart.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkReconnectOnStart.Location = new System.Drawing.Point(8, 31); + chkReconnectOnStart.Location = new System.Drawing.Point(6, 4); chkReconnectOnStart.Name = "chkReconnectOnStart"; chkReconnectOnStart.Size = new System.Drawing.Size(295, 17); chkReconnectOnStart.TabIndex = 1; chkReconnectOnStart.Text = "Reconnect to previously opened sessions on startup"; chkReconnectOnStart.UseVisualStyleBackColor = true; // - // chkSaveConsOnExit - // - chkSaveConsOnExit._mice = MrngCheckBox.MouseState.OUT; - chkSaveConsOnExit.AutoSize = true; - chkSaveConsOnExit.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkSaveConsOnExit.Location = new System.Drawing.Point(8, 7); - chkSaveConsOnExit.Name = "chkSaveConsOnExit"; - chkSaveConsOnExit.Size = new System.Drawing.Size(153, 17); - chkSaveConsOnExit.TabIndex = 0; - chkSaveConsOnExit.Text = "Save connections on exit"; - chkSaveConsOnExit.UseVisualStyleBackColor = true; - // // chkSingleInstance // chkSingleInstance._mice = MrngCheckBox.MouseState.OUT; chkSingleInstance.AutoSize = true; chkSingleInstance.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkSingleInstance.Location = new System.Drawing.Point(8, 55); + chkSingleInstance.Location = new System.Drawing.Point(6, 27); chkSingleInstance.Name = "chkSingleInstance"; chkSingleInstance.Size = new System.Drawing.Size(404, 17); chkSingleInstance.TabIndex = 2; @@ -82,7 +72,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkStartMinimized._mice = MrngCheckBox.MouseState.OUT; chkStartMinimized.AutoSize = true; chkStartMinimized.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkStartMinimized.Location = new System.Drawing.Point(8, 78); + chkStartMinimized.Location = new System.Drawing.Point(6, 50); chkStartMinimized.Name = "chkStartMinimized"; chkStartMinimized.Size = new System.Drawing.Size(105, 17); chkStartMinimized.TabIndex = 3; @@ -95,7 +85,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkStartFullScreen._mice = MrngCheckBox.MouseState.OUT; chkStartFullScreen.AutoSize = true; chkStartFullScreen.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - chkStartFullScreen.Location = new System.Drawing.Point(8, 101); + chkStartFullScreen.Location = new System.Drawing.Point(6, 73); chkStartFullScreen.Name = "chkStartFullScreen"; chkStartFullScreen.Size = new System.Drawing.Size(109, 17); chkStartFullScreen.TabIndex = 4; @@ -103,26 +93,50 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkStartFullScreen.UseVisualStyleBackColor = true; chkStartFullScreen.CheckedChanged += chkStartFullScreen_CheckedChanged; // + // pnlOptions + // + pnlOptions.Controls.Add(chkStartFullScreen); + pnlOptions.Controls.Add(chkReconnectOnStart); + pnlOptions.Controls.Add(chkStartMinimized); + pnlOptions.Controls.Add(chkSingleInstance); + pnlOptions.Dock = System.Windows.Forms.DockStyle.Top; + pnlOptions.Location = new System.Drawing.Point(0, 30); + pnlOptions.Name = "pnlOptions"; + pnlOptions.Size = new System.Drawing.Size(610, 135); + pnlOptions.TabIndex = 0; + // + // lblRegistrySettingsUsedInfo + // + lblRegistrySettingsUsedInfo.BackColor = System.Drawing.SystemColors.ControlLight; + lblRegistrySettingsUsedInfo.Dock = System.Windows.Forms.DockStyle.Top; + lblRegistrySettingsUsedInfo.ForeColor = System.Drawing.SystemColors.ControlText; + lblRegistrySettingsUsedInfo.Location = new System.Drawing.Point(0, 0); + lblRegistrySettingsUsedInfo.Name = "lblRegistrySettingsUsedInfo"; + lblRegistrySettingsUsedInfo.Padding = new System.Windows.Forms.Padding(0, 2, 0, 0); + lblRegistrySettingsUsedInfo.Size = new System.Drawing.Size(610, 30); + lblRegistrySettingsUsedInfo.TabIndex = 0; + lblRegistrySettingsUsedInfo.Text = "Some settings are configured by your Administrator. Please contact your administrator for more information."; + lblRegistrySettingsUsedInfo.Visible = false; + // // StartupExitPage // AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - Controls.Add(chkStartFullScreen); - Controls.Add(chkReconnectOnStart); - Controls.Add(chkSaveConsOnExit); - Controls.Add(chkSingleInstance); - Controls.Add(chkStartMinimized); + Controls.Add(pnlOptions); + Controls.Add(lblRegistrySettingsUsedInfo); Name = "StartupExitPage"; Size = new System.Drawing.Size(610, 490); Load += StartupExitPage_Load; + pnlOptions.ResumeLayout(false); + pnlOptions.PerformLayout(); ResumeLayout(false); - PerformLayout(); } internal MrngCheckBox chkReconnectOnStart; - internal MrngCheckBox chkSaveConsOnExit; internal MrngCheckBox chkSingleInstance; internal MrngCheckBox chkStartMinimized; internal MrngCheckBox chkStartFullScreen; + internal System.Windows.Forms.Label lblRegistrySettingsUsedInfo; + internal System.Windows.Forms.Panel pnlOptions; } } diff --git a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.cs b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.cs index 560f61c8..3a1c2f0d 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.cs +++ b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.Versioning; +using mRemoteNG.Config.Settings.Registry; using mRemoteNG.Properties; using mRemoteNG.Resources.Language; @@ -8,7 +9,12 @@ namespace mRemoteNG.UI.Forms.OptionsPages [SupportedOSPlatform("windows")] public sealed partial class StartupExitPage { - [SupportedOSPlatform("windows")] + #region Private Fields + + private OptRegistryStartupExitPage pageRegSettingsInstance; + + #endregion + public StartupExitPage() { InitializeComponent(); @@ -29,6 +35,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages chkReconnectOnStart.Text = Language.ReconnectAtStartup; chkSingleInstance.Text = Language.AllowOnlySingleInstance; chkStartMinimized.Text = Language.StartMinimized; + lblRegistrySettingsUsedInfo.Text = Language.OptionsCompanyPolicyMessage; } public override void SaveSettings() @@ -41,13 +48,62 @@ namespace mRemoteNG.UI.Forms.OptionsPages Properties.OptionsStartupExitPage.Default.StartFullScreen = chkStartFullScreen.Checked; } + public override void LoadRegistrySettings() + { + Type settingsType = typeof(OptRegistryStartupExitPage); + RegistryLoader.RegistrySettings.TryGetValue(settingsType, out var settings); + pageRegSettingsInstance = settings as OptRegistryStartupExitPage; + + RegistryLoader.Cleanup(settingsType); + + // Disable Controls depending on the value ("None", "Minimized", or "FullScreen") + if (pageRegSettingsInstance.StartupBehavior.IsSet) + { + switch (pageRegSettingsInstance.StartupBehavior.Value) + { + case "None": + DisableControl(chkStartMinimized); + DisableControl(chkStartFullScreen); + break; + case "Minimized": + DisableControl(chkStartMinimized); + DisableControl(chkStartFullScreen); + break; + case "FullScreen": + DisableControl(chkStartMinimized); + DisableControl(chkStartFullScreen); + break; + } + } + + // *** + // Disable controls based on the registry settings. + // + if (pageRegSettingsInstance.OpenConnectionsFromLastSession.IsSet) + DisableControl(chkReconnectOnStart); + + if (pageRegSettingsInstance.EnforceSingleApplicationInstance.IsSet) + DisableControl(chkSingleInstance); + + lblRegistrySettingsUsedInfo.Visible = ShowRegistrySettingsUsedInfo(); + } + + /// + /// Checks if specific registry settings related to appearence page are used. + /// + private bool ShowRegistrySettingsUsedInfo() + { + return pageRegSettingsInstance.OpenConnectionsFromLastSession.IsSet + || pageRegSettingsInstance.EnforceSingleApplicationInstance.IsSet + || pageRegSettingsInstance.StartupBehavior.IsSet; + } + private void StartupExitPage_Load(object sender, EventArgs e) { chkReconnectOnStart.Checked = Properties.OptionsStartupExitPage.Default.OpenConsFromLastSession; chkSingleInstance.Checked = Properties.OptionsStartupExitPage.Default.SingleInstance; chkStartMinimized.Checked = Properties.OptionsStartupExitPage.Default.StartMinimized; chkStartFullScreen.Checked = Properties.OptionsStartupExitPage.Default.StartFullScreen; - ; } private void chkStartFullScreen_CheckedChanged(object sender, EventArgs e) diff --git a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.resx b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.resx index f298a7be..8b2ff64a 100644 --- a/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.resx +++ b/mRemoteNG/UI/Forms/OptionsPages/StartupExitPage.resx @@ -1,4 +1,64 @@ - + + +