Skip to content

Commit 7d56dd1

Browse files
committed
You can now save profile without login
1 parent fa3c957 commit 7d56dd1

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

gamevault/Windows/LoginWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
</CheckBox.Style>
241241
</CheckBox>
242242
</StackPanel>
243+
<uc:IconButton Text="Save" Kind="Skeleton" Height="30" BorderThickness="1" Margin="0,0,120,10" Width="100" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="SaveWithoutLogin_Click"/>
243244
<uc:IconButton Text="Save and Login" Height="30" Margin="0,0,10,10" Width="100" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="SaveAndLogin_Click"/>
244245
<uc:IconButton Text="Back" Kind="Skeleton" BorderThickness="1" Height="30" Margin="10,0,0,10" Width="100" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="Back_Click" Tag="{x:Static local:LoginStep.SignInOrSignUp}"/>
245246
</Grid>

gamevault/Windows/LoginWindow.xaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private async void ServerUrlInput_Tick(object sender, EventArgs e)
142142
}
143143
catch (Exception ex)
144144
{
145-
string message = WebExceptionHelper.TryGetServerMessage(ex);
145+
string message = WebExceptionHelper.TryGetServerMessage(ex);
146146
if (ViewModel.LoginStepIndex == (int)LoginStep.SignIn)
147147
{
148148
ViewModel.LoginServerInfo = new BindableServerInfo(message == "" ? "Could not connect to server" : message);
@@ -178,18 +178,27 @@ private UserProfile SetupUserProfile(LoginUser user)
178178
}
179179
return profile;
180180
}
181+
private async void SaveWithoutLogin_Click(object sender, RoutedEventArgs e)
182+
{
183+
await SaveAndLogin(true);
184+
}
181185
private async void SaveAndLogin_Click(object sender, RoutedEventArgs e)
182186
{
183187
await SaveAndLogin();
184188
}
185-
private async Task SaveAndLogin()
189+
private async Task SaveAndLogin(bool saveOnly = false)
186190
{
187191
try
188192
{
189193
ValidateSignInData(ViewModel.LoginUser, true);
190194
UserProfile profile = SetupUserProfile(ViewModel.LoginUser);
191195
ViewModel.LoginUser = new LoginUser();//Reset
192196
RemoveDemoUserIfExists();
197+
if (saveOnly)
198+
{
199+
ViewModel.LoginStepIndex = (int)LoginStep.ChooseProfile;
200+
return;
201+
}
193202
await Login(profile, true);
194203
}
195204
catch (Exception ex)
@@ -665,5 +674,6 @@ private async void UserRegistrationTextBox_KeyDown(object sender, System.Windows
665674
await SaveAndSignUp();
666675
}
667676
}
677+
668678
}
669679
}

0 commit comments

Comments
 (0)