55using Coder . Desktop . App . Views . Pages ;
66using CommunityToolkit . Mvvm . Input ;
77using Microsoft . UI ;
8+ using Microsoft . UI . Input ;
89using Microsoft . UI . Windowing ;
910using Microsoft . UI . Xaml ;
1011using Microsoft . UI . Xaml . Controls ;
12+ using Microsoft . UI . Xaml . Documents ;
1113using Microsoft . UI . Xaml . Media . Animation ;
1214using System ;
1315using System . Collections . Generic ;
1719using Windows . Graphics ;
1820using Windows . System ;
1921using Windows . UI . Core ;
20- using Microsoft . UI . Input ;
2122using WinRT . Interop ;
2223using WindowActivatedEventArgs = Microsoft . UI . Xaml . WindowActivatedEventArgs ;
2324
@@ -40,6 +41,7 @@ public sealed partial class TrayWindow : Window
4041
4142 private readonly IRpcController _rpcController ;
4243 private readonly ICredentialManager _credentialManager ;
44+ private readonly ISyncSessionController _syncSessionController ;
4345 private readonly IUpdateController _updateController ;
4446 private readonly IUserNotifier _userNotifier ;
4547 private readonly TrayWindowLoadingPage _loadingPage ;
@@ -49,13 +51,15 @@ public sealed partial class TrayWindow : Window
4951
5052 public TrayWindow (
5153 IRpcController rpcController , ICredentialManager credentialManager ,
52- IUpdateController updateController , IUserNotifier userNotifier ,
54+ ISyncSessionController syncSessionController , IUpdateController updateController ,
55+ IUserNotifier userNotifier ,
5356 TrayWindowLoadingPage loadingPage ,
5457 TrayWindowDisconnectedPage disconnectedPage , TrayWindowLoginRequiredPage loginRequiredPage ,
5558 TrayWindowMainPage mainPage )
5659 {
5760 _rpcController = rpcController ;
5861 _credentialManager = credentialManager ;
62+ _syncSessionController = syncSessionController ;
5963 _updateController = updateController ;
6064 _userNotifier = userNotifier ;
6165 _loadingPage = loadingPage ;
@@ -70,7 +74,9 @@ public TrayWindow(
7074
7175 _rpcController . StateChanged += RpcController_StateChanged ;
7276 _credentialManager . CredentialsChanged += CredentialManager_CredentialsChanged ;
73- SetPageByState ( _rpcController . GetState ( ) , _credentialManager . GetCachedCredentials ( ) ) ;
77+ _syncSessionController . StateChanged += SyncSessionController_StateChanged ;
78+ SetPageByState ( _rpcController . GetState ( ) , _credentialManager . GetCachedCredentials ( ) ,
79+ _syncSessionController . GetState ( ) ) ;
7480
7581 // Setting these directly in the .xaml doesn't seem to work for whatever reason.
7682 TrayIcon . OpenCommand = Tray_OpenCommand ;
@@ -121,7 +127,8 @@ public TrayWindow(
121127 } ;
122128 }
123129
124- private void SetPageByState ( RpcModel rpcModel , CredentialModel credentialModel )
130+ private void SetPageByState ( RpcModel rpcModel , CredentialModel credentialModel ,
131+ SyncSessionControllerStateModel syncSessionModel )
125132 {
126133 if ( credentialModel . State == CredentialState . Unknown )
127134 {
@@ -194,13 +201,18 @@ private void MaybeNotifyUser(RpcModel rpcModel)
194201
195202 private void RpcController_StateChanged ( object ? _ , RpcModel model )
196203 {
197- SetPageByState ( model , _credentialManager . GetCachedCredentials ( ) ) ;
204+ SetPageByState ( model , _credentialManager . GetCachedCredentials ( ) , _syncSessionController . GetState ( ) ) ;
198205 MaybeNotifyUser ( model ) ;
199206 }
200207
201208 private void CredentialManager_CredentialsChanged ( object ? _ , CredentialModel model )
202209 {
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 ) ;
204216 }
205217
206218 // Sadly this is necessary because Window.Content.SizeChanged doesn't
0 commit comments