/// <summary> /// Invoked when an item within a section is clicked. /// </summary> private void ItemView_ItemClick(object sender, ItemClickEventArgs e) { long itemId = ((BaseNote)e.ClickedItem).Id; Type type = null; switch (this.pivot.SelectedIndex) { case (int)NoteType.SimpleNote: type = typeof(EditSimpleNote); break; case (int)NoteType.TodoNote: type = typeof(EditTodoNotePage); break; case (int)NoteType.PhotoNote: type = typeof(EditPhotoNotePage); break; } if (type == null || !Frame.Navigate(type, itemId)) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } //else //{ // Debug.WriteLine(SimpleNotesList.SelectedItems.); //} }
/// <summary> /// Adds an item to the list when the app bar button is clicked. /// </summary> private void AddNoteBarButton_Click(object sender, RoutedEventArgs e) { Type type = null; switch (this.pivot.SelectedIndex) { case (int)NoteType.SimpleNote: type = typeof(EditSimpleNote); break; case (int)NoteType.TodoNote: type = typeof(EditTodoNotePage); break; case (int)NoteType.PhotoNote: type = typeof(PhotoPreviewPage); break; } if (type == null || !Frame.Navigate(type)) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } if (IsMultipleSelectionenable()) { UnsetMultipleSelection(); } //// Scroll the new item into view. }
private void TakenImage_Tapped(object sender, TappedRoutedEventArgs e) { if (!Frame.Navigate(typeof(PhotoDetailPage), viewModel.PhotoPath)) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } }
private async void SaveNoteBarButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(viewModel.Content)) { string alertMessage = AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "EmptyNoteAlert"); MessageDialog msgbox = new MessageDialog(alertMessage); await msgbox.ShowAsync(); return; } if (string.IsNullOrEmpty(viewModel.Title)) { viewModel.Title = AppResourcesLoader.LoadStringResource(StringResources.RESOURCES, "DefaultNoteTitle"); } if (RememberNoteGrid.Visibility == Visibility.Visible) { DateTime date = (DateTime)RememberingDatePicker.Date.Date; TimeSpan time = (TimeSpan)RememberingTimePicker.Time; DateTimeOffset dateTime = date + time; if (dateTime < DateTime.Now) { // TODO put this string in string resources MessageDialog msgbox = new MessageDialog("Date and hour must be in the future."); await msgbox.ShowAsync(); return; } if (action == PageAction.Create) { simpleNoteManager.AddNoteAndNotification(viewModel.Title, viewModel.Content, viewModel.Title, viewModel.NotificationDate.Date + viewModel.NotificationTime); } else { simpleNoteManager.UpdateNoteAndNotification(viewModel.ID, viewModel.Title, viewModel.Content, viewModel.Title, viewModel.NotificationDate.Date + viewModel.NotificationTime); } } else { if (action == PageAction.Create) { simpleNoteManager.AddNote(viewModel.Title, viewModel.Content); } else { simpleNoteManager.UpdateNote(viewModel.ID, viewModel.Title, viewModel.Content); } } if (Frame.CanGoBack) { Frame.GoBack(); } }
private void AddDeleteButtonToAppBar() { // Add separator. CommandBar.PrimaryCommands.Insert(DELETE_APP_BAR_BUTTON_POSITION, new AppBarSeparator()); // Create delete button. AppBarButton deleteButton = new AppBarButton(); deleteButton.Icon = new SymbolIcon(Symbol.Delete); deleteButton.Label = AppResourcesLoader.LoadStringResource(StringResources.RESOURCES, "DeleteAppBarButtonLabel"); deleteButton.Click += DeleteAppBarButton_Click; // Add delete button. CommandBar.PrimaryCommands.Insert(DELETE_APP_BAR_BUTTON_POSITION, deleteButton); }
private void TakePhotoAppBarButton_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(viewModel.PhotoPath)) { if (!Frame.Navigate(typeof(PhotoPreviewPage), PageAction.Update)) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } } else { if (!Frame.Navigate(typeof(PhotoPreviewPage))) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } } }
private void SaveAppBarButton_Click(object sender, RoutedEventArgs e) { ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[PhotoNoteManager.PHOTO_PATH_KEY] = photoTakenPath; if (action == PageAction.Update) { if (Frame.CanGoBack) { Frame.GoBack(); } } else { if (!Frame.Navigate(typeof(EditPhotoNotePage))) { throw new Exception(AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "NavigationFailedExceptionMessage")); } } }
private async void SaveNoteBarButton_Click(object sender, RoutedEventArgs e) { int emptyNoteCount = 0; for (int i = viewModel.TodoEntries.Count - 1; i >= 0; i--) { if (string.IsNullOrEmpty(viewModel.TodoEntries[i].Content)) { emptyNoteCount++; } } if (emptyNoteCount == viewModel.TodoEntries.Count) { string alertMessage = AppResourcesLoader.LoadStringResource(StringResources.ERRORS, "EmptyNoteAlert"); MessageDialog msgbox = new MessageDialog(alertMessage); await msgbox.ShowAsync(); return; } for (int i = viewModel.TodoEntries.Count - 1; i >= 0; i--) { if (string.IsNullOrEmpty(viewModel.TodoEntries[i].Content)) { viewModel.TodoEntries.Remove(viewModel.TodoEntries[i]); } } if (string.IsNullOrEmpty(viewModel.Title)) { viewModel.Title = AppResourcesLoader.LoadStringResource(StringResources.RESOURCES, "DefaultNoteTitle"); } if (RememberNoteGrid.Visibility == Visibility.Visible) { DateTimeOffset date = (DateTimeOffset)RememberingDatePicker.Date.Date; TimeSpan time = (TimeSpan)RememberingTimePicker.Time; date = date.Add(time); Debug.WriteLine(date); if (date < DateTime.Now) { // TODO put this string in string resources MessageDialog msgbox = new MessageDialog("Date and hour must be in the future."); await msgbox.ShowAsync(); return; } if (state == PageAction.Create) { todoNoteDataHelper.AddNoteAndNotification(viewModel.Title, viewModel.TodoEntries, viewModel.Title, viewModel.NotificationDate.Date + viewModel.NotificationTime); } else { todoNoteDataHelper.UpdateNoteAndNotification(viewModel.Id, viewModel.Title, viewModel.TodoEntries, viewModel.Title, viewModel.NotificationDate.Date + viewModel.NotificationTime); } } else { if (state == PageAction.Create) { todoNoteDataHelper.AddNote(viewModel.Title, viewModel.TodoEntries); } else { todoNoteDataHelper.UpdateNote(viewModel.Id, viewModel.Title, viewModel.TodoEntries); } } if (Frame.CanGoBack) { Frame.GoBack(); } }