feat: fix memory leakage.
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
<Run Text="Result: "></Run>
|
||||
<Run Text="{Binding Result}"></Run>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Date: "></Run>
|
||||
<Run Text="{Binding DialogViewModel.Date}"></Run>
|
||||
</TextBlock>
|
||||
<Button Command="{Binding ShowGlobalDialogCommand}">Show Dialog</Button>
|
||||
<Button Command="{Binding ShowLocalOverlayDialogCommand}">Show Local Overlay Dialog</Button>
|
||||
<Button Command="{Binding ShowGlobalOverlayDialogCommand}"> Show Global Overlay Dialog </Button>
|
||||
|
||||
@@ -23,6 +23,16 @@ public class DialogDemoViewModel: ObservableObject
|
||||
set => SetProperty(ref _result, value);
|
||||
}
|
||||
|
||||
private DateTime _date;
|
||||
|
||||
public DateTime Date
|
||||
{
|
||||
get => _date;
|
||||
set => SetProperty(ref _date, value);
|
||||
}
|
||||
|
||||
public DialogWithActionViewModel DialogViewModel { get; set; } = new DialogWithActionViewModel();
|
||||
|
||||
public DialogDemoViewModel()
|
||||
{
|
||||
ShowLocalOverlayDialogCommand = new AsyncRelayCommand(ShowLocalOverlayDialog);
|
||||
@@ -43,8 +53,10 @@ public class DialogDemoViewModel: ObservableObject
|
||||
|
||||
private async Task ShowLocalOverlayDialog()
|
||||
{
|
||||
var vm = new DialogWithActionViewModel();
|
||||
var result = await DialogBox.ShowOverlayAsync<DialogWithAction, DialogWithActionViewModel, bool>(
|
||||
new DialogWithActionViewModel(), "LocalHost");
|
||||
DialogViewModel, "LocalHost");
|
||||
Date = vm.Date;
|
||||
Result = result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user