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"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
Scrollable="True"
|
Scrollable="True"
|
||||||
Loaded="Page_Loaded"
|
Loaded="Page_Loaded"
|
||||||
|
Unloaded="Page_Unloaded"
|
||||||
Title="FastFlagEditorWarningPage">
|
Title="FastFlagEditorWarningPage">
|
||||||
|
|
||||||
<StackPanel VerticalAlignment="Center">
|
<StackPanel VerticalAlignment="Center">
|
||||||
|
@ -31,5 +31,10 @@ namespace Bloxstrap.UI.Elements.Settings.Pages
|
|||||||
|
|
||||||
((FastFlagEditorWarningViewModel)DataContext).StartCountdown();
|
((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;
|
_page = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartCountdown()
|
public void StopCountdown()
|
||||||
{
|
{
|
||||||
_cancellationTokenSource?.Cancel();
|
_cancellationTokenSource?.Cancel();
|
||||||
|
_cancellationTokenSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartCountdown()
|
||||||
|
{
|
||||||
|
StopCountdown();
|
||||||
|
|
||||||
_cancellationTokenSource = new CancellationTokenSource();
|
_cancellationTokenSource = new CancellationTokenSource();
|
||||||
DoCountdown(_cancellationTokenSource.Token);
|
DoCountdown(_cancellationTokenSource.Token);
|
||||||
|
Loading…
Reference in New Issue
Block a user