Skip to content

Commit e43653e

Browse files
committed
-removed unused variables and summaries
-make new Show method non-generic
1 parent f36b86a commit e43653e

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/MaterialDesignThemes.Wpf/DialogHost.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ public class DialogHost : ContentControl
9494
private DialogClosedEventHandler? _attachedDialogClosedEventHandler;
9595
private IInputElement? _restoreFocusDialogClose;
9696
private Action? _currentSnackbarMessageQueueUnPauseAction;
97-
private Thickness _previousDialogMargin;
98-
private double _previousDialogContentUniformCornerRadius;
9997

10098
static DialogHost()
10199
{
@@ -108,7 +106,6 @@ static DialogHost()
108106
/// Shows a modal dialog. To use, a <see cref="DialogHost"/> instance must be in a visual tree (typically this may be specified towards the root of a Window's XAML).
109107
/// </summary>
110108
/// <param name="content">Content to show (can be a control or view model).</param>
111-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
112109
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
113110
public static Task<object?> Show(object content)
114111
=> Show(content, null, null);
@@ -118,7 +115,6 @@ static DialogHost()
118115
/// </summary>
119116
/// <param name="content">Content to show (can be a control or view model).</param>
120117
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
121-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
122118
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
123119
public static Task<object?> Show(object content, DialogOpenedEventHandler? openedEventHandler)
124120
=> Show(content, null, openedEventHandler, null);
@@ -128,7 +124,6 @@ static DialogHost()
128124
/// </summary>
129125
/// <param name="content">Content to show (can be a control or view model).</param>
130126
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
131-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
132127
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
133128
public static Task<object?> Show(object content, DialogClosingEventHandler? closingEventHandler)
134129
=> Show(content, null, null, closingEventHandler);
@@ -139,7 +134,6 @@ static DialogHost()
139134
/// <param name="content">Content to show (can be a control or view model).</param>
140135
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
141136
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
142-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
143137
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
144138
public static Task<object?> Show(object content, DialogOpenedEventHandler? openedEventHandler, DialogClosingEventHandler? closingEventHandler)
145139
=> Show(content, null, openedEventHandler, closingEventHandler);
@@ -151,7 +145,6 @@ static DialogHost()
151145
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
152146
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
153147
/// <param name="closedEventHandler">Allows access to closed event which would otherwise have been subscribed to on a instance.</param>
154-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
155148
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
156149
public static Task<object?> Show(object content, DialogOpenedEventHandler? openedEventHandler, DialogClosingEventHandler? closingEventHandler, DialogClosedEventHandler? closedEventHandler)
157150
=> Show(content, null, openedEventHandler, closingEventHandler, closedEventHandler);
@@ -161,9 +154,8 @@ static DialogHost()
161154
/// </summary>
162155
/// <param name="content">Content to show (can be a control or view model).</param>
163156
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
164-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
165157
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
166-
public static Task<object?> Show(object content, object dialogIdentifier, bool isFullscreenDialog = false)
158+
public static Task<object?> Show(object content, object dialogIdentifier)
167159
=> Show(content, dialogIdentifier, null, null);
168160

169161
/// <summary>
@@ -172,7 +164,6 @@ static DialogHost()
172164
/// <param name="content">Content to show (can be a control or view model).</param>
173165
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
174166
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
175-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
176167
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
177168
public static Task<object?> Show(object content, object dialogIdentifier, DialogOpenedEventHandler? openedEventHandler)
178169
=> Show(content, dialogIdentifier, openedEventHandler, null);
@@ -183,7 +174,6 @@ static DialogHost()
183174
/// <param name="content">Content to show (can be a control or view model).</param>
184175
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
185176
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
186-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
187177
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
188178
public static Task<object?> Show(object content, object dialogIdentifier, DialogClosingEventHandler? closingEventHandler)
189179
=> Show(content, dialogIdentifier, null, closingEventHandler);
@@ -195,7 +185,6 @@ static DialogHost()
195185
/// <param name="dialogIdentifier"><see cref="Identifier"/> of the instance where the dialog should be shown. Typically this will match an identifier set in XAML. <c>null</c> is allowed.</param>
196186
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
197187
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
198-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
199188
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
200189
public static Task<object?> Show(object content, object? dialogIdentifier, DialogOpenedEventHandler? openedEventHandler, DialogClosingEventHandler? closingEventHandler)
201190
=> Show(content, dialogIdentifier, openedEventHandler, closingEventHandler, null);
@@ -208,7 +197,6 @@ static DialogHost()
208197
/// <param name="openedEventHandler">Allows access to opened event which would otherwise have been subscribed to on a instance.</param>
209198
/// <param name="closingEventHandler">Allows access to closing event which would otherwise have been subscribed to on a instance.</param>
210199
/// <param name="closedEventHandler">Allows access to closed event which would otherwise have been subscribed to on a instance.</param>
211-
/// <param name="isFullscreenDialog">Controls whether the dialog is fullscreen or not.</param>
212200
/// <returns>Task result is the parameter used to close the dialog, typically what is passed to the <see cref="CloseDialogCommand"/> command.</returns>
213201
public static async Task<object?> Show(object content, object? dialogIdentifier, DialogOpenedEventHandler? openedEventHandler, DialogClosingEventHandler? closingEventHandler, DialogClosedEventHandler? closedEventHandler)
214202
{
@@ -326,17 +314,17 @@ private static DialogHost GetInstance(object? dialogIdentifier)
326314
return result;
327315
}
328316

329-
public static Task<T?> Show<T>(object? content, DialogOptions options)
330-
=> Show<T>(content, null, options);
317+
public static Task<object?> Show(object? content, DialogOptions options)
318+
=> Show(content, null, options);
331319

332-
public static async Task<T?> Show<T>(object? content, object? dialogIdentifier, DialogOptions options)
320+
public static async Task<object?> Show(object? content, object? dialogIdentifier, DialogOptions options)
333321
{
334322
#if NET7_0_OR_GREATER
335323
ArgumentNullException.ThrowIfNull(content);
336324
#else
337325
if (content is null) throw new ArgumentNullException(nameof(content));
338326
#endif
339-
return await GetInstance(dialogIdentifier).ShowInternal<T>(content, options);
327+
return await GetInstance(dialogIdentifier).ShowInternal(content, options);
340328
}
341329

342330
private void ApplyDialogOptions(DialogOptions options)
@@ -413,7 +401,7 @@ private void RevertDialogOptions(DialogOptions options)
413401
}
414402
}
415403

416-
internal async Task<T?> ShowInternal<T>(object content, DialogOptions options)
404+
internal async Task<object?> ShowInternal(object content, DialogOptions options)
417405
{
418406
if (IsOpen)
419407
throw new InvalidOperationException("DialogHost is already open.");
@@ -440,7 +428,7 @@ private void RevertDialogOptions(DialogOptions options)
440428

441429
RevertDialogOptions(options);
442430

443-
return result is null ? default : (T)result;
431+
return result;
444432
}
445433

446434
private void OnCloseOnClickAway(object sender, MouseButtonEventArgs e)

0 commit comments

Comments
 (0)