Skip to content

Commit 6151293

Browse files
committed
Switch MainPage style only if MainPage is active
Fixes #195
1 parent 60e5b1f commit 6151293

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

Signal-Windows/Views/MainPage.xaml.cs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,31 @@ public MainPage()
3434

3535
public void SwitchToStyle(PageStyle newStyle)
3636
{
37-
if (newStyle == PageStyle.Narrow)
37+
var frame = Window.Current.Content as Frame;
38+
if (frame.CurrentSourcePageType == typeof(MainPage))
3839
{
39-
if (Vm.SelectedThread != null)
40+
if (newStyle == PageStyle.Narrow)
4041
{
41-
Utils.EnableBackButton(Vm.BackButton_Click);
42-
Vm.IsPaneOpen = false;
43-
Vm.CompactPaneLength = 0;
42+
if (Vm.SelectedThread != null)
43+
{
44+
Utils.EnableBackButton(Vm.BackButton_Click);
45+
Vm.IsPaneOpen = false;
46+
Vm.CompactPaneLength = 0;
47+
}
48+
else
49+
{
50+
Unselect();
51+
Vm.IsPaneOpen = true;
52+
}
4453
}
45-
else
54+
else if (newStyle == PageStyle.Wide)
4655
{
47-
Unselect();
48-
Vm.IsPaneOpen = true;
56+
Utils.DisableBackButton(Vm.BackButton_Click);
57+
Vm.IsPaneOpen = false;
58+
Vm.CompactPaneLength = ContactsGrid.Width = 320;
4959
}
60+
UpdateStyle(newStyle);
5061
}
51-
else if (newStyle == PageStyle.Wide)
52-
{
53-
Utils.DisableBackButton(Vm.BackButton_Click);
54-
Vm.IsPaneOpen = false;
55-
Vm.CompactPaneLength = ContactsGrid.Width = 320;
56-
}
57-
UpdateStyle(newStyle);
5862
}
5963

6064
private void UpdateStyle(PageStyle currentStyle)

0 commit comments

Comments
 (0)