Exemple #1
0
        /// <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;
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 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);
 }
Exemple #5
0
        /// <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);
        }
Exemple #6
0
 /// <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);
Exemple #7
0
 private void NoteBodyTextBox_PointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e) =>
 NoteManipulation.MakeTheCharactersLeftOnNoteVisible(sender, NotesGridView);