/// <summary> /// Called when a photo has been uploaded successfully. /// </summary> /// <param name="category">The associated category.</param> public Task OnUploadFinished(Category category) { _navigationFacade.NavigateToPhotoStream(category); // Remove the frames related to uploading the photo for back button navigation _navigationFacade.RemoveUploadPhotoFramesFromBackStack(category.Id); return Task.CompletedTask; }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="photoService">The photo service.</param> /// <param name="dialogService">The dialog service.</param> public CreateCategoryViewModel(IPhotoService photoService, IDialogService dialogService) { _photoService = photoService; _dialogService = dialogService; _categoryMatchFinder = new CategoryMatchFinder(); // Initialize lists _categories = new List<Category>(); // We use the Category data model as it // handles input validation. Category = new Category(); // We need to be always up-to-date regarding input validation, // lets register for model changes Category.PropertyChanged += Category_PropertyChanged; }
/// <summary> /// Action to take when a photo has been selected /// </summary> /// <param name="category">The category.</param> private void OnCategorySelected(Category category) { _navigationFacade.NavigateToPhotoStream(category); }
public void Init() { _category = new Category(); }
private void RefreshFilteredList(Category category = null) { FilteredCategories.Clear(); // Filter only the specific Category if (category != null) { FilteredCategories.Add(category); } else { _categoryMatchFinder.SearchCategories(SearchText, Categories) .ForEach(c => FilteredCategories.Add(c)); } }
private async void OnAddCategory() { try { // Ask user if category should be created. var confirmationResult = await _dialogService.ShowYesNoNotification("CreateCategoryRequestConfirmation_Message", "CreateCategoryRequestConfirmation_Title"); if (confirmationResult) { IsBusy = true; // Validate category name. _categoryMatchFinder.ValidateCategoryAcceptanceCriteria(SearchText, Categories); var category = await _photoService.CreateCategory(SearchText); // The created category needs to be added to the view // and pre-selected so that the user can continue immediately. Categories.Add(category); RefreshFilteredList(category); SelectedCategory = category; } } catch (CategoryMatchedException) { await _dialogService.ShowNotification("CategoryAlreadyExists_Message", "CategoryAlreadyExists_Title"); } catch (Exception) { await _dialogService.ShowGenericServiceErrorNotification(); } finally { IsBusy = false; } }
/// <summary> /// Navigates to the upload view to update data of /// the existing photo. /// </summary> /// <param name="photo">The photo to update.</param> /// <param name="category">The associated category.</param> public void NavigateToUploadView(Photo photo, Category category) { Navigate(typeof(UploadViewModel), new UploadViewModelEditPhotoArgs { Photo = photo, Category = category }, false); }
/// <summary> /// Navigates to the photo stream view. /// </summary> /// <param name="category">The category.</param> public void NavigateToPhotoStream(Category category) { NavigateToPhotoStream(category.ToCategoryPreview()); }
/// <summary> /// Called when a photo has been uploaded successfully. /// </summary> /// <param name="category">The associated category.</param> public Task OnUploadFinished(Category category) { _uploadFinishedAction.Invoke(); return Task.CompletedTask; }