示例#1
0
 public GroupingControllerTasksWithCategories(GridControl grid)
 {
     this.fGrid        = grid;
     this.fTasks       = TasksWithCategories.GetTasksWithCategories();
     grid.EndGrouping += new RoutedEventHandler(Grid_Grouping);
     SetDataSource();
 }
示例#2
0
        public static Categories GetCategories(TasksWithCategories collection)
        {
            Categories ret = new Categories();

            string[] names = new string[] { "Business", "Competitor", "Favorites", "Gifts", "Goals", "Holiday", "Ideas", "International", "Personal" };
            for (int i = 0; i < names.Length; i++)
            {
                ret.List.Add(new Category(i + 1, names[i]));
            }
            return(ret);
        }
示例#3
0
        static string GetCategoryByTask(TasksWithCategories collection, Task task)
        {
            string ret = "";

            for (int i = 0; i < collection.fCategories.Count; i++)
            {
                if (collection.HasCategory(task, collection.fCategories[i]))
                {
                    ret += string.Format("{0}{1}", (ret == "" ? "" : ", "), collection.fCategories[i].CategoryName);
                }
            }
            if (ret == "")
            {
                ret = "<None>";
            }
            return(ret);
        }
示例#4
0
        public static TasksWithCategories GetTasksWithCategories()
        {
            TasksWithCategories ret = new TasksWithCategories();
            Random rnd = new Random();

            for (int i = 0; i < Tasks.MaxTasks; i++)
            {
                for (int j = 0; j < 1 + rnd.Next(Categories.MaxCategories); j++)
                {
                    Category cat = ret.fCategories[rnd.Next(ret.fCategories.Count)];
                    if (!ret.HasCategory(ret.fTasks[i], cat))
                    {
                        ret.List.Add(new Relation(ret.fTasks[i], cat));
                    }
                }
            }
            return(ret);
        }
示例#5
0
        public static Tasks GetTasks(TasksWithCategories collection)
        {
            Tasks  ret = new Tasks();
            Random rnd = new Random();

            for (int i = 0; i < MaxTasks; i++)
            {
                int index = i + 1;
                ret.List.Add(ViewModelSource.Create(() => new Task(collection, index, "Task" + index, DateTime.Today.AddDays(rnd.Next(5)))));
                if (i == 2)
                {
                    ret[i].PercentComplete = 50;
                }
                if (i == 6)
                {
                    ret[i].PercentComplete = 100;
                }
            }
            return(ret);
        }