示例#1
0
 private void Refresh()
 {
     SetWeekLabel();
     Wipe();
     DeletedCheckBox.Visibility = (HandleData.StoreDeleted()) ? Visibility.Visible : Visibility.Hidden;
     PopulateListBox(HandleData.GetList(DeletedCheckBox, CompletedCheckBox));
 }
        /* populate list box */
        private void PopulateListBox(List <Entry> list)
        {
            List <Entry> result = HandleData.LinqQueryList(list, sunday, saturday, sortTimeAsc, sortTimeDesc);

            foreach (Entry e in result)
            {
                DayOfWeek day = e.AssignToDate.DayOfWeek;

                if (e.Repeats_Daily)
                {
                    day = today.DayOfWeek;
                }
                if (e.Repeats_Monthly)
                {
                    if (HandleData.NumMonths(e, sunday) > 0)
                    {
                        DateTime month = e.AssignToDate.AddMonths(HandleData.NumMonths(e, today));
                        day = month.DayOfWeek;
                    }
                }
                else if (e.Repeats_Yearly)
                {
                    DateTime year = e.AssignToDate.AddYears(HandleData.NumYears(e, today));
                    day = year.DayOfWeek;
                }

                if (day == today.DayOfWeek)
                {
                    HandleData.CheckDateAddToBox(e, today.Date, today, DeletedCheckBox, CompletedCheckBox, Box).Selected += Item_Selected;
                }
            }
        }
 public static void AutoSave(object sender, System.ComponentModel.CancelEventArgs e, Window window)
 {
     if (IsModified())
     {
         if (Properties.Settings.Default.AutoSave == true)
         {
             if (HandleData.GetCurrentFilePath() == "")
             {
                 MessageBoxResult result = System.Windows.MessageBox.Show(window, "You have enabled Auto-Save, but there is no file found. Would you like to save your changes?", "File not found", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
                 if (result == MessageBoxResult.Yes)
                 {
                     HandleData.Save(HandleData.GetCurrentFilePath());
                 }
                 else if (result == MessageBoxResult.Cancel)
                 {
                     e.Cancel = true;
                 }
             }
             else
             {
                 //System.Windows.MessageBox.Show($"{entries.Count}");
                 HandleData.Save(HandleData.GetCurrentFilePath());
                 //System.Windows.MessageBox.Show($"{entries.Count}");
             }
         }
     }
 }
示例#4
0
        //Add the item
        private void AddItem_Click(object sender, RoutedEventArgs e)
        {
            if (Properties.Settings.Default.DefaultFile == "")
            {
                MessageBox.Show("Please choose a file in order to begin your list");
                return;
            }


            DateTime due    = DueBy.SelectedDate.Value;
            DateTime assign = assignToDay.SelectedDate.Value;

            if (due < assign)
            {
                MessageBox.Show("Error: Due Date Cannot Be Before the Assigned Date");
                return;
            }

            String      label    = assignment.Text;
            Classes     forclass = (Classes)ClassPicker.SelectedItem;
            String      notes    = Notes_TextBox.Text;
            List <bool> repeats  = new List <bool>();

            repeats.Add((Repeats_Daily.IsChecked.Value) ? true : false);
            repeats.Add((Repeats_Weekly.IsChecked.Value) ? true : false);
            repeats.Add((Repeats_Monthly.IsChecked.Value) ? true : false);
            repeats.Add((Repeats_Yearly.IsChecked.Value) ? true : false);

            int minutesToComplete = (int)Minutes.Value;

            Entry ent = new Entry(label, forclass, notes, assign, due, minutesToComplete, (Repeats_Daily.IsChecked.Value == true) ? true : false, (Repeats_Weekly.IsChecked.Value == true) ? true : false, (Repeats_Monthly.IsChecked.Value == true) ? true : false, (Repeats_Yearly.IsChecked.Value == true) ? true : false);

            HandleData.AddToList(ent);
            ClearItems();
        }
        /* delete event */
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (!entry.Repeats)
            {
                HandleData.RemoveEntry(entry);
                MessageBox.Show($"{Assignment.Text} Deleted");
                Owner = null;
                Close();
            }
            else
            {
                MessageBoxResult result = HandleData.CustomMessageBox("Would You Like to Delete Only This Event, or All Instances of This Event?", "Choose How You Would Like to Delete This Event", "This Instance", "All Instances", "Cancel", MessageBoxButton.YesNo, MessageBoxImage.Question);

                if ((result == MessageBoxResult.Yes) || (result == MessageBoxResult.No))
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        entry.AddDeletedDay(assignDate);
                    }
                    else if (result == MessageBoxResult.No)
                    {
                        entry.Deleted = true;
                        MessageBox.Show($"{Assignment.Text} Deleted");
                    }
                    Owner = null;
                    Close();
                }
            }
        }
示例#6
0
 /* closing */
 private void ChoreWheel_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     HandleData.AutoSave(sender, e, this);
     if (timer != null)
     {
         timer.Dispose();
     }
 }
示例#7
0
        private void PopulateListBox(List <Entry> list)
        {
            List <Entry> newList = HandleData.LinqQueryList(list, sunday, saturday, sortTimeAsc, sortTimeDesc);

            foreach (Entry e in newList)
            {
                GenerateListBoxItem(e);
            }
        }
示例#8
0
        public List()
        {
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            InitializeComponent();

            Refresh();

            Closing += List_Closing;
            DeletedCheckBox.Visibility = (HandleData.StoreDeleted()) ? Visibility.Visible : Visibility.Hidden;
        }
        public static void NewClick(Window window)
        {
            HandleData.NewList();
            MainWindow main = new MainWindow();

            main.Owner = window;
            main.Show();
            main.Owner = null;
            window.Close();
            HandleData.OpenAddItemWindow(main);
        }
示例#10
0
        //timer tick event
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (!(numTicks < 600))
            {
                whir.Open(whirsound);
                whir.Play();
            }

            if ((numTicks > (totalTicks / 4)) && (numTicks % (totalTicks / 3) == 0))
            {
                sound.Open(slothitsound);
                sound.Play();
            }
            if (numTicks <= (totalTicks / 3))
            {
                slots.Shuffle();
                Slot1.Content    = slots.First();
                Slot1.Background = HandleData.GetClassColor(slots.First());
                slots.Shuffle();
                Slot2.Content    = slots.First();
                Slot2.Background = HandleData.GetClassColor(slots.First());
                slots.Shuffle();
                Slot3.Content    = slots.First();
                Slot3.Background = HandleData.GetClassColor(slots.First());
            }
            else if (numTicks <= (2 * (totalTicks / 3)))
            {
                slots.Shuffle();
                Slot2.Content    = slots.First();
                Slot2.Background = HandleData.GetClassColor(slots.First());
                slots.Shuffle();
                Slot3.Content    = slots.First();
                Slot3.Background = HandleData.GetClassColor(slots.First());
            }
            else if (numTicks < totalTicks)
            {
                slots.Shuffle();
                Slot3.Content    = slots.First();
                Slot3.Background = HandleData.GetClassColor(slots.First());
            }

            numTicks += 100;

            if (numTicks >= totalTicks)
            {
                sound.Open(slothitsound);
                sound.Play();
                timer.Stop();
                timer.Dispose();
                DisplayResult();
                numTicks = 0;
                timer    = null;
            }
        }
        public Today(DateTime date)
        {
            this.today            = date;
            sunday                = date.Sunday();
            saturday              = date.Saturday();
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            InitializeComponent();

            Closing += List_Closing;
            DeletedCheckBox.Visibility = (HandleData.StoreDeleted()) ? Visibility.Visible : Visibility.Hidden;

            Refresh();
        }
示例#12
0
        private void FillClassBoxes()
        {
            RemoveClass.Items.Clear();
            List <Classes> list = HandleData.LoadClasses();

            foreach (Classes c in list)
            {
                RemoveClass.Items.Add(c);
            }
            if (RemoveClass.Items.Count == 0)
            {
                RemoveClass.Items.Add(new Classes("Misc", "Gray"));
            }
        }
示例#13
0
        private void Browse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "ToDoList (.todolist)|*.todolist"; // Filter files by extension

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string s = openFileDialog.FileName;
                HandleData.SetFilePath(s);
                newFile = s;
                DirectoryTextBlock.Text = s;
            }
        }
示例#14
0
 private void Settings_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (!HandleData.StoreDeleted())
     {
         List <Entry> list = new List <Entry>();
         foreach (Entry entry in HandleData.GetAllEntries())
         {
             if (!entry.Deleted)
             {
                 list.Add(entry);
             }
         }
         HandleData.ReplaceEntryList(list);
     }
 }
        public MainWindow()
        {
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            InitializeComponent();

            MonthLabel.Content = DateTime.Now.ToString("MMM");
            DayLabel.Content   = DateTime.Now.Day.ToString();

            Closing += MainWindow_Closing;

            if ((Properties.Settings.Default.AutoLoad == true) && (Properties.Settings.Default.DefaultFile != null) && (Properties.Settings.Default.DefaultFile != ""))
            {
                HandleData.LoadToDoList(Properties.Settings.Default.DefaultFile);
            }
        }
示例#16
0
        private void Button_Click(object sender, RoutedEventArgs eventArgs)
        {
            MessageBoxResult result = System.Windows.MessageBox.Show("Permanently Delete all Deleted and Completed Items?", "Purge List", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                List <Entry> allEntries = HandleData.GetAllEntries();
                List <Entry> resultList = new List <Entry>();
                foreach (Entry e in allEntries)
                {
                    if (!e.Deleted && !e.Completed)
                    {
                        resultList.Add(e);
                    }
                }
                HandleData.ReplaceEntryList(resultList);
            }
        }
        /* completed event */
        private void Completed_Click(object sender, RoutedEventArgs e)
        {
            if (!entry.Repeats)
            {
                HandleData.RemoveEntry(entry);
                entry.Completed = true;
                HandleData.AddToList(entry);
            }
            else
            {
                entry.AddCompletedDay(assignDate);
            }

            Owner = null;
            Close();

            MessageBox.Show($"{Assignment.Text} Marked as Complete for {Assign_On.Text}!");
        }
示例#18
0
        private void SaveChanges()
        {
            if (AddClass.Text.Length > 0)
            {
                string color = cp.SelectedColorText;
                color = (color == "" || color == null) ? "Colors.Transparent" : color;

                Classes newClass = new Classes(AddClass.Text, color);

                HandleData.AddToClasses(newClass);

                HandleData.SaveClasses(HandleData.GetClasses());
            }
            if (RemoveClass.SelectedIndex > -1)
            {
                if (EditColor.IsChecked.Value)
                {
                    string color = cp.SelectedColorText;
                    color = (color == "" || color == null) ? "Colors.Transparent" : color;
                    HandleData.EditClassColor((Classes)RemoveClass.SelectedItem, color);
                }
                else if (DeleteClass.IsChecked.Value)
                {
                    HandleData.RemoveClass((Classes)RemoveClass.SelectedItem);
                }
            }
            if (DirectoryTextBlock.Text.Length > 0)
            {
                Properties.Settings.Default.DefaultFile = newFile;
                Properties.Settings.Default.DefaultPath = System.IO.Path.GetDirectoryName(newFile);
            }

            Properties.Settings.Default.AutoSave     = (AutoSave.IsChecked.Value == true) ? true : false;
            Properties.Settings.Default.AutoLoad     = (AutoLoad.IsChecked.Value == true) ? true : false;
            Properties.Settings.Default.StoreDeleted = (StoreDeleted.IsChecked.Value == true) ? true : false;

            Properties.Settings.Default.Save();
            ClearForm();
            FillClassBoxes();
        }
 public static void CheckForFile()
 {
     if ((Properties.Settings.Default.AutoLoad == true) && ((Properties.Settings.Default.DefaultFile == null) || (Properties.Settings.Default.DefaultFile == "")))
     {
         MessageBoxResult result = HandleData.CustomMessageBox("Auto-Load is enabled, but there is no file found. Please Open or Create a new file, or disable Auto-Load", "No file found", "Open List", "New List", "Disable Auto-Load", MessageBoxButton.YesNoCancel, MessageBoxImage.Exclamation);
         if (result == MessageBoxResult.Yes)
         {
             //open file
             HandleData.LoadToDoList();
         }
         else if (result == MessageBoxResult.No)
         {
             //new file
             HandleData.NewList();
         }
         else if (result == MessageBoxResult.Cancel)
         {
             //disable auto-load
             Properties.Settings.Default.AutoLoad = false;
         }
     }
 }
示例#20
0
        //begin the slot game
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            HandleData.CheckForFile();
            if (slots.Count < 1)
            {
                MessageBox.Show(this, "There are no available to-do items. Either they don't exist, they are deleted, or they are completed. Please choose a different list or add some items!", "There are no to-do-list items!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            sound.Open(leversound);
            sound.Play();

            LeverLever.BeginAnimation(Ellipse.HeightProperty, LeverLeverSpinHeight);
            LeverLever.BeginAnimation(Canvas.TopProperty, LeverLeverSpinPosition);
            LeverBall.BeginAnimation(Canvas.TopProperty, LeverBallSpinTop);
            LeverBall.BeginAnimation(Canvas.LeftProperty, LeverBallSpinLeft);


            Lever.Visibility = Visibility.Hidden;
            Viewer1.Fill     = rectFill;
            Viewer2.Fill     = rectFill;
            Viewer3.Fill     = rectFill;

            Jackpot.Visibility = Visibility.Hidden;
            Loser.Visibility   = Visibility.Hidden;
            Winner.Visibility  = Visibility.Hidden;



            timer = new System.Windows.Forms.Timer();

            totalTicks = 6000;

            timer.Interval = 100;
            timer.Tick    += Timer_Tick;
            timer.Start();
            WeekItems.IsEnabled   = false;
            TodaysItems.IsEnabled = false;
        }
        public static ListBoxItem CheckDateAddToBox(Entry e, DateTime date, DateTime TodayOrSunday, System.Windows.Controls.CheckBox DeletedCheckBox, System.Windows.Controls.CheckBox CompletedCheckBox, System.Windows.Controls.ListBox box)
        {
            Entry entry = new Entry();

            entry = e;

            ListBoxItem item = new ListBoxItem
            {
                Content    = entry,
                Background = HandleData.GetClassColor(e)
            };

            item.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;

            if (!((date > entry.DueOn.Date) || (date < entry.AssignToDate.Date)))
            {
                if (!(date >= e.AssignToDate.Date) || (date <= e.DueOn.Date))
                {
                    if ((entry.HasDeletedDate(date)) || (entry.HasCompletedDate(date)))
                    {
                        if (((entry.HasDeletedDate(TodayOrSunday)) && (DeletedCheckBox.IsChecked.Value == true)) ||
                            ((entry.HasCompletedDate(TodayOrSunday)) && (CompletedCheckBox.IsChecked.Value == true)))
                        {
                            box.Items.Add(item);
                            //item.Selected += Item_Selected;
                            return(item);
                        }
                    }
                    else
                    {
                        box.Items.Add(item);
                        //item.Selected += Item_Selected;
                        return(item);
                    }
                }
            }
            return(new ListBoxItem());
        }
        /* ENTRY RELATED METHODS */
        public static List <Entry> GetList(System.Windows.Controls.CheckBox DeletedCheckBox, System.Windows.Controls.CheckBox CompletedCheckBox)
        {
            List <Entry> list = new List <Entry>();

            if (DeletedCheckBox.IsVisible)
            {
                if ((DeletedCheckBox.IsChecked.Value == true) && (CompletedCheckBox.IsChecked.Value == true))
                {
                    list = HandleData.GetEntries(true, true);
                }
                else if ((DeletedCheckBox.IsChecked.Value == false) && (CompletedCheckBox.IsChecked.Value == true))
                {
                    list = HandleData.GetEntries(false, true);
                }
                else if ((DeletedCheckBox.IsChecked.Value == true) && (CompletedCheckBox.IsChecked.Value == false))
                {
                    list = HandleData.GetEntries(true, false);
                }
                else
                {
                    list = HandleData.GetEntries(false, false);
                }
            }
            else
            {
                if (CompletedCheckBox.IsChecked.Value == true)
                {
                    list = HandleData.GetEntries(false, true);
                }
                else
                {
                    list = HandleData.GetEntries(false, false);
                }
            }
            return(list);
        }
示例#23
0
        public AddItem()
        {
            HandleData.CheckForFile();

            InitializeComponent();
            foreach (Classes s in HandleData.GetClasses())
            {
                ClassPicker.Items.Add(s);
            }
            ClassPicker.SelectedIndex = 0;

            Repeats_Daily.Checked     += Repeat_Check;
            Repeats_Weekly.Checked    += Repeat_Check;
            Repeats_Monthly.Checked   += Repeat_Check;
            Repeats_Yearly.Checked    += Repeat_Check;
            Repeats_Daily.Unchecked   += Repeat_Check;
            Repeats_Weekly.Unchecked  += Repeat_Check;
            Repeats_Monthly.Unchecked += Repeat_Check;
            Repeats_Yearly.Unchecked  += Repeat_Check;
            Repeats_Never.Checked     += Repeat_Check;
            Repeats_Never.Unchecked   += Repeat_Check;

            Closing += AddItem_Closing;
        }
 private void SaveAs_Click(object sender, RoutedEventArgs e)
 {
     HandleData.SaveAs();
 }
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     HandleData.Save(Properties.Settings.Default.DefaultFile);
 }
 /*  CLICK EVENTS */
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     HandleData.LoadToDoList();
 }
 private void Exit_Click(object sender, RoutedEventArgs e)
 {
     HandleData.Exit();
 }
 /* closing event */
 private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     HandleData.AutoSave(sender, e, this);
 }
 private void About_Click(object sender, RoutedEventArgs e)
 {
     HandleData.AboutWindow(sender, e, this);
 }
 private void Read_Me_Click(object sender, RoutedEventArgs e)
 {
     HandleData.ReadMe(sender, e, this);
 }