Skip to content

Commit ca89788

Browse files
Remove crashing animation
1 parent a36100b commit ca89788

File tree

5 files changed

+23
-61
lines changed

5 files changed

+23
-61
lines changed

Fyreplace/Views/Pages/AccountEntryPageBase.cs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,13 @@ namespace Fyreplace.Views.Pages
1010
{
1111
public abstract class AccountEntryPageBase<VM> : Page where VM : AccountEntryViewModelBase
1212
{
13-
protected abstract IDictionary<string, UIElement> ConnectedElements { get; }
14-
15-
protected abstract VM viewModel { get; }
16-
17-
protected override void OnNavigatedTo(NavigationEventArgs e)
18-
{
19-
base.OnNavigatedTo(e);
20-
21-
var animator = ConnectedAnimationService.GetForCurrentView();
22-
23-
foreach (var entry in ConnectedElements)
24-
{
25-
animator.GetAnimation(entry.Key)?.TryStart(entry.Value);
26-
}
27-
}
28-
29-
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
30-
{
31-
var animator = ConnectedAnimationService.GetForCurrentView();
32-
33-
foreach (var entry in ConnectedElements)
34-
{
35-
animator
36-
.PrepareToAnimate(entry.Key, entry.Value)
37-
.Configuration = new DirectConnectedAnimationConfiguration();
38-
}
39-
40-
base.OnNavigatingFrom(e);
41-
}
13+
protected abstract VM ViewModel { get; }
4214

4315
protected void Accelerators_Submit(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
4416
{
45-
if (viewModel.CanSubmit)
17+
if (ViewModel.CanSubmit)
4618
{
47-
viewModel.SubmitAsync();
19+
ViewModel.SubmitAsync();
4820
}
4921
}
5022
}

Fyreplace/Views/Pages/LoginPage.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<ComboBox
2929
x:Uid="AccountEntryPageBase_Environment"
3030
HorizontalAlignment="Stretch"
31-
ItemsSource="{x:Bind viewModel.EnvironmentNames}"
32-
SelectedIndex="{x:Bind viewModel.SelectedEnvironmentIndex, Mode=TwoWay}"
31+
ItemsSource="{x:Bind ViewModel.EnvironmentNames}"
32+
SelectedIndex="{x:Bind ViewModel.SelectedEnvironmentIndex, Mode=TwoWay}"
3333
IsEnabled="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" />
3434
<TextBox
3535
x:Name="Identifier"
@@ -43,7 +43,7 @@
4343
<TextBox
4444
x:Name="RandomCode"
4545
x:Uid="AccountEntryPageBase_RandomCode"
46-
Text="{x:Bind viewModel.RandomCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
46+
Text="{x:Bind ViewModel.RandomCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
4747
Visibility="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
4848
<TextBox.KeyboardAccelerators>
4949
<KeyboardAccelerator Key="Enter" Invoked="Accelerators_Submit" />
@@ -58,21 +58,21 @@
5858
x:Uid="LoginPage_Submit"
5959
HorizontalAlignment="Stretch"
6060
Style="{ThemeResource AccentButtonStyle}"
61-
Command="{x:Bind viewModel.SubmitCommand}" />
61+
Command="{x:Bind ViewModel.SubmitCommand}" />
6262
<ProgressBar
6363
VerticalAlignment="Top"
6464
IsIndeterminate="True"
65-
Visibility="{x:Bind viewModel.IsLoading, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
65+
Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
6666
<TeachingTip
6767
x:Uid="AccountEntryPageBase_RandomCodeTip"
6868
PreferredPlacement="BottomRight"
6969
IconSource="{ui:FontIconSource Glyph=&#xE715;}"
70-
IsOpen="{x:Bind viewModel.IsRandomCodeTipShown, Mode=TwoWay}" />
70+
IsOpen="{x:Bind ViewModel.IsRandomCodeTipShown, Mode=TwoWay}" />
7171
</Grid>
7272
<Button
7373
x:Uid="AccountEntryPageBase_Cancel"
7474
HorizontalAlignment="Stretch"
7575
Visibility="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
76-
Command="{x:Bind viewModel.CancelCommand}" />
76+
Command="{x:Bind ViewModel.CancelCommand}" />
7777
</StackPanel>
7878
</local:LoginPageBase>

Fyreplace/Views/Pages/LoginPage.xaml.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,15 @@ public abstract class LoginPageBase : AccountEntryPageBase<LoginViewModel>
1111

1212
public sealed partial class LoginPage : LoginPageBase
1313
{
14-
protected override IDictionary<string, UIElement> ConnectedElements => new Dictionary<string, UIElement>
15-
{
16-
["title"] = Title,
17-
["first-field"] = Identifier
18-
};
19-
protected override LoginViewModel viewModel => AppBase.GetService<LoginViewModel>();
14+
protected override LoginViewModel ViewModel => AppBase.GetService<LoginViewModel>();
2015

2116
private readonly IPreferences preferences = AppBase.GetService<IPreferences>();
2217

2318
public LoginPage() => InitializeComponent();
2419

2520
private void Form_Loaded(object sender, RoutedEventArgs e)
2621
{
27-
if (!viewModel.CanSubmitFirstStep)
22+
if (!ViewModel.CanSubmitFirstStep)
2823
{
2924
Identifier.Focus(FocusState.Programmatic);
3025
}

Fyreplace/Views/Pages/RegisterPage.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<ComboBox
2929
x:Uid="AccountEntryPageBase_Environment"
3030
HorizontalAlignment="Stretch"
31-
ItemsSource="{x:Bind viewModel.EnvironmentNames}"
32-
SelectedIndex="{x:Bind viewModel.SelectedEnvironmentIndex, Mode=TwoWay}"
31+
ItemsSource="{x:Bind ViewModel.EnvironmentNames}"
32+
SelectedIndex="{x:Bind ViewModel.SelectedEnvironmentIndex, Mode=TwoWay}"
3333
IsEnabled="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" />
3434
<TextBox
3535
x:Name="Username"
@@ -52,15 +52,15 @@
5252
<TextBox
5353
x:Name="RandomCode"
5454
x:Uid="AccountEntryPageBase_RandomCode"
55-
Text="{x:Bind viewModel.RandomCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
55+
Text="{x:Bind ViewModel.RandomCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
5656
Visibility="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
5757
<TextBox.KeyboardAccelerators>
5858
<KeyboardAccelerator Key="Enter" Invoked="Accelerators_Submit" />
5959
</TextBox.KeyboardAccelerators>
6060
</TextBox>
6161
<CheckBox
6262
x:Uid="RegisterPage_Terms"
63-
IsChecked="{x:Bind viewModel.HasAcceptedTerms, Mode=TwoWay}"
63+
IsChecked="{x:Bind ViewModel.HasAcceptedTerms, Mode=TwoWay}"
6464
IsEnabled="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" />
6565
<Grid>
6666
<Grid.ColumnDefinitions>
@@ -85,21 +85,21 @@
8585
x:Uid="RegisterPage_Submit"
8686
HorizontalAlignment="Stretch"
8787
Style="{ThemeResource AccentButtonStyle}"
88-
Command="{x:Bind viewModel.SubmitCommand}" />
88+
Command="{x:Bind ViewModel.SubmitCommand}" />
8989
<ProgressBar
9090
VerticalAlignment="Top"
9191
IsIndeterminate="True"
92-
Visibility="{x:Bind viewModel.IsLoading, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
92+
Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
9393
<TeachingTip
9494
x:Uid="AccountEntryPageBase_RandomCodeTip"
9595
PreferredPlacement="BottomRight"
9696
IconSource="{ui:FontIconSource Glyph=&#xE715;}"
97-
IsOpen="{x:Bind viewModel.IsRandomCodeTipShown, Mode=TwoWay}" />
97+
IsOpen="{x:Bind ViewModel.IsRandomCodeTipShown, Mode=TwoWay}" />
9898
</Grid>
9999
<Button
100100
x:Uid="AccountEntryPageBase_Cancel"
101101
HorizontalAlignment="Stretch"
102102
Visibility="{x:Bind preferences.Account_IsWaitingForRandomCode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
103-
Command="{x:Bind viewModel.CancelCommand}" />
103+
Command="{x:Bind ViewModel.CancelCommand}" />
104104
</StackPanel>
105105
</local:RegisterPageBase>

Fyreplace/Views/Pages/RegisterPage.xaml.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,19 @@ public abstract class RegisterPageBase : AccountEntryPageBase<RegisterViewModel>
1111

1212
public sealed partial class RegisterPage : RegisterPageBase
1313
{
14-
protected override IDictionary<string, UIElement> ConnectedElements => new Dictionary<string, UIElement>
15-
{
16-
["title"] = Title,
17-
["first-field"] = Username
18-
};
19-
protected override RegisterViewModel viewModel => AppBase.GetService<RegisterViewModel>();
14+
protected override RegisterViewModel ViewModel => AppBase.GetService<RegisterViewModel>();
2015

2116
private readonly IPreferences preferences = AppBase.GetService<IPreferences>();
2217

2318
public RegisterPage() => InitializeComponent();
2419

2520
private void Form_Loaded(object sender, RoutedEventArgs e)
2621
{
27-
if (!viewModel.IsUsernameValid)
22+
if (!ViewModel.IsUsernameValid)
2823
{
2924
Username.Focus(FocusState.Programmatic);
3025
}
31-
else if (!viewModel.IsEmailValid)
26+
else if (!ViewModel.IsEmailValid)
3227
{
3328
Email.Focus(FocusState.Programmatic);
3429
}

0 commit comments

Comments
 (0)