Ejemplo n.º 1
0
        private void InitializeLabels()
        {
            foreach (var name in trueNames)
            {
                AddNameToPnlNames(name);
            }

            foreach (var pupil in pupils)
            {
                PupilLabel label = new PupilLabel();
                label.Font     = new System.Drawing.Font("Montserrat", 10F);
                label.AutoSize = true;
                label.pupil    = pupil;

                if (pupil.TrueName == null)
                {
                    AddToPupilLabel(label);
                }
                else
                {
                    var lblTrueNme = namesLabels.FirstOrDefault(x => x.Text == pupil.TrueName);
                    if (lblTrueNme != null)
                    {
                        MarkNameAsUsed(lblTrueNme);
                    }

                    AddToReadyLabel(label);
                }
            }



            FoundRightNames();
            ArrangeLabel();
        }
Ejemplo n.º 2
0
 private void AddTrueName(PupilLabel pupilLabel, Label lblName)
 {
     if (pupilLabel != null)
     {
         pupilLabel.pupil.TrueName = lblName.Text;
         pupilsLabels.Remove(pupilLabel);
         MarkNameAsUsed(lblName);
         AddToReadyLabel(pupilLabel);
         ArrangeLabel();
     }
 }
Ejemplo n.º 3
0
 private void FoundRightNames()
 {
     for (int i = pupilsLabels.Count - 1; i >= 0; i--)
     {
         for (int j = namesLabels.Count - 1; j >= 0; j--)
         {
             PupilLabel pupilLabel = (PupilLabel)pupilsLabels[i];
             if (IsTheSameName(pupilLabel.pupil, namesLabels[j].Text))
             {
                 AddTrueName(pupilLabel, namesLabels[j]);
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void Label_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                PupilLabel label = (PupilLabel)sender;

                AddNameToPnlNames(label.pupil.TrueName);
                readyLabels.Remove(label);
                label.pupil.TrueName = null;
                AddToPupilLabel(label);
                ArrangeLabel();
            }
            catch (Exception)
            {
                throw new Exception("Instead PupilLabel has been got something else");
            }
        }
Ejemplo n.º 5
0
 private void AddToReadyLabel(PupilLabel label)
 {
     readyLabels.Add(label);
     label.Text         = String.Format($"{label.pupil.FirstName} {label.pupil.LastName}: {label.pupil.TrueName}");
     label.DoubleClick += Label_DoubleClick;
 }
Ejemplo n.º 6
0
 private void AddToPupilLabel(PupilLabel label)
 {
     pupilsLabels.Add(label);
     label.Text = String.Format($"{label.pupil.FirstName} {label.pupil.LastName} {label.pupil.Email}");
 }