Пример #1
0
 public static ProjectSpecie Parse(Match m, DataTable t, List<string> ErrorList)
 {
   ProjectSpecie ret = new ProjectSpecie(t, m.Groups["Symbol"].Value, ErrorList);
   try
   {
     if (m.Groups["ToleranceBelow"].Success)
       ret.ExtraBelowT = double.Parse(m.Groups["ToleranceBelow"].Value);
     if (m.Groups["ToleranceAbove"].Success)
       ret.ExtraAboveT = double.Parse(m.Groups["ToleranceAbove"].Value);
     if (m.Groups["Ideal"].Success)
       ret.Ideal = m.Groups["Ideal"].Value != "0";
   }
   catch
   {
   }
   return ret;
 }
Пример #2
0
    protected bool AddSpecies(DataRow[] values, int insertionIndex)
    {
      bool ret = false;
      lstProjectVector.BeginUpdate();
      List<ListViewItem> lvisToSelect = new List<ListViewItem>();
      foreach (DataRow r in values)
      {
        ListViewItem alreadyItem = AlreadyContained(r);
        if (alreadyItem == null)
        {
          ProjectSpecie specie = new ProjectSpecie(r);
          specie.Changed += new EventHandler(item_Changed);
          specie.TempFormatter = m_TempFormatter;
          specie.TempParser = m_TempParser;

          lvisToSelect.Add(specie.LVI);

          if (insertionIndex < 0)
            lstProjectVector.Items.Add(specie.LVI);
          else
            lstProjectVector.Items.Insert(insertionIndex++, specie.LVI);
          ret = true;
        }
        else
          lvisToSelect.Add(alreadyItem);
      }

      if (ret == true)
      {
        lstProjectVector.SelectedItems.Clear();
        foreach (ListViewItem lvi in lvisToSelect)
          lvi.Selected = true;
        CheckCalculations();
      }
      lstProjectVector.EndUpdate();
      if (ret && lstProjectVector.SelectedItems.Count > 0)
        lstProjectVector.SelectedItems[0].EnsureVisible();

      if (ret && this.UsedSpeciesChanged != null)
        UsedSpeciesChanged(this, new EventArgs());
      return ret;
    }