mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
stop countdown on unload
This commit is contained in:
parent
81baca5ffa
commit
e9712d1730
@ -10,6 +10,7 @@
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Scrollable="True"
|
||||
Loaded="Page_Loaded"
|
||||
Unloaded="Page_Unloaded"
|
||||
Title="FastFlagEditorWarningPage">
|
||||
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
|
@ -31,5 +31,10 @@ namespace Bloxstrap.UI.Elements.Settings.Pages
|
||||
|
||||
((FastFlagEditorWarningViewModel)DataContext).StartCountdown();
|
||||
}
|
||||
|
||||
private void Page_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((FastFlagEditorWarningViewModel)DataContext).StopCountdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,15 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
_page = page;
|
||||
}
|
||||
|
||||
public void StartCountdown()
|
||||
public void StopCountdown()
|
||||
{
|
||||
_cancellationTokenSource?.Cancel();
|
||||
_cancellationTokenSource = null;
|
||||
}
|
||||
|
||||
public void StartCountdown()
|
||||
{
|
||||
StopCountdown();
|
||||
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
DoCountdown(_cancellationTokenSource.Token);
|
||||
|
Loading…
Reference in New Issue
Block a user