Exemple #1
0
        private void AddLabel(Task task)
        {
            Form    label;
            Control panel;

            switch (task)
            {
            case Habit h:
                label = new HabitTaskLabel(h, character, onUpdate, saveFile);
                panel = habitPanel;
                break;

            case Daily d:
                label = new DailyTaskLabel(d, character, onUpdate, saveFile);
                panel = dailyPanel;
                break;

            case ToDo t:
                label = new ToDoTaskLabel(t, character, onUpdate, saveFile);
                panel = todoPanel;
                break;

            default:
                return;
            }
            label.TopLevel        = false;
            label.FormBorderStyle = FormBorderStyle.None;
            label.Dock            = DockStyle.Top;
            label.Show();
            panel.Controls.Add(label);
        }
        private void AddLabel(Task task)
        {
            switch (task)
            {
            case Habit h:
            {
                HabitTaskLabel childForm = new HabitTaskLabel(h, character, navigationMenu, saveFile);
                childForm.TopLevel = false;
                panel1.Controls.Add(childForm);
                childForm.FormBorderStyle = FormBorderStyle.None;
                childForm.Dock            = DockStyle.Top;
                childForm.Show();
                break;
            }

            case Daily d:
            {
                DailyTaskLabel childForm = new DailyTaskLabel(d, character, navigationMenu, saveFile);
                childForm.TopLevel = false;
                panel2.Controls.Add(childForm);
                childForm.FormBorderStyle = FormBorderStyle.None;
                childForm.Dock            = DockStyle.Top;
                childForm.Show();
                break;
            }

            case ToDo t:
            {
                ToDoTaskLabel childForm = new ToDoTaskLabel(t, character, navigationMenu, saveFile);
                childForm.TopLevel = false;
                panel3.Controls.Add(childForm);
                childForm.FormBorderStyle = FormBorderStyle.None;
                childForm.Dock            = DockStyle.Top;
                childForm.Show();
                break;
            }
            }
        }