private void AddLine()
        {
            DPercentLine newLine = new DPercentLine();

            newLine.sendingForm = this;
            if (lines.Count <= 0)
            {
                newLine.SetMin();
            }
            else
            {
                int newMin = lines.Last().GetMax() + 1;
                if (newMin > 0)
                {
                    newLine.SetMinToValue(newMin);
                }
            }
            if (lines.Count == 0)
            {
                newLine.SetMaxToValue(100);
            }
            lines.Add(newLine);
            RedrawLines();
            newLineButton.Select();
        }
 public void EditMode(DPercentTable editTable, int index)
 {
     editMode = true;
     for (int i = 0; i < editTable.startValues.Count; i++)
     {
         DPercentLine newLine = new DPercentLine();
         newLine.sendingForm = this;
         if (i == 0)
         {
             newLine.SetMin();
         }
         else
         {
             newLine.SetMinToValue(editTable.startValues.ElementAt(i));
         }
         if (i < editTable.results.Count)
         {
             newLine.addEffect(editTable.results.ElementAt(i));
         }
         newLine.SetMinToValue(editTable.startValues.ElementAt(i));
         if (i < editTable.startValues.Count - 1)
         {
             newLine.SetMaxToValue(editTable.startValues.ElementAt(i + 1) - 1);
         }
         else
         {
             newLine.SetMaxToValue(editTable.MaxVal);
         }
         tableIndex = index;
         lines.Add(newLine);
         RedrawLines();
     }
 }
 public void InsertLineAndSort(DPercentLine newLine)
 {
     lines.Add(newLine);
     lines = lines.OrderBy(p => p.GetMin()).ToList();
     for (int i = 0; i < lines.Count; i++)
     {
         lines.ElementAt(i).LineID      = i;
         lines.ElementAt(i).sendingForm = this;
     }
     RedrawLines();
 }
 public void AddBlanksAndSave(List <int[]> gaps)
 {
     foreach (int[] i in gaps)
     {
         DPercentLine newLine = new DPercentLine();
         newLine.SetMinToValue(i[0]);
         newLine.SetMaxToValue(i[1]);
         newLine.addEffect("No effect");
         InsertLineAndSort(newLine);
     }
     RedrawLines();
     BuildTable();
 }
예제 #5
0
        private void addBlankButton_Click(object sender, EventArgs e)
        {
            foreach (int[] i in Gaps)
            {
                DPercentLine newLine = new DPercentLine();
                if (i[0] == 1)
                {
                    newLine.SetMin();
                }
                else
                {
                    newLine.SetMinToValue(i[0]);
                }

                newLine.SetMaxToValue(i[1]);
                newLine.addEffect("No Effect");
                sendingForm.InsertLineAndSort(newLine);
            }
            this.Close();
        }