Ejemplo n.º 1
0
        /// <summary>
        /// makes the goal undone by returning it to the nominal stage.
        /// </summary>
        /// <param name="myListView"></param>
        /// <param name="goal"></param>
        public static void MakeGoalUnDone(ListView myListView, Goal goal)
        {
            var button = FindRepeaterChildControl.FindChildControl <Button>(myListView, Convert.ToInt16(goal.GoalTag)) as Button;
            var border = FindRepeaterChildControl.FindChildControl <Border>(myListView, Convert.ToInt16(goal.GoalTag)) as Border;

            border.Background     = new SolidColorBrush(Colors.White);
            button.Content        = String.Empty;
            button.Content        = "\xE739";
            (goal as Goal).IsDone = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the second version of the <seealso cref="GoalManipulation.MakeGoalDone(ObservableCollection{Goal}, User, ListView, object)"/>
        /// in this version it's just the navigation update of the goals
        /// </summary>
        /// <param name="myListView"></param>
        /// <param name="goal"></param>
        public static void MakeGoalDone(ListView myListView, Goal goal)
        {
            var border = FindRepeaterChildControl.FindChildControl <Border>(myListView,
                                                                            Convert.ToInt16(goal.GoalTag)) as Border;
            var button = FindRepeaterChildControl.FindChildControl <Button>(myListView, Convert.ToInt16(goal.GoalTag)) as Button;

            border.Background = new SolidColorBrush(Color.FromArgb(255, 115, 255, 81));
            button.Content    = String.Empty;
            button.Content    = "\xE8FB";
            goal.IsDone       = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Makes the goal -with the same tag as the <c>_sender</c> which is the delete button- done .
        /// <para>
        ///     First of all it searches for the border - with the same tag as the <c>_sender</c>
        ///     it find this border by calling the <see cref="FindRepeaterChildControl.FindChildControl{T}(DependencyObject, int)"/>
        /// </para>
        /// <para>
        ///     Then it changes the border's background to light green, and also the <c>_sender</c>'s content to check.
        /// </para>
        /// <para>
        ///     And then it fetches for the goal in both the lists that has the same goal tag as the one
        ///     that wanted to be done in the ListView
        /// </para>
        /// </summary>
        /// <param name="goals"></param>
        /// <param name="_user"></param>
        /// <param name="myListView"></param>
        /// <param name="_sender"></param>
        public static void MakeGoalDone(ObservableCollection <Goal> goals, User _user, ListView myListView, object _sender)
        {
            var border = FindRepeaterChildControl.FindChildControl <Border>(myListView,
                                                                            Convert.ToInt16((_sender as Button).Tag)) as Border;

            border.Background           = new SolidColorBrush(Color.FromArgb(255, 115, 255, 81));
            (_sender as Button).Content = String.Empty;
            (_sender as Button).Content = "\xE8FB";
            var doneItemOfObservableCollection = goals.FirstOrDefault(g => g.GoalTag == Convert.ToInt32((_sender as Button).Tag));

            doneItemOfObservableCollection.IsDone = true;
            var doneItemOfUsersCollection = _user.Goals.FirstOrDefault(g => g.GoalTag == Convert.ToInt16((_sender as Button).Tag));

            doneItemOfUsersCollection.IsDone = true;
        }
Ejemplo n.º 4
0
        public static void UpdateNoteColor(object sender, Brush currentBrush, GridView myGridView, ObservableCollection <Note> allNotes, User myUser)
        {
            //1. Find the grid!
            var myGrid = (Grid)FindRepeaterChildControl.FindChildControl <Grid>(myGridView, Convert.ToInt16((sender as StackPanel).Tag));

            //2. Update the grid's color
            myGrid.Background = currentBrush;

            //3. Save it to the collections
            Note currentNote = allNotes.FirstOrDefault(n => n.NoteTag == Convert.ToInt16((sender as StackPanel).Tag));

            currentNote.NoteColor = (Color)myGrid.Background.GetValue(SolidColorBrush.ColorProperty);

            currentNote           = myUser.Notes.FirstOrDefault(n => n.NoteTag == Convert.ToInt32((sender as StackPanel).Tag));
            currentNote.NoteColor = (Color)myGrid.Background.GetValue(SolidColorBrush.ColorProperty);
        }
Ejemplo n.º 5
0
        public static void CheckTheSameColoredToggleButton(object sender, GridView notesGridView)
        {
            //1. Get the grid (and its background) with the same tag as this stackpanel (sender)
            Grid myGrid = (Grid)FindRepeaterChildControl.FindChildControl <Grid>(notesGridView, Convert.ToInt32((sender as StackPanel).Tag));

            //2. look for the togglebuttons inside the flyout of this button(.flyout.content)
            //      and then if the background matches, check!!
            foreach (StackPanel sp in (sender as StackPanel).Children)
            {
                foreach (ToggleButton tglbtn in sp.Children)
                {
                    if ((Color)tglbtn.Background.GetValue(SolidColorBrush.ColorProperty) == (Color)myGrid.Background.GetValue(SolidColorBrush.ColorProperty))
                    {
                        // 3. change the button's content to check
                        tglbtn.Content = "\xE8FB";
                        return;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public static void UpdateTheCharactersLeftOnNote(object sender, GridView notesGridView)
        {
            TextBlock charactersLeftOnNoteTextBlock = (TextBlock)FindRepeaterChildControl.FindChildControl <TextBlock>(notesGridView, Convert.ToInt16((sender as TextBox).Tag));

            charactersLeftOnNoteTextBlock.Text = (300 - (sender as TextBox).Text.Length).ToString();
        }
Ejemplo n.º 7
0
        public static void MakeTheCharactersLeftOnNoteCollapsed(object sender, GridView notesGridView)
        {
            TextBlock charactersLeftOnNoteTextBlock = (TextBlock)FindRepeaterChildControl.FindChildControl <TextBlock>(notesGridView, Convert.ToInt32((sender as TextBox).Tag));

            charactersLeftOnNoteTextBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }