@@ -108,6 +108,15 @@ private async void LoginWindow_Loaded(object sender, RoutedEventArgs e)
108108 }
109109 private void NewProfile_Click ( object sender , RoutedEventArgs e )
110110 {
111+ if ( ! SettingsViewModel . Instance . License . IsActive ( ) && ViewModel . UserProfiles . Count >= 1 )
112+ {
113+ bool isDemoUserException = ViewModel . UserProfiles . Count == 1 && ViewModel . UserProfiles [ 0 ] . ServerUrl == "https://demo.gamevau.lt" ;
114+ if ( ! isDemoUserException )
115+ {
116+ ViewModel . AppBarText = "Oops! You just reached a premium feature of GameVault - Upgrade now and support the devs!" ;
117+ return ;
118+ }
119+ }
111120 ViewModel . LoginStepIndex = ( int ) LoginStep . SignInOrSignUp ;
112121 }
113122 private void SignIn_Click ( object sender , RoutedEventArgs e )
@@ -193,7 +202,7 @@ private async Task SaveAndLogin(bool saveOnly = false)
193202 ValidateSignInData ( ViewModel . LoginUser , true ) ;
194203 UserProfile profile = SetupUserProfile ( ViewModel . LoginUser ) ;
195204 ViewModel . LoginUser = new LoginUser ( ) ; //Reset
196- ViewModel . LoginServerInfo = new BindableServerInfo ( ) ; //Reset
205+ ViewModel . LoginServerInfo = new BindableServerInfo ( ) ; //Reset
197206 RemoveDemoUserIfExists ( ) ;
198207 if ( saveOnly )
199208 {
@@ -227,7 +236,7 @@ private string ValidateUriScheme(string uri)
227236 }
228237 private void ValidateSignInData ( LoginUser loginUser , bool isLogin )
229238 {
230- if ( ViewModel . UserProfiles . Any ( user=> user . Name == loginUser . Username ) )
239+ if ( ViewModel . UserProfiles . Any ( user => user . Name == loginUser . Username ) )
231240 throw new ArgumentException ( "Profile with this name already exists" ) ;
232241
233242 if ( string . IsNullOrWhiteSpace ( loginUser . ServerUrl ) )
@@ -320,11 +329,15 @@ private async Task Login(UserProfile profile, bool firstTimeLogin = false, bool
320329 string result = Preferences . Get ( AppConfigKey . UserID , profile . UserConfigFile ) ;
321330 if ( string . IsNullOrWhiteSpace ( result ) )
322331 {
323- throw new Exception ( "User ID is not set " ) ;
332+ throw new Exception ( "NOID " ) ;
324333 }
325334 await LoadMainWindow ( profile ) ;
326335 }
327- catch { ViewModel . AppBarText = "Can not load user profile in offline mode" ; ViewModel . LoginStepIndex = ( int ) LoginStep . ChooseProfile ; }
336+ catch ( Exception ex )
337+ {
338+ ViewModel . AppBarText = ex . Message == "NOID" ? LoginManager . Instance . GetServerLoginResponseMessage ( ) : "Can not load user profile in offline mode" ;
339+ ViewModel . LoginStepIndex = ( int ) LoginStep . ChooseProfile ;
340+ }
328341 }
329342 }
330343 }
@@ -408,7 +421,7 @@ private void ValidateSignUpData()
408421 }
409422 }
410423 }
411-
424+
412425
413426 private void UserProfileContextMenu_Click ( object sender , RoutedEventArgs e )
414427 {
0 commit comments