5
5
using Coder . Desktop . App . Views . Pages ;
6
6
using CommunityToolkit . Mvvm . Input ;
7
7
using Microsoft . UI ;
8
+ using Microsoft . UI . Input ;
8
9
using Microsoft . UI . Windowing ;
9
10
using Microsoft . UI . Xaml ;
10
11
using Microsoft . UI . Xaml . Controls ;
12
+ using Microsoft . UI . Xaml . Documents ;
11
13
using Microsoft . UI . Xaml . Media . Animation ;
12
14
using System ;
13
15
using System . Collections . Generic ;
17
19
using Windows . Graphics ;
18
20
using Windows . System ;
19
21
using Windows . UI . Core ;
20
- using Microsoft . UI . Input ;
21
22
using WinRT . Interop ;
22
23
using WindowActivatedEventArgs = Microsoft . UI . Xaml . WindowActivatedEventArgs ;
23
24
@@ -40,6 +41,7 @@ public sealed partial class TrayWindow : Window
40
41
41
42
private readonly IRpcController _rpcController ;
42
43
private readonly ICredentialManager _credentialManager ;
44
+ private readonly ISyncSessionController _syncSessionController ;
43
45
private readonly IUpdateController _updateController ;
44
46
private readonly IUserNotifier _userNotifier ;
45
47
private readonly TrayWindowLoadingPage _loadingPage ;
@@ -49,13 +51,15 @@ public sealed partial class TrayWindow : Window
49
51
50
52
public TrayWindow (
51
53
IRpcController rpcController , ICredentialManager credentialManager ,
52
- IUpdateController updateController , IUserNotifier userNotifier ,
54
+ ISyncSessionController syncSessionController , IUpdateController updateController ,
55
+ IUserNotifier userNotifier ,
53
56
TrayWindowLoadingPage loadingPage ,
54
57
TrayWindowDisconnectedPage disconnectedPage , TrayWindowLoginRequiredPage loginRequiredPage ,
55
58
TrayWindowMainPage mainPage )
56
59
{
57
60
_rpcController = rpcController ;
58
61
_credentialManager = credentialManager ;
62
+ _syncSessionController = syncSessionController ;
59
63
_updateController = updateController ;
60
64
_userNotifier = userNotifier ;
61
65
_loadingPage = loadingPage ;
@@ -70,7 +74,9 @@ public TrayWindow(
70
74
71
75
_rpcController . StateChanged += RpcController_StateChanged ;
72
76
_credentialManager . CredentialsChanged += CredentialManager_CredentialsChanged ;
73
- SetPageByState ( _rpcController . GetState ( ) , _credentialManager . GetCachedCredentials ( ) ) ;
77
+ _syncSessionController . StateChanged += SyncSessionController_StateChanged ;
78
+ SetPageByState ( _rpcController . GetState ( ) , _credentialManager . GetCachedCredentials ( ) ,
79
+ _syncSessionController . GetState ( ) ) ;
74
80
75
81
// Setting these directly in the .xaml doesn't seem to work for whatever reason.
76
82
TrayIcon . OpenCommand = Tray_OpenCommand ;
@@ -121,7 +127,8 @@ public TrayWindow(
121
127
} ;
122
128
}
123
129
124
- private void SetPageByState ( RpcModel rpcModel , CredentialModel credentialModel )
130
+ private void SetPageByState ( RpcModel rpcModel , CredentialModel credentialModel ,
131
+ SyncSessionControllerStateModel syncSessionModel )
125
132
{
126
133
if ( credentialModel . State == CredentialState . Unknown )
127
134
{
@@ -194,13 +201,18 @@ private void MaybeNotifyUser(RpcModel rpcModel)
194
201
195
202
private void RpcController_StateChanged ( object ? _ , RpcModel model )
196
203
{
197
- SetPageByState ( model , _credentialManager . GetCachedCredentials ( ) ) ;
204
+ SetPageByState ( model , _credentialManager . GetCachedCredentials ( ) , _syncSessionController . GetState ( ) ) ;
198
205
MaybeNotifyUser ( model ) ;
199
206
}
200
207
201
208
private void CredentialManager_CredentialsChanged ( object ? _ , CredentialModel model )
202
209
{
203
- SetPageByState ( _rpcController . GetState ( ) , model ) ;
210
+ SetPageByState ( _rpcController . GetState ( ) , model , _syncSessionController . GetState ( ) ) ;
211
+ }
212
+
213
+ private void SyncSessionController_StateChanged ( object ? _ , SyncSessionControllerStateModel model )
214
+ {
215
+ SetPageByState ( _rpcController . GetState ( ) , _credentialManager . GetCachedCredentials ( ) , model ) ;
204
216
}
205
217
206
218
// Sadly this is necessary because Window.Content.SizeChanged doesn't