public void SignUp() { RefreshBindingScope.Scope(); if (this.Validator.HasErrors) { return; } try { IsBusy = true; SecurityServiceClient client = new SecurityServiceClient(); client.SignUpCompleted += (sender, e) => { IsBusy = false; if (e.Error != null) { e.Error.Handle(); } else { HandleSignUpResult(e.Result); } if (SignUpCompleted != null) { SignUpCompleted(this, EventArgs.Empty); } }; client.SignUpAsync(UserName, Password, Email); } catch { IsBusy = false; } }
public void Create() { RefreshBindingScope.Scope(); if (this.Validator.HasErrors) { return; } IsBusy = true; try { PhotoServiceClient svc = new PhotoServiceClient(); Album album = new Album(); album.Name = Name; svc.CreateAlbumCompleted += (sender, e) => { IsBusy = false; if (e.Error != null) { e.Error.Handle(); } if (CreateCompleted != null) { CreateCompleted(this, new AsyncOperationCompletedEventArgs(e.Error)); } }; svc.CreateAlbumAsync(album); } catch { IsBusy = false; } }
public void SignIn() { RefreshBindingScope.Scope(); if (this.Validator.HasErrors) { return; } IsBusy = true; SecurityContext.Current.SignIn(UserName, Password, KeepSignedIn, result => { if (!result.Success) { var messageBox = new MessageBoxViewModel() { MessageLevel = ViewModels.MessageLevel.Exclamation, Buttons = MessageBoxButtons.OK, Header = AppStrings.SignInFailedMessageHeader, Message = result.Error, DisplayName = AppStrings.SignInWindowTitle }; IoC.Get <IWindowManager>().ShowDialog(messageBox); } else { if (SignInSucceeded != null) { SignInSucceeded(this, EventArgs.Empty); } } IsBusy = false; }); }
public void Save() { RefreshBindingScope.Scope(); if (this.Validator.HasErrors) { return; } }
public EditAlbumViewModel(AlbumViewModel target) { if (target == null) { throw new ArgumentNullException("target"); } DisplayName = AppStrings.EditAlbumWindowTitle; RefreshBindingScope = new RefreshBindingScope(); _target = target; _name = target.Name; _description = target.Description; }
public void Save() { RefreshBindingScope.Scope(); if (this.Validator.HasErrors) { return; } IsBusy = true; try { PhotoServiceClient svc = new PhotoServiceClient(); svc.UpdateAlbumCompleted += (sender, e) => { IsBusy = false; if (e.Error != null) { e.Error.Handle(); } else { _target.Name = Name; _target.Description = Description; if (EditCompleted != null) { EditCompleted(this, EventArgs.Empty); } } }; svc.UpdateAlbumAsync(Name, Description, _target.Id); } catch { IsBusy = false; } }
public MemoViewModel() { RefreshBindingScope = new RefreshBindingScope(); }
public SignUpViewModel() { DisplayName = AppStrings.SignUpWindowTitle; RefreshBindingScope = new RefreshBindingScope(); }
public CreateAlbumViewModel() { DisplayName = AppStrings.CreateAlbumWindowTitle; RefreshBindingScope = new RefreshBindingScope(); }
public SignInViewModel() { DisplayName = AppStrings.SignInWindowTitle; RefreshBindingScope = new RefreshBindingScope(); }