/// <summary> /// Handles the AddButton Click which adds the note. /// </summary> /// <remarks> /// It adds the note to both the <c>ObservableCollection{Note}</c> and the <c>User</c>'s /// does this by calling the <see cref="NoteManipulation.AddNote(string, ObservableCollection{Note}, User, Color)"/> /// </remarks> /// <remarks> /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private async void AddButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { NoteManipulation.AddNote(NewNoteTextBox.Text, notes, App.MyUser, (Color)noteBrush.GetValue(SolidColorBrush.ColorProperty)); NewNoteTextBox.Text = String.Empty; myStackPanel.Background = new SolidColorBrush(Colors.White); foreach (StackPanel sp in (NewNoteColorFlyout.Content as StackPanel).Children) { foreach (ToggleButton tb in sp.Children) { if (tb.IsChecked == true) { tb.IsChecked = false; tb.Content = String.Empty; } if ((Color)tb.Background.GetValue(SolidColorBrush.ColorProperty) == Colors.White) { tb.IsChecked = true; tb.Content = "\xE8FB"; noteBrush = tb.Background; } } } string userAsJson = Serializer.Serialize(App.MyUser); await Serializer.SaveUserAsync(userAsJson); myStackPanel.Visibility = Visibility.Collapsed; WriteNoteClone.Visibility = Visibility.Visible; }
private async void DeleteNoteButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { NoteManipulation.Delete(notes, App.MyUser, sender); string userAsJson = Serializer.Serialize(App.MyUser); await Serializer.SaveUserAsync(userAsJson); }
private void NoteBodyTextBox_TextChanged(object sender, TextChangedEventArgs e) { NoteManipulation.UpdateTheCharactersLeftOnNote(sender, NotesGridView); var currentNote = notes.FirstOrDefault(n => n.NoteTag == Convert.ToInt16((sender as TextBox).Tag)); currentNote.Body = (sender as TextBox).Text; (sender as TextBox).FontSize = NoteBodyFontSizeGenerator.GetNoteFontSize((sender as TextBox).Text); }
private async void NoteBodyTextBox_PointerExited(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { NoteManipulation.MakeTheCharactersLeftOnNoteCollapsed(sender, NotesGridView); App.MyUser.Notes = new ObservableCollection <Note>(); foreach (Note note in notes) { App.MyUser.Notes.Add(note); } string userAsJson = Serializer.Serialize(App.MyUser); await Serializer.SaveUserAsync(userAsJson); }
/// <summary> /// Checks for the /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void ToggleButton_Checked_1(object sender, RoutedEventArgs e) { //TODO: updates the grid's background color, finds it and changes its background // based on the sender as ToggleButton NoteManipulation.UpdateNoteColor((((sender as ToggleButton).Parent as Panel).Parent as Panel), (sender as ToggleButton).Background, NotesGridView, notes, App.MyUser); (sender as ToggleButton).Content = "\xE8FB"; //uncheck all the other togglebuttons that were previously checked NoteManipulation.UnCheckAllColorToggleButtons(sender, NotesGridView); string userAsJson = Serializer.Serialize(App.MyUser); await Serializer.SaveUserAsync(userAsJson); }
/// <summary> /// Checks for the note's grid's background to update the flyout's button with the same background /// </summary> /// <remarks> /// It does this by calling the <see cref="NoteManipulation.CheckTheSameColoredToggleButton(object, GridView)"/> /// which -as described in its summary- gets the grid with the same tag as the flyout's content's tag /// which is stackpanel and this stackpanel contains multiple stackpanels and /// it searches all the buttons inside them to find which one is as the same /// background as the grid. /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void Flyout_Opened_1(object sender, object e) => NoteManipulation.CheckTheSameColoredToggleButton(((sender as Flyout).Content as StackPanel), NotesGridView);
private void NoteBodyTextBox_PointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) => NoteManipulation.MakeTheCharactersLeftOnNoteVisible(sender, NotesGridView);