private void EstimatorTagForm_Load(object sender, EventArgs e)
        {
            if (this.m_type == EstimatorTag.tag_type.item_tag)
            {
                this.m_list.MultiSelect = false;
            }

            this.Text     = m_str_title;
            m_prompt.Text = m_str_prompt;

            EstimatorPlugIn plugin = RMA.Rhino.RhUtil.GetPlugInInstance() as EstimatorPlugIn;

            for (int i = 0; i < plugin.m_tag_table.TagCount(); i++)
            {
                EstimatorTag tag = plugin.m_tag_table[i];
                if (tag.Type() == m_type)
                {
                    ListViewItem item = new ListViewItem(tag.Id());
                    item.SubItems.Add(tag.Description());
                    item.Tag = i;
                    m_list.Items.Add(item);
                }
            }

            m_list.Columns.Add("Tag");
            m_list.Columns.Add("Description");

            foreach (ColumnHeader ch in m_list.Columns)
            {
                ch.Width = -2;
            }
        }
 public EstimatorTag this[int index]
 {
     get
       {
     EstimatorTag tag = new EstimatorTag();
     if (-1 < index && index < m_a.Count)
       tag = m_a[index];
     return tag;
       }
 }
Exemple #3
0
        public EstimatorTag Tag(int index)
        {
            EstimatorTag tag = new EstimatorTag();

            if (-1 < index && index < m_a.Count)
            {
                tag = m_a[index];
            }
            return(tag);
        }
 public int AddTag(EstimatorTag tag)
 {
     if (tag.IsValid())
       {
     int index = FindTag(tag.Id());
     if (index < 0)
     {
       m_a.Add(tag);
       return m_a.Count - 1;
     }
       }
       return -1;
 }
Exemple #5
0
 public int AddTag(EstimatorTag tag)
 {
     if (tag.IsValid())
     {
         int index = FindTag(tag.Id());
         if (index < 0)
         {
             m_a.Add(tag);
             return(m_a.Count - 1);
         }
     }
     return(-1);
 }
Exemple #6
0
        private bool ParseDelimitedFile(StreamReader reader)
        {
            bool rc = false;

            if (null == reader)
            {
                return(rc);
            }

            try
            {
                do
                {
                    string line = reader.ReadLine();
                    if (line.Length > 0)    // Skip empty lines
                    {
                        if (line[0] != ';') // Skip comment lines
                        {
                            string[] items = line.Split(';');
                            if (items.Length == 3)
                            {
                                EstimatorTag tag = new EstimatorTag(items);
                                if (tag.IsValid())
                                {
                                    m_tag_table.AddTag(tag);
                                }
                            }
                        }
                    }
                }while (reader.Peek() != -1);

                rc = true;
            }

            catch
            {
            }

            return(rc);
        }
        public int GetTags(EstimatorTag.tag_type type, ref List<EstimatorTag> tags )
        {
            int tags_counts = tags.Count;
              if (type != EstimatorTag.tag_type.unknown_tag)
              {
            for (int i = 0; i < m_a.Count; i++)
            {
              if (m_a[i].Type() == type)
            tags.Add(m_a[i]);
            }
              }

              return tags.Count - tags_counts;
        }
        private bool ParseDelimitedFile(StreamReader reader)
        {
            bool rc = false;

              if (null == reader)
            return rc;

              try
              {
            do
            {
              string line = reader.ReadLine();
              if (line.Length > 0) // Skip empty lines
              {
            if (line[0] != ';') // Skip comment lines
            {
              string[] items = line.Split(';');
              if (items.Length == 3)
              {
                EstimatorTag tag = new EstimatorTag(items);
                if (tag.IsValid())
                  m_tag_table.AddTag(tag);
              }
            }
              }
            }
            while (reader.Peek() != -1);

            rc = true;
              }

              catch
              {
              }

              return rc;
        }