Esempio n. 1
0
 public CreateCategory()
 {
     InitializeComponent();
     ColorPicker.Title = "Choose a category color";
     ColorManager.FeedColorPicker(ColorPicker);
 }
        private void RefreshListDb()
        {
            List <Table.TaskManager> ContentTask = App.Database.GetTaskAsync();

            int NbTask = ContentTask.Count();

            if (NbTask > 1)
            {
                this.Title = NbTask.ToString() + " tasks";
            }
            else
            {
                this.Title = NbTask.ToString() + " task";
            }

            List <Table.TaskManagerParameter> Settings = new List <Table.TaskManagerParameter>();

            Table.FilterManager MyFilter;
            if (App.Filter.CheckFilterExist() == false)
            {
                App.Filter.SaveAsync(new Table.FilterManager());
            }
            MyFilter = App.Filter.GetFilterAsync().ElementAt(0);
            foreach (var current in ContentTask)
            {
                Table.TaskManagerParameter tmp = new Table.TaskManagerParameter();
                tmp.CopyTask(current);
                Table.CategoryManager tmpcategory = App.Database2.GetSpecific(tmp.CategoryId);
                if (((MyFilter.Todo == true && tmp.Todo == true) ||
                     (MyFilter.Done == true && tmp.Todo == false)) &&
                    ((MyFilter.LateDate == true &&
                      (DateTime.Compare(current.ExpirationDate, DateTime.Now) < 0)) ||
                     (MyFilter.UpDate == true &&
                      !(DateTime.Compare(current.ExpirationDate, DateTime.Now) < 0)))
                    /*&& (tmpcategory.Checked == true)*/)
                {
                    if (tmpcategory != null)
                    {
                        tmp.CategoryColor = ColorManager.GetColorFromString(tmpcategory.Color);
                    }
                    else
                    {
                        tmp.CategoryColor = ColorManager.GetColorFromString(null);
                    }
                    if (DateTime.Compare(current.ExpirationDate, DateTime.Now) < 0)
                    {
                        tmp.ExpirationDateColor = Color.Red;
                    }
                    else
                    {
                        tmp.ExpirationDateColor = Color.White;
                    }
                    if (tmp.Todo == true)
                    {
                        tmp.TodoInfo = "Todo";
                    }
                    else
                    {
                        tmp.TodoInfo = "Done";
                    }
                    Settings.Add(tmp);
                }
            }
            TaskListView.ItemsSource = Settings;
        }