2323using System . Collections . Concurrent ;
2424using Windows . ApplicationModel . Background ;
2525using Windows . Networking . BackgroundTransfer ;
26+ using Windows . UI ;
2627
2728namespace Signal_Windows
2829{
@@ -203,6 +204,7 @@ private async Task CreateSecondaryWindowOrShowMain(ActivationViewSwitcher switch
203204 newViewId = currView . Id ;
204205 //await switcher.ShowAsStandaloneAsync(newViewId);
205206 ViewModelLocator newVML = ( ViewModelLocator ) Resources [ "Locator" ] ;
207+ SetupTopBar ( ) ;
206208 return new SignalWindowsFrontend ( newView . Dispatcher , newVML , newViewId ) ;
207209 } ) ;
208210 bool success = await newView . Dispatcher . RunTaskAsync ( async ( ) =>
@@ -226,6 +228,38 @@ await newView.Dispatcher.RunTaskAsync(async () =>
226228 }
227229 }
228230
231+ private void SetupTopBar ( )
232+ {
233+ // mobile clients have a status bar
234+ if ( Windows . Foundation . Metadata . ApiInformation . IsTypePresent ( "Windows.UI.ViewManagement.StatusBar" ) )
235+ {
236+ var sb = StatusBar . GetForCurrentView ( ) ;
237+ sb . BackgroundColor = Color . FromArgb ( 1 , 0x20 , 0x90 , 0xEA ) ;
238+ sb . BackgroundOpacity = 1 ;
239+ sb . ForegroundColor = Colors . White ;
240+ }
241+ // desktop clients have a title bar
242+ else if ( Windows . Foundation . Metadata . ApiInformation . IsTypePresent ( "Windows.UI.ViewManagement.ApplicationView" ) )
243+ {
244+ var titleBar = ApplicationView . GetForCurrentView ( ) . TitleBar ;
245+ if ( titleBar != null )
246+ {
247+ titleBar . ButtonBackgroundColor = Color . FromArgb ( 1 , 0x20 , 0x90 , 0xEA ) ;
248+ titleBar . ButtonForegroundColor = Colors . White ;
249+ titleBar . BackgroundColor = Color . FromArgb ( 1 , 0x20 , 0x90 , 0xEA ) ;
250+ titleBar . ForegroundColor = Colors . White ;
251+ }
252+ else
253+ {
254+ Logger . LogError ( "TitleBar is null" ) ;
255+ }
256+ }
257+ else
258+ {
259+ Logger . LogError ( "Neither TitleBar nor StatusBar found" ) ;
260+ }
261+ }
262+
229263 private async Task < bool > CreateMainWindow ( string conversationId )
230264 {
231265 Frame rootFrame = Window . Current . Content as Frame ;
@@ -238,14 +272,7 @@ private async Task<bool> CreateMainWindow(string conversationId)
238272 var frontend = new SignalWindowsFrontend ( Window . Current . Dispatcher , ( ViewModelLocator ) Resources [ "Locator" ] , currView . Id ) ;
239273 Views . Add ( currView . Id , frontend ) ;
240274 MainViewId = currView . Id ;
241-
242- if ( Windows . Foundation . Metadata . ApiInformation . IsTypePresent ( "Windows.UI.ViewManagement.StatusBar" ) )
243- {
244- var sb = StatusBar . GetForCurrentView ( ) ;
245- sb . BackgroundColor = Windows . UI . Color . FromArgb ( 1 , 0x20 , 0x90 , 0xEA ) ;
246- sb . BackgroundOpacity = 1 ;
247- sb . ForegroundColor = Windows . UI . Colors . White ;
248- }
275+ SetupTopBar ( ) ;
249276
250277 try
251278 {
0 commit comments