Skip to content

Commit

Permalink
* #1020
Browse files Browse the repository at this point in the history
  • Loading branch information
PWagner1 committed Jun 26, 2023
1 parent b9675bd commit 792ea7c
Show file tree
Hide file tree
Showing 11 changed files with 683 additions and 341 deletions.
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* New `KryptonLanguageManager.Strings` is now `KryptonLanguageManager.GeneralToolkitStrings`
* New `ShowSplitOption` for `KryptonButton`, allows a krypton/context menu to be shown
* Implemented [#1023](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1023), Please remove "sealed" from `KryptonWrapLabel` and `KryptonLinkWrapLabel`
* Resolved [#1020](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1020), Cannot add a `KryptonPage` to a `KryptonNavigator`
* Added ability to embed links into the `KryptonMessageBox` content. The new options are:-
- `ContentAreaType` - Defines content area type of a `KryptonMessageBox`, default is normal
- `LinkLabelCommand` - Specifies a `KryptonCommand` if using the `MessageBoxContentAreaType.LinkLabel` type.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ private void OnRemovePage(object sender, EventArgs e)

private void OnClearPages(object sender, EventArgs e)
{
if (MessageBox.Show(@"Are you sure that all pages should be removed?",
if (KryptonMessageBox.Show(@"Are you sure that all pages should be removed?",
@"Clear Pages",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning) == DialogResult.Yes)
KryptonMessageBoxButtons.YesNo,
KryptonMessageBoxIcon.Warning) == DialogResult.Yes)
{
// Use a transaction to support undo/redo actions
DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonNavigator RemovePage");
Expand Down
31 changes: 20 additions & 11 deletions Source/Krypton Components/Krypton.Navigator/Page/KryptonPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,62 +68,62 @@ public class KryptonPage : VisualPanel
/// </summary>
[Category(@"Page")]
[Description(@"Occurs when the control is loaded.")]
public event EventHandler Load;
public event EventHandler? Load;

/// <summary>
/// Occurs when an appearance specific page property has changed.
/// </summary>
[Category(@"Page")]
[Description(@"Occurs when an appearance specific page property has changed.")]
#pragma warning disable CA1070 // Do not declare event fields as virtual
public virtual event PropertyChangedEventHandler AppearancePropertyChanged;
public virtual event PropertyChangedEventHandler? AppearancePropertyChanged;
#pragma warning restore CA1070 // Do not declare event fields as virtual

/// <summary>
/// Occurs when the flags have changed.
/// </summary>
[Category(@"Page")]
[Description(@"Occurs when the flags have changed.")]
public event KryptonPageFlagsEventHandler FlagsChanged;
public event KryptonPageFlagsEventHandler? FlagsChanged;

/// <summary>
/// Occurs when the AutoHiddenSlideSize property has changed.
/// </summary>
[Category(@"Page")]
[Description(@"Occurs when the auto hidden slide size have changed.")]
public event EventHandler AutoHiddenSlideSizeChanged;
public event EventHandler? AutoHiddenSlideSizeChanged;

/// <summary>
/// Occurs when the value of the Dock property changes.
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new event EventHandler DockChanged;
public new event EventHandler? DockChanged;

/// <summary>
/// Occurs when the value of the Location property changes.
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new event EventHandler LocationChanged;
public new event EventHandler? LocationChanged;

/// <summary>
/// Occurs when the value of the TabIndex property changes.
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new event EventHandler TabIndexChanged;
public new event EventHandler? TabIndexChanged;

/// <summary>
/// Occurs when the value of the TabStop property changes.
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new event EventHandler TabStopChanged;
public new event EventHandler? TabStopChanged;
#endregion

#region Identity
Expand Down Expand Up @@ -1432,7 +1432,10 @@ protected override void OnEnabledChanged(EventArgs e)
/// <param name="e">An EventArgs containing the event data.</param>
protected override void OnDockChanged(EventArgs e)
{
DockChanged.Invoke(this, e);
if (DockChanged != null)
{
DockChanged.Invoke(this, e);
}
}

/// <summary>
Expand All @@ -1441,7 +1444,10 @@ protected override void OnDockChanged(EventArgs e)
/// <param name="e">An EventArgs containing the event data.</param>
protected override void OnLocationChanged(EventArgs e)
{
LocationChanged.Invoke(this, e);
if (LocationChanged != null)
{
LocationChanged.Invoke(this, e);
}
}

/// <summary>
Expand All @@ -1450,7 +1456,10 @@ protected override void OnLocationChanged(EventArgs e)
/// <param name="e">An EventArgs containing the event data.</param>
protected override void OnTabIndexChanged(EventArgs e)
{
TabIndexChanged.Invoke(this, e);
if (TabIndexChanged != null)
{
TabIndexChanged.Invoke(this, e);
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,11 @@ protected override void OnClick(EventArgs e)
if (owner is KryptonMessageBoxForm)
{
// need to gain access to `dialogResult` and set it forcefully
FieldInfo fi = typeof(Form).GetField("dialogResult", BindingFlags.NonPublic | BindingFlags.Instance);
fi.SetValue(owner, DialogResult);
FieldInfo? fi = typeof(Form).GetField("dialogResult", BindingFlags.NonPublic | BindingFlags.Instance);
if (fi != null)
{
fi.SetValue(owner, DialogResult);
}
}
else
{
Expand Down Expand Up @@ -1136,7 +1139,7 @@ private void ShowContextMenuStrip()

if (KryptonContextMenu != null)
{
KryptonContextMenu.Show(FindForm().PointToScreen(Location) + new Size(0, Height));
KryptonContextMenu.Show(FindForm()!.PointToScreen(Location) + new Size(0, Height));

KryptonContextMenu.Closed += KryptonContextMenu_Closed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,33 @@ public class KryptonLanguageManager : Component
/// <summary>Resets the button spec style strings.</summary>
public void ResetButtonSpecStyleStrings() => ButtonStyles.Reset();

/// <summary>Gets the general strings.</summary>
/// <value>The general strings.</value>
/// <summary>Gets the custom toolkit strings.</summary>
/// <value>The custom toolkit strings.</value>
[Category(@"Visuals")]
[Description(@"Collection of general strings.")]
[Description(@"Collection of custom toolkit strings.")]
[MergableProperty(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Localizable(true)]
public GeneralStrings GeneralStrings => GeneralToolkitStrings;
public CustomToolkitStrings CustomStrings => CustomToolkitStrings;

private bool ShouldSerializeCustomStrings() => !CustomToolkitStrings.IsDefault;

/// <summary>Resets the custom strings.</summary>
public void ResetCustomStrings() => CustomToolkitStrings.ResetValues();

/// <summary>Gets the general toolkit strings.</summary>
/// <value>The general toolkit strings.</value>
[Category(@"Visuals")]
[Description(@"Collection of general toolkit strings.")]
[MergableProperty(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Localizable(true)]
public GeneralToolkitStrings GeneralStrings => GeneralToolkitStrings;

private bool ShouldSerializeGeneralStrings() => !GeneralToolkitStrings.IsDefault;

/// <summary>Resets the general strings.</summary>
public void ResetGeneralStrings() => GeneralToolkitStrings.ResetValues();
public void ResetGeneralStrings() => GeneralToolkitStrings.Reset();

/// <summary>Gets the data grid view style strings.</summary>
/// <value>The data grid view style strings.</value>
Expand Down Expand Up @@ -399,9 +413,12 @@ public class KryptonLanguageManager : Component
/// <value>The spec style strings.</value>
public static ButtonStyleStrings ButtonStyles { get; } = new();

public static CustomToolkitStrings CustomToolkitStrings { get; } = new();

/// <summary>Gets the strings.</summary>
/// <value>The strings.</value>
public static GeneralStrings GeneralToolkitStrings { get; } = new();
public static GeneralToolkitStrings GeneralToolkitStrings
{ get; } = new();

/// <summary>Gets the grid view style strings.</summary>
/// <value>The grid view style strings.</value>
Expand Down Expand Up @@ -514,7 +531,8 @@ public KryptonLanguageManager()
/// <c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool IsDefault => !(ShouldSerializeGeneralStrings() ||
public bool IsDefault => !(ShouldSerializeCustomStrings() ||
ShouldSerializeGeneralStrings() ||
ShouldSerializeColorStrings() ||
ShouldSerializePaletteModeStrings() ||
ShouldSerializeButtonSpecStyleStrings() ||
Expand Down Expand Up @@ -547,6 +565,8 @@ public void Reset()

ResetButtonSpecStyleStrings();

ResetCustomStrings();

ResetGeneralStrings();

ResetPaletteModeStrings();
Expand Down
Loading

0 comments on commit 792ea7c

Please sign in to comment.