Skip to content

Commit e99e55c

Browse files
committed
Reconnect when resuming
1 parent a96a41e commit e99e55c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Signal-Windows/App.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public App()
4141
{
4242
this.InitializeComponent();
4343
this.Suspending += OnSuspending;
44+
this.Resuming += App_Resuming;
4445
try
4546
{
4647
Init = Task.Run(() =>
@@ -188,5 +189,18 @@ private async void OnSuspending(object sender, SuspendingEventArgs e)
188189
//TODO: Anwendungszustand speichern und alle Hintergrundaktivitäten beenden
189190
deferral.Complete();
190191
}
192+
193+
private async void App_Resuming(object sender, object e)
194+
{
195+
Debug.WriteLine("Resuming app");
196+
if (ViewModels.MainPageInstance != null)
197+
{
198+
await ViewModels.MainPageInstance.Init();
199+
}
200+
else
201+
{
202+
Debug.WriteLine("We can't resume");
203+
}
204+
}
191205
}
192206
}

Signal-Windows/ViewModels/MainPageViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public async Task OnNavigatedTo()
123123

124124
public async Task Init()
125125
{
126+
App.MainPageActive = true;
126127
Debug.WriteLine("Init lock wait");
127128
using (await ActionInProgress.LockAsync(CancelSource.Token))
128129
{

0 commit comments

Comments
 (0)