protected async override void OnExecute(object parameter) { if (parameter is UserBrowserViewModel browser && browser.SelectedItem is IUserCategoryDescriptor descriptor) { await UserCategoryUtility.NewUserAsync(this.authenticator, descriptor); } }
protected override bool OnCanExecute(object parameter) { if (parameter is UserBrowserViewModel browser && browser.SelectedItem is IUserCategoryDescriptor descriptor) { return(UserCategoryUtility.CanNewUser(this.authenticator, descriptor)); } return(false); }
public async Task MoveAsync() { if (await UserCategoryUtility.MoveAsync(this.authentication, this.descriptor) == true) { await this.Dispatcher.InvokeAsync(() => { this.Parent.IsExpanded = true; this.IsSelected = true; }); } }
public async Task NewFolderAsync() { if (await UserCategoryUtility.NewFolderAsync(this.authentication, this.descriptor) is string categoryName) { await this.Dispatcher.InvokeAsync(() => { var viewModel = this.Items.First(item => item.DisplayName == categoryName); this.IsExpanded = true; viewModel.IsSelected = true; }); } }
public async Task DeleteAsync() { await UserCategoryUtility.DeleteAsync(this.authentication, this.descriptor); }