66using Signal_Windows . ViewModels ;
77using Signal_Windows . Views ;
88using System ;
9+ using System . Diagnostics ;
910using System . Threading . Tasks ;
1011using Windows . Foundation ;
1112using Windows . UI . Popups ;
@@ -38,20 +39,20 @@ public void SwitchToStyle(PageStyle newStyle)
3839 if ( Vm . SelectedThread != null )
3940 {
4041 Utils . EnableBackButton ( Vm . BackButton_Click ) ;
41- MainPanel . IsPaneOpen = false ;
42- MainPanel . CompactPaneLength = 0 ;
42+ Vm . IsPaneOpen = false ;
43+ Vm . CompactPaneLength = 0 ;
4344 }
4445 else
4546 {
4647 Unselect ( ) ;
47- MainPanel . IsPaneOpen = true ;
48+ Vm . IsPaneOpen = true ;
4849 }
4950 }
5051 else if ( newStyle == PageStyle . Wide )
5152 {
5253 Utils . DisableBackButton ( Vm . BackButton_Click ) ;
53- MainPanel . IsPaneOpen = false ;
54- MainPanel . CompactPaneLength = ContactsGrid . Width = 320 ;
54+ Vm . IsPaneOpen = false ;
55+ Vm . CompactPaneLength = ContactsGrid . Width = 320 ;
5556 }
5657 UpdateStyle ( newStyle ) ;
5758 }
@@ -62,39 +63,34 @@ private void UpdateStyle(PageStyle currentStyle)
6263 {
6364 // TODO: When phone is in landscape mode this is incorrect and some stuff gets cut off, we need to
6465 // get the actual useable width (actualwidth - top icon bar - bottom control bar)
65- ContactsGrid . Width = ActualWidth ;
66+ ContactsGrid . Width = Frame . ActualWidth ;
6667 if ( Vm . SelectedThread == null )
6768 {
68- MainPanel . OpenPaneLength = ActualWidth ;
69+ Vm . OpenPaneLength = Frame . ActualWidth ;
6970 }
7071 }
7172 else if ( currentStyle == PageStyle . Wide )
7273 {
73- MainPanel . CompactPaneLength = MainPanel . OpenPaneLength = ContactsGrid . Width = 320 ;
74+ Vm . CompactPaneLength = Vm . OpenPaneLength = ContactsGrid . Width = 320 ;
7475 }
7576 }
7677
7778 public PageStyle GetCurrentViewStyle ( )
7879 {
79- return Utils . GetViewStyle ( new Size ( ActualWidth , ActualHeight ) ) ;
80+ return Utils . GetViewStyle ( new Size ( Frame . ActualWidth , ActualHeight ) ) ;
8081 }
8182
8283 protected override void OnNavigatedTo ( NavigationEventArgs e )
8384 {
84- if ( e . Parameter != null )
85- {
86- Vm . RequestedConversationId = e . Parameter as string ;
87- }
88- UpdateLayout ( ) ;
85+ Vm . RequestedConversationId = e . Parameter as string ;
8986 SwitchToStyle ( GetCurrentViewStyle ( ) ) ;
90- MainPanel . DisplayMode = SplitViewDisplayMode . CompactInline ;
87+ Vm . DisplayMode = SplitViewDisplayMode . CompactInline ;
9188 Frame . SizeChanged += Frame_SizeChanged ;
9289 Vm . TrySelectConversation ( Vm . RequestedConversationId ) ;
9390 }
9491
9592 protected override void OnNavigatingFrom ( NavigatingCancelEventArgs e )
9693 {
97- Vm . Deselect ( ) ;
9894 Frame . SizeChanged -= Frame_SizeChanged ;
9995 if ( GetCurrentViewStyle ( ) == PageStyle . Narrow )
10096 {
0 commit comments