Exemplo n.º 1
0
 void lc1_RenewMe(LiedjeControl sender)
 {
     for (int i = 0; i < panel1.Controls.Count; i++)
     {
         if (panel1.Controls[i] == sender)
         {
             //TODO: Replace control
         }
     }
 }
Exemplo n.º 2
0
 void lc1_RodeDraadChanged(LiedjeControl sender)
 {
     for (int i = 0; i < panel1.Controls.Count; i++)
     {
         LiedjeControl lc = (LiedjeControl)panel1.Controls[i];
         if (lc.RodeDraad == 1 && sender != lc)
         {
             lc.Liedje = sender.Liedje;
             lc.UpdateFragmentProperties();
         }
     }
 }
Exemplo n.º 3
0
 void lc1_RequestRodeDraad(LiedjeControl sender)
 {
     for (int i = 0; i < currentPBB.Blokken.Count; i++)
     {
         for (int j = 0; j < currentPBB.Blokken[i].Fragmenten.Count; j++)
         {
             if (currentPBB.Blokken[i].Fragmenten[j].RodeDraad == 1)
             {
                 sender.Liedje = currentPBB.Blokken[i].Fragmenten[j];
                 break;
             }
         }
     }
 }
Exemplo n.º 4
0
        private void UpdateView(int indexToUpdate = -1)
        {
            LockWindowUpdate(this.Handle);

            if (indexToUpdate == -1)
            {
                panel1.Controls.Clear();
                int countnum = 1;
                for (int i = 0; i < currentPBB.Blokken.Count; i++)
                {
                    for (int j = 0; j < currentPBB.Blokken[i].AantalInBlok; j++)
                    {
                        LiedjeControl lc1 = new LiedjeControl(currentPBB.Blokken[i].Fragmenten[j], currentPBB);
                        if (j == 0)
                        {
                            lc1.Blok = currentPBB.Blokken[i].Beschrijving;
                        }
                        lc1.Parent = panel1;
                        lc1.ID     = countnum;
                        lc1.Dock   = DockStyle.Top;
                        lc1.BringToFront();
                        lc1.RequestRodeDraad += lc1_RequestRodeDraad;
                        lc1.RodeDraadChanged += lc1_RodeDraadChanged;
                        lc1.RenewMe          += lc1_RenewMe;
                        countnum++;
                    }
                }
            }
            else
            {
                //Vind het blok waarin het nummer zit
                int index_to_use = indexToUpdate;
                int index_blok   = 0;
                for (int i = 0; i < currentPBB.Blokken.Count; i++)
                {
                    if (currentPBB.Blokken[i].AantalInBlok <= index_to_use)
                    {
                        index_to_use -= currentPBB.Blokken[i].AantalInBlok;
                        index_blok++;
                    }
                    else
                    {
                        break;
                    }
                }

                LiedjeControl lc1 = new LiedjeControl(currentPBB.Blokken[index_blok].Fragmenten[index_to_use], currentPBB);
                if (index_to_use == 0)
                {
                    lc1.Blok = currentPBB.Blokken[index_blok].Beschrijving;
                }
                lc1.Parent = panel1;
                lc1.ID     = indexToUpdate + 1;
                lc1.Dock   = DockStyle.Top;
                lc1.BringToFront();

                panel1.Controls.SetChildIndex(lc1, panel1.Controls.Count - 1 - indexToUpdate);
                panel1.Controls.RemoveAt(panel1.Controls.Count - 2 - indexToUpdate);
            }

            LockWindowUpdate(IntPtr.Zero);
        }