Example #1
0
 public CreateTask(AufgabenControl aufgabe)
 {
     this.aufgabe   = aufgabe.Task;
     aufgabeControl = aufgabe;
     bearbeiten     = true;
     InitializeComponent();
     this.Text = "Aufgabe bearbeiten";
 }
Example #2
0
        private void AufgabenControl_OnOrderChange(object sender, OnOrderChangedEventArgs args)
        {
            int toChange = args.Location.Y / Form1.ACHEIGHT;

            if (toChange != args.ID && toChange >= 0 && toChange < acTasks.Count)
            {
                AufgabenControl temp = acTasks[args.ID];
                acTasks[args.ID]  = acTasks[toChange];
                acTasks[toChange] = temp;

                if (args.ID == 0)
                {
                    Point newPoint = new Point(acTasks[args.ID].Location.X, 19);
                    acTasks[args.ID].Location = newPoint;
                    newPoint = new Point(acTasks[toChange].Location.X, ((Form1.ACHEIGHT) * toChange) + Form1.ACDIFF);
                    acTasks[toChange].Location = newPoint;
                }
                else
                {
                    if (toChange == 0)
                    {
                        Point newPoint = new Point(acTasks[args.ID].Location.X, (Form1.ACHEIGHT * args.ID) + Form1.ACDIFF);
                        acTasks[args.ID].Location = newPoint;
                        newPoint = new Point(acTasks[toChange].Location.X, 19);
                        acTasks[toChange].Location = newPoint;
                    }
                    else
                    {
                        Point newPoint = new Point(acTasks[args.ID].Location.X, (Form1.ACHEIGHT * args.ID) + Form1.ACDIFF);
                        acTasks[args.ID].Location = newPoint;
                        newPoint = new Point(acTasks[toChange].Location.X, (Form1.ACHEIGHT * toChange) + Form1.ACDIFF);
                        acTasks[toChange].Location = newPoint;
                    }
                }
            }
            for (int i = 0; i < acTasks.Count; i++)
            {
                acTasks[i].Update();
            }
        }
Example #3
0
        private void LoadAufgaben()
        {
            manager = new AufgabenManager();
            acTasks = new Dictionary <int, AufgabenControl>();
            gb_Tasks.Controls.Clear();
            int i = 0;

            foreach (Aufgabe aufgabe in manager.Aufgaben)
            {
                if (i < (gb_Tasks.Height / Form1.ACHEIGHT))
                {
                    AufgabenControl ac;
                    if (i > 0)
                    {
                        ac = new AufgabenControl(aufgabe.Name, 6, ((Form1.ACHEIGHT) * i) + Form1.ACDIFF, 450, Form1.ACHEIGHT, gb_Tasks);
                        ac.SetAufgabe(aufgabe);
                        ac.ID = i;
                        acTasks.Add(i, ac);
                    }
                    else
                    {
                        ac = new AufgabenControl(aufgabe.Name, 6, 19, 450, Form1.ACHEIGHT, gb_Tasks);
                        ac.SetAufgabe(aufgabe);
                        ac.ID = i;

                        acTasks.Add(i, ac);
                    }
                }
                i++;
            }
            for (int x = 0; x < acTasks.Count; x++)
            {
                acTasks[x].OnChange      += AcTask_OnChange;
                acTasks[x].OnOrderChange += AufgabenControl_OnOrderChange;
            }
        }