diff --git a/Scripts/build-nightly-2022-custom.cmd b/Scripts/build-nightly-2022-custom.cmd new file mode 100644 index 000000000..17ce9bb01 --- /dev/null +++ b/Scripts/build-nightly-2022-custom.cmd @@ -0,0 +1,44 @@ +@echo off + +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin" goto vs17prev +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin" goto vs17ent +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin" goto vs17pro +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin" goto vs17com +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin" goto vs17build + +echo "Unable to detect suitable environment. Check if VS 2022 is installed." + +pause + +:vs17prev +set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin +goto build + +:vs17ent +set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin +goto build + +:vs17pro +set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin +goto build + +:vs17com +set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin +goto build + +:vs17build +set msbuildpath=%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin +goto build + +:build +for /f "tokens=* usebackq" %%A in (`tzutil /g`) do ( + set "zone=%%A" +) + +@echo Started: %date% %time% %zone% +@echo +set targets=Build +if not "%~1" == "" set targets=%~1 +"%msbuildpath%\msbuild.exe" /t:%targets% nightly.proj /fl /flp:logfile=build.log + +@echo Build Completed: %date% %time% %zone% \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs index 5127a768f..020a1acce 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs @@ -15,6 +15,8 @@ public class ButtonSpecNavFormClose : ButtonSpecNavFixed private bool _enabled = true; + private KryptonNavigator _navigator; + #endregion #region Identity @@ -23,13 +25,13 @@ public class ButtonSpecNavFormClose : ButtonSpecNavFixed /// The navigator. public ButtonSpecNavFormClose(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.FormClose) { + _navigator = navigator; } #endregion #region Implementation - /* /// /// Form Close Button Enabled: This will also Disable the System Menu `Close` BUT NOT the `Alt+F4` key action /// @@ -44,7 +46,7 @@ public bool Enabled if (_enabled != value) { _enabled = value; - IntPtr hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false); + IntPtr hSystemMenu = PI.GetSystemMenu(_navigator.Owner!.Handle, false); if (hSystemMenu != IntPtr.Zero) { PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED); @@ -52,24 +54,58 @@ public bool Enabled } } } - */ + #endregion #region ButtonSpecNavFixed Implementation public override bool GetVisible(PaletteBase palette) { - throw new NotImplementedException(); - } + // We do not show if the custom chrome is combined with composition, + // in which case the form buttons are handled by the composition + if (_navigator.Owner!.ApplyComposition && _navigator.Owner.ApplyCustomChrome) + { + return false; + } - public override ButtonCheckState GetChecked(PaletteBase palette) - { - throw new NotImplementedException(); + // Have all buttons been turned off? + return _navigator.Owner.ControlBox && _navigator.Owner.CloseBox; } - public override ButtonEnabled GetEnabled(PaletteBase palette) + public override ButtonCheckState GetChecked(PaletteBase palette) => ButtonCheckState.NotCheckButton; + + public override ButtonEnabled GetEnabled(PaletteBase palette) => _navigator.Owner!.CloseBox && Enabled ? ButtonEnabled.True : ButtonEnabled.False; + + #endregion + + #region Protected Overrides + + protected override void OnClick(EventArgs e) { - throw new NotImplementedException(); + if (GetViewEnabled()) + { + if (!_navigator.Owner.InertForm) + { + MouseEventArgs mea = (MouseEventArgs)e; + + if (GetView().ClientRectangle.Contains(mea.Location)) + { + PropertyInfo? propertyInfo = typeof(Form).GetProperty(nameof(CloseReason), + BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.NonPublic); + + propertyInfo.SetValue(_navigator.Owner, CloseReason.UserClosing, null); + + Point screenPosition = Control.MousePosition; + + IntPtr lParam = (IntPtr)(PI.MAKELOWORD(screenPosition.X) | PI.MAKEHIWORD(screenPosition.Y)); + + // Note: Do I need to make 'SC_' public? + //? Navigator.Owner.SendSysCommand(PI.SC_.CLOSE, lParam); + + base.OnClick(e); + } + } + } } #endregion diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs index d8b618a92..96d072bfd 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs @@ -11,23 +11,86 @@ namespace Krypton.Navigator { public class ButtonSpecNavFormMaximize : ButtonSpecNavFixed { + #region Instance Fields + + private KryptonNavigator _navigator; + + #endregion + + #region Identity + + /// Initializes a new instance of the class. + /// The navigator. public ButtonSpecNavFormMaximize(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.FormMax) { + _navigator = navigator; } + #endregion + + #region ButtonSpecNavFixed Implementation + public override bool GetVisible(PaletteBase palette) { - throw new NotImplementedException(); - } + // We do not show if the custom chrome is combined with composition, + // in which case the form buttons are handled by the composition + if (_navigator.Owner!.ApplyComposition && _navigator.Owner!.ApplyCustomChrome) + { + return false; + } - public override ButtonCheckState GetChecked(PaletteBase palette) - { - throw new NotImplementedException(); + // The maximize button is never present on tool windows + switch (_navigator.Owner!.FormBorderStyle) + { + case FormBorderStyle.FixedToolWindow: + case FormBorderStyle.SizableToolWindow: + return false; + } + + // Have all buttons been turned off? + if (!_navigator.Owner!.ControlBox) + { + return false; + } + + // Has the minimize/maximize buttons been turned off? + return _navigator.Owner!.MinimizeBox || _navigator.Owner!.MaximizeBox; } - public override ButtonEnabled GetEnabled(PaletteBase palette) + public override ButtonCheckState GetChecked(PaletteBase palette) => ButtonCheckState.NotCheckButton; + + public override ButtonEnabled GetEnabled(PaletteBase palette) => + // Has the maximize buttons been turned off? + _navigator.Owner!.MaximizeBox ? ButtonEnabled.True : ButtonEnabled.False; + + #endregion + + #region Protected Overrides + + protected override void OnClick(EventArgs e) { - throw new NotImplementedException(); + // Only if associated view is enabled to we perform an action + if (GetViewEnabled()) + { + // If we do not provide an inert form + if (!_navigator.Owner!.InertForm) + { + // Only if the mouse is still within the button bounds do we perform action + MouseEventArgs mea = (MouseEventArgs)e; + if (GetView().ClientRectangle.Contains(mea.Location)) + { + // Toggle between maximized and restored + /*_navigator.Owner!.SendSysCommand(_navigator.Owner!.WindowState == FormWindowState.Maximized + ? PI.SC_.RESTORE + : PI.SC_.MAXIMIZE);*/ + + // Let base class fire any other attached events + base.OnClick(e); + } + } + } } + + #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormRestore.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormRestore.cs deleted file mode 100644 index bb568b373..000000000 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormRestore.cs +++ /dev/null @@ -1,33 +0,0 @@ -#region BSD License -/* - * - * New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE) - * Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2023 - 2023. All rights reserved. - * - */ -#endregion - -namespace Krypton.Navigator -{ - public class ButtonSpecNavFormRestore : ButtonSpecNavFixed - { - public ButtonSpecNavFormRestore(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.FormRestore) - { - } - - public override bool GetVisible(PaletteBase palette) - { - throw new NotImplementedException(); - } - - public override ButtonCheckState GetChecked(PaletteBase palette) - { - throw new NotImplementedException(); - } - - public override ButtonEnabled GetEnabled(PaletteBase palette) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs index bedc6c28e..ba3a27b73 100644 --- a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs +++ b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs @@ -43,6 +43,7 @@ public class KryptonNavigator : VisualSimple, private VisualPopupPage? _visualPopupPage; private VisualPopupToolTip? _visualPopupToolTip; private KryptonPage[]? _dragPages; + private KryptonForm? _owner; private bool _forcedLayout; private bool _layingOut; private bool _pageDragging; @@ -50,6 +51,7 @@ public class KryptonNavigator : VisualSimple, private bool _allowTabFocus; private bool _allowTabSelect; private bool _tabHoverStarted; + private bool _controlKryptonFormFeatures; private int _cachePageCount; private int _cachePageVisibleCount; @@ -507,6 +509,10 @@ public KryptonPage? SelectedPage } } + public KryptonForm? Owner { get => _owner; set => _owner = value ?? null; } + + public bool ControlKryptonFormFeatures { get => _controlKryptonFormFeatures; set => _controlKryptonFormFeatures = value; } + /// /// Gets access to the bar specific settings. /// @@ -1204,8 +1210,8 @@ protected override void OnMouseDown(MouseEventArgs e) ViewBase? element = ViewManager?.Root?.ViewFromPoint(new Point(e.X, e.Y)); // Ask the view builder if pressing the element needs to give us focus - if (ViewBuilder != null - && element != null + if (ViewBuilder != null + && element != null && ViewBuilder.GiveNavigatorFocus(element) ) { @@ -1237,7 +1243,7 @@ protected override bool ProcessKeyPreview(ref Message m) if (CommonHelper.IsShiftKeyPressed) { // If the focus has been moved to a page that does not have the focus - if (SelectedPage is { ContainsFocus: false } ) + if (SelectedPage is { ContainsFocus: false }) { // We need to force another TAB+SHIFT to move the focus backwards foreach (KryptonPage page in Pages) @@ -1292,7 +1298,7 @@ protected override bool ProcessDialogKey(Keys keyData) { // CONTROL tabbing around the pages in the navigator // is handled in a view specific way - if (ViewBuilder != null) + if (ViewBuilder != null) handled = ViewBuilder.ProcessDialogKey(keyData); } } @@ -2190,6 +2196,8 @@ private void AssignDefaultFields() _allowTabFocus = true; _allowTabSelect = true; UseMnemonic = true; + _owner = null; + _controlKryptonFormFeatures = false; } private void CreatePageCollection() @@ -2896,7 +2904,7 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) { // Do not show tooltips when the form we are in does not have focus Form? topForm = FindForm(); - if (topForm is { ContainsFocus: false } ) + if (topForm is { ContainsFocus: false }) { return; } @@ -2995,7 +3003,7 @@ private void OnStartHover(object sender, ToolTipEventArgs e) { // We do not provide hover support when the form does not have the focus Form? topForm = FindForm(); - if (topForm is { ContainsFocus: false } ) + if (topForm is { ContainsFocus: false }) { return; } @@ -3133,9 +3141,9 @@ internal bool SelectNextPageControl(bool forward, bool onlyCurrentPage) else { // We can only be the next control if we accept the focus - if (ViewBuilder != null - && ((next != this) - || ((next == this) + if (ViewBuilder != null + && ((next != this) + || ((next == this) && ViewBuilder.CanFocus) ) ) @@ -3221,7 +3229,7 @@ private bool NextOnUnselectedKryptonPage(Control? next) next = next.Parent; // Keep going until we reach the top of the parent chain - } + } // Did not find the control is on a KryptonPage, so definitely not on an unselected KryptonPage return false; diff --git a/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs index 26f145ba3..23b83efa0 100644 --- a/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs +++ b/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs @@ -42,4 +42,4 @@ [assembly: Dependency(nameof(System), LoadHint.Always)] [assembly: Dependency("System.Drawing", LoadHint.Always)] [assembly: Dependency("System.Windows.Forms", LoadHint.Always)] -[assembly: Dependency("Krypton.Toolkit", LoadHint.Always)] +[assembly: Dependency("Krypton.Toolkit", LoadHint.Always)] \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs index dcd973cca..76e6e94a8 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs @@ -67,7 +67,6 @@ public NavigatorButton(KryptonNavigator navigator, CloseButton = new ButtonSpecNavClose(_navigator); FormCloseButton = new ButtonSpecNavFormClose(_navigator); FormMaximizeButton = new ButtonSpecNavFormMaximize(_navigator); - FormRestoreButton = new ButtonSpecNavFormRestore(_navigator); FormMinimizeButton = new ButtonSpecNavFormMinimize(_navigator); // Hook into the click events for the buttons @@ -78,10 +77,16 @@ public NavigatorButton(KryptonNavigator navigator, FormCloseButton.Click += OnCloseButtonClick; FormMinimizeButton.Click += OnMinimizeButtonClick; FormMaximizeButton.Click += OnMaximizeButtonClick; - FormRestoreButton.Click += OnRestoreButtonClick; // Add fixed buttons into the display collection - FixedSpecs.AddRange(new ButtonSpecNavFixed[] { PreviousButton, NextButton, ContextButton, CloseButton }); + if (_navigator.Owner != null && !_navigator.ControlKryptonFormFeatures) + { + FixedSpecs.AddRange(new ButtonSpecNavFixed[] { PreviousButton, NextButton, ContextButton, CloseButton, FormMinimizeButton, FormMaximizeButton, FormCloseButton }); + } + else + { + FixedSpecs.AddRange(new ButtonSpecNavFixed[] { PreviousButton, NextButton, ContextButton, CloseButton }); + } // Default fields _displayLogic = ButtonDisplayLogic.Context; @@ -513,20 +518,6 @@ public void ResetCloseButtonShortcut() #endregion - #region FormRestoreButton - - /// - /// Gets access to the form restore button specification. - /// - [Category(@"Visuals")] - [Description(@"Form restore button specification.")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ButtonSpecNavFormRestore FormRestoreButton { get; } - - private bool ShouldSerializeFormRestoreButton() => !FormRestoreButton.IsDefault; - - #endregion - #region ButtonDisplayLogic /// /// Gets and sets the logic used to control button display. @@ -583,11 +574,6 @@ private void OnCloseClick(object sender, EventArgs e) _navigator.PerformCloseAction(); } - private void OnRestoreButtonClick(object sender, EventArgs e) - { - throw new NotImplementedException(); - } - private void OnMaximizeButtonClick(object sender, EventArgs e) { throw new NotImplementedException(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs index ac29fc41e..474280cb2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs @@ -47,3 +47,4 @@ [assembly: Dependency(@"System.Drawing", LoadHint.Always)] [assembly: Dependency(@"System.Windows.Forms", LoadHint.Always)] [assembly: Dependency(@"Krypton.Toolkit", LoadHint.Always)] +[assembly: InternalsVisibleTo(@"Krypton.Toolkit, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)] diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs index 4927f9307..094a514a6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs @@ -25,7 +25,7 @@ public class ButtonSpecFormWindowMax : ButtonSpecFormFixed public ButtonSpecFormWindowMax(KryptonForm form) : base(form, PaletteButtonSpecStyle.FormMax) { - } + } #endregion #region IButtonSpecValues diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonManager.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonManager.cs index 2dcb86efd..f1af60c62 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonManager.cs @@ -412,10 +412,10 @@ public bool GlobalAllowFormChrome [Category(@"Visuals")] [Description(@"")] [DefaultValue(null)] - public KryptonCustomPaletteManager? CustomPaletteManager - { - get => _customPaletteManager; - set => _customPaletteManager = value; + public KryptonCustomPaletteManager? CustomPaletteManager + { + get => _customPaletteManager; + set => _customPaletteManager = value; } /// Specify a custom palette outside the existing palettes. @@ -423,10 +423,10 @@ public KryptonCustomPaletteManager? CustomPaletteManager [Category(@"Visuals")] [Description(@"Specify a custom palette outside the existing palettes.")] [DefaultValue(null)] - public PaletteBase? CustomPalette - { - get => _customPalette; - set => _customPalette = value; + public PaletteBase? CustomPalette + { + get => _customPalette; + set => _customPalette = value; } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs index d0f700178..2ea00ad31 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs @@ -52,6 +52,9 @@ public class GlobalStrings : GlobalId private const string DEFAULT_PASTE = @"Pas&te"; // Accelerator key - T private const string DEFAULT_SELECT_ALL = @"Sel&ect All"; // Accelerator key - E private const string DEFAULT_CLEAR_CLIPBOARD = @"Clear Clipboa&rd"; // Accelerator key - R + private const string DEFAULT_YES_TO_ALL = @"Yes &to All"; // Accelerator key - T + private const string DEFAULT_NO_TO_ALL = @"No t&o All"; // Accelerator key - O + private const string DEFAULT_OK_TO_ALL = @"O&k to All"; // Accelerator key - K // Note: The following may not be needed... /*private const string DEFAULT_MORE_DETAILS = "M&ore Details..."; @@ -108,7 +111,10 @@ public GlobalStrings() Copy.Equals(DEFAULT_COPY) && Paste.Equals(DEFAULT_PASTE) && SelectAll.Equals(DEFAULT_SELECT_ALL) && - ClearClipboard.Equals(DEFAULT_CLEAR_CLIPBOARD); + ClearClipboard.Equals(DEFAULT_CLEAR_CLIPBOARD) && + YesToAll.Equals(DEFAULT_YES_TO_ALL) && + NoToAll.Equals(DEFAULT_NO_TO_ALL) && + OkToAll.Equals(DEFAULT_OK_TO_ALL); // Note: The following may not be needed... /*MoreDetails.Equals(DEFAULT_MORE_DETAILS) && LessDetails.Equals(DEFAULT_LESS_DETAILS);*/ @@ -148,6 +154,9 @@ public void Reset() Paste = DEFAULT_PASTE; SelectAll = DEFAULT_SELECT_ALL; ClearClipboard = DEFAULT_CLEAR_CLIPBOARD; + YesToAll = DEFAULT_YES_TO_ALL; + NoToAll = DEFAULT_NO_TO_ALL; + OkToAll = DEFAULT_OK_TO_ALL; // Note: The following may not be needed... /*MoreDetails = DEFAULT_MORE_DETAILS; @@ -386,6 +395,33 @@ public void Reset() [DefaultValue(DEFAULT_CLEAR_CLIPBOARD)] public string ClearClipboard { get; set; } + /// + /// Gets and sets the Yes to All string used in custom situations. + /// + [Localizable(true)] + [Category(@"Visuals")] + [Description(@"Yes to All string used for custom situations.")] + [DefaultValue(DEFAULT_YES_TO_ALL)] + public string YesToAll { get; set; } + + /// + /// Gets and sets the No to All string used in custom situations. + /// + [Localizable(true)] + [Category(@"Visuals")] + [Description(@"No to All string used for custom situations.")] + [DefaultValue(DEFAULT_NO_TO_ALL)] + public string NoToAll { get; set; } + + /// + /// Gets and sets the Ok to All string used in custom situations. + /// + [Localizable(true)] + [Category(@"Visuals")] + [Description(@"Ok to All string used for custom situations.")] + [DefaultValue(DEFAULT_OK_TO_ALL)] + public string OkToAll { get; set; } + // Note: The following may not be needed... /*/// Gets or sets the more details string used in expandable footers. diff --git a/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs b/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs index c99bd0a41..fbcb9d6c7 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs @@ -20,6 +20,7 @@ // ReSharper disable ClassNeverInstantiated.Global using System.Runtime.Versioning; + using Microsoft.Win32.SafeHandles; #pragma warning disable 649 @@ -64,7 +65,7 @@ public SafeModuleHandle() protected override bool ReleaseHandle() { return PI.FreeLibrary(handle); - } + } } internal partial class PI @@ -3982,7 +3983,7 @@ public enum GMEM : uint public static extern uint FormatMessage(FORMAT_MESSAGE_ dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer, uint nSize, string[] Arguments); - + [DllImport(Libraries.Kernel32, CharSet = CharSet.Auto)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] internal static extern IntPtr GlobalAlloc(GMEM uFlags, int dwBytes); @@ -4057,14 +4058,14 @@ public struct OFNOTIFYW #region DialogChangeStatus public enum CDN_ : uint { - FIRST = 0xFFFFFDA7, // -601 - INITDONE = (FIRST - 0x0000), - SELCHANGE = (FIRST - 0x0001), // -602 - FOLDERCHANGE = (FIRST - 0x0002), - SHAREVIOLATION = (FIRST - 0x0003), // -604 - HELP = (FIRST - 0x0004), - FILEOK = (FIRST - 0x0005), // -606 - TYPECHANGE = (FIRST - 0x0006), + FIRST = 0xFFFFFDA7, // -601 + INITDONE = (FIRST - 0x0000), + SELCHANGE = (FIRST - 0x0001), // -602 + FOLDERCHANGE = (FIRST - 0x0002), + SHAREVIOLATION = (FIRST - 0x0003), // -604 + HELP = (FIRST - 0x0004), + FILEOK = (FIRST - 0x0005), // -606 + TYPECHANGE = (FIRST - 0x0006), } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs index 761d1135a..134899520 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs @@ -50,6 +50,7 @@ global using Krypton.Toolkit.Resources; global using Microsoft.Win32; +global using Microsoft.Win32.SafeHandles; [assembly: CLSCompliant(true)] @@ -57,4 +58,5 @@ [assembly: Dependency(nameof(System), LoadHint.Always)] [assembly: Dependency(@"System.Drawing", LoadHint.Always)] [assembly: Dependency(@"System.Windows.Forms", LoadHint.Always)] - +[assembly: InternalsVisibleTo(@"Krypton.Navigator, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)] +[assembly: InternalsVisibleTo(@"Krypton.Ribbon, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)] \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs index 0e690c101..245c646b8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs @@ -106,20 +106,14 @@ private static PaletteMode ReturnPaletteMode(string themeName) /// Returns the palette mode. /// The palette mode manager. /// The selected . - private static PaletteMode ReturnPaletteMode(PaletteMode paletteMode) - { - return paletteMode; - } + private static PaletteMode ReturnPaletteMode(PaletteMode paletteMode) => paletteMode; /// /// Applies the theme. /// /// Name of the theme. /// The manager. - public static void ApplyTheme(string themeName, KryptonManager manager) - { - ApplyTheme(_supportedThemes.GetByFirst(themeName), manager); - } + public static void ApplyTheme(string themeName, KryptonManager manager) => ApplyTheme(_supportedThemes.GetByFirst(themeName), manager); /// /// Sets the theme. @@ -143,14 +137,14 @@ public static void SetTheme(string themeName, KryptonManager manager) /// /// Returns the palette mode manager as string. /// - /// The palette mode manager. + /// The palette mode manager. /// The manager. /// The chosen theme as a string. - public static string ReturnPaletteModeAsString(PaletteMode PaletteMode, KryptonManager manager = null) + public static string ReturnPaletteModeAsString(PaletteMode paletteMode, KryptonManager? manager) { - var paletteMode = manager?.GlobalPaletteMode ?? PaletteMode; + var mode = manager?.GlobalPaletteMode ?? paletteMode; - return _supportedThemes.GetBySecond(paletteMode); + return _supportedThemes.GetBySecond(mode); } /// @@ -213,12 +207,12 @@ public static string ReturnPaletteModeAsString(PaletteMode paletteMode) /// Applies the global theme. /// /// The manager. - /// The palette mode manager. - public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode PaletteMode) + /// The palette mode manager. + public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode paletteMode) { try { - manager.GlobalPaletteMode = PaletteMode; + manager.GlobalPaletteMode = paletteMode; } catch (Exception exc) { @@ -231,10 +225,7 @@ public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode PaletteM /// /// The target. /// do not include any string containing - public static void PropagateThemeSelector(KryptonComboBox target, params string[] excludePartials) - { - AddToCollection(target.Items, excludePartials); - } + public static void PropagateThemeSelector(KryptonComboBox target, params string[] excludePartials) => AddToCollection(target.Items, excludePartials); private static void AddToCollection(IList target, string[] excludes) { diff --git a/run.cmd b/run.cmd index 4a1a91c8d..05d418c9d 100644 --- a/run.cmd +++ b/run.cmd @@ -1,17 +1,17 @@ -:: Last updated: Sunday 4th December, 2022 @ 13:00 +:: Last updated: Monday 13th February, 2023 @ 11:00 @echo off cls -@echo Welcome to the Krypton Toolkit Build system, version: 1.6. Please select an option below. +@echo Welcome to the Krypton Toolkit Build system, version: 1.7. Please select an option below. @echo ============================================================================================== echo 1. Clean project echo 2. Build Krypton Toolkit echo 3. Create NuGet packages -echo 4. Build and create NuGet packages +echo 4. Clean, Build and create NuGet packages echo 5. Debug project echo 6. NuGet Tools echo 7. End @@ -40,7 +40,7 @@ cls echo 1. Clean project echo 2. Build Krypton Toolkit echo 3. Create NuGet packages -echo 4. Build and create NuGet packages +echo 4. Clean, Build and create NuGet packages echo 5. Debug project echo 6. NuGet Tools echo 7. End @@ -317,4 +317,82 @@ cls cd Scripts -update-nuget.cmd \ No newline at end of file +:: =================================================================================================== + +update-nuget.cmd + +:buildandcreatenugetpackages +cls + +echo 1. Build nightly packages using Visual Studio 2022 +echo 2. Build canary packages using Visual Studio 2022 +echo 3. Build stable packages using Visual Studio 2022 +echo 4. Build stable (lite) packages using Visual Studio 2022 +echo 5. Go back to main menu + +set /p answer="Enter number (1 - 5): " + +if %answer%==1 (goto buildnightlypackagesusingvisualstudio2022) +if %answer%==2 (goto buildcanarypackagesusingvisualstudio2022) +if %answer%==3 (goto buildstablepackagesusingvisualstudio2022) +if %answer%==4 (goto buildstablelitepackagesusingvisualstudio2022) +if %answer%==5 (goto mainmenu) + +@echo Invalid input, please try again. + +pause + +:: =================================================================================================== + +:buildnightlypackagesusingvisualstudio2022 +cls + +echo Step 1: Clean + +echo Deleting the 'Bin' folder +rd /s /q "Bin" +echo Deleted the 'Bin' folder +echo Deleting the 'Krypton.Docking\obj' folder +rd /s /q "Source\Krypton Components\Krypton.Docking\obj" +echo Deleted the 'Krypton.Docking\obj' folder +echo Deleting the 'Krypton.Navigator\obj' folder +rd /s /q "Source\Krypton Components\Krypton.Navigator\obj" +echo Deleted the 'Krypton.Navigator\obj' folder +echo Deleting the 'Krypton.Ribbon\obj' folder +rd /s /q "Source\Krypton Components\Krypton.Ribbon\obj" +echo Deleted the 'Krypton.Ribbon\obj' folder +echo Deleting the 'Krypton.Toolkit\obj' folder +rd /s /q "Source\Krypton Components\Krypton.Toolkit\obj" +echo Deleted the 'Krypton.Toolkit\obj' folder +echo Deleting the 'Krypton.Workspace\obj' folder +rd /s /q "Source\Krypton Components\Krypton.Workspace\obj" +echo Deleted the 'Krypton.Workspace\obj' folder +echo Deleting the 'build.log' file +del /f build.log +echo Deleted the 'build.log' file + +cls + +echo Step 2: Build + +cd Scripts + +build-nightly-2022-custom.cmd + +pause + +cls + +echo Step 3: Pack + +build-nightly-2022-custom.cmd Pack + +pause + +:: =================================================================================================== + + +:: =================================================================================================== + + +:: =================================================================================================== \ No newline at end of file