Esempio n. 1
0
        private void PointTasks()
        {
            foreach (var taskgroup in TaskManager.GetTaskGroups())
            {
                MetroFramework.Controls.MetroTabPage tabPage = new MetroFramework.Controls.MetroTabPage();
                tabPage.Name = taskgroup.GroupId;
                tabPage.Tag  = taskgroup;
                tabPage.Text = taskgroup.GroupName;
                tabPage.VerticalScrollbarSize               = 4;
                tabPage.HorizontalScrollbar                 = false;
                tabPage.HorizontalScroll.Enabled            = false;
                tabPage.HorizontalScrollbarHighlightOnWheel = false;
                tabPage.VerticalScrollbar = true;
                tabPage.AutoScroll        = true;
                tabPage.PagePanelDock <TaskForm>(list =>
                {
                    List <DailyTask> dtl = new List <DailyTask>();
                    foreach (var ctl in list)
                    {
                        dtl.Add(ctl.DailyTask);
                    }
                    TaskManager.GetTaskGroup(tabPage.Name).DailyTasks = dtl;
                    FileHelper.SaveJosn(TaskManager.ConvertJson());
                });

                metroTabControl.TabPages.Add(tabPage);

                foreach (var task in taskgroup.DailyTasks)
                {
                    tabPage.Controls.Add(AddTaskForm(task));
                }
            }
            this.metroStyleManager.Update();
        }
Esempio n. 2
0
        private void LoadTasks()
        {
            TaskManager.ClearGroups();
            LoadControl lc = new LoadControl(
                () =>
                {
                    TaskManager.ClearGroups();
                    var rj = FileHelper.ReadJosn<List<CustomTasks>>();
                    if (rj != null)
                    {
                        TaskManager.LoadGroup(rj.ToList<ITaskGroup>());
                    }
                },
                () =>
                {
                    foreach (var taskgroup in TaskManager.GetTaskGroups())
                    {
                        MetroFramework.Controls.MetroTabPage tabPage = new MetroFramework.Controls.MetroTabPage();
                        tabPage.Name = taskgroup.GroupId;
                        tabPage.Tag = taskgroup;
                        tabPage.Text = taskgroup.GroupName;
                        tabPage.VerticalScrollbarSize = 4;
                        tabPage.HorizontalScrollbar = false;
                        tabPage.HorizontalScroll.Enabled = false;
                        tabPage.HorizontalScrollbarHighlightOnWheel = false;
                        tabPage.VerticalScrollbar = true;
                        tabPage.AutoScroll = true;
                        tabPage.Theme = this.metroStyleManager1.Theme;

                        tabPage.PagePanelDock<TaskForm>(list =>
                        {
                            List<DailyTask> dtl = new List<DailyTask>();
                            foreach (var ctl in list)
                            {
                                dtl.Add(ctl.DailyTask);
                            }
                            TaskManager.GetTaskGroup(tabPage.Name).DailyTasks = dtl;
                        });

                        metroTabControl1.TabPages.Add(tabPage);

                        foreach (var task in taskgroup.DailyTasks)
                        {
                            TaskForm form = new TaskForm(this, task);
                            form.Theme = this.metroStyleManager1.Theme;
                            form.Show();
                            tabPage.Controls.Add(form);
                            form.FormClosed += form_FormClosed;
                        }
                    }
                });
            lc.Parent = this;
            lc.Dock = DockStyle.Fill;
            this.Controls.Add(lc);
            this.Controls.SetChildIndex(lc, 0);
        }