Esempio n. 1
0
        /// <summary>
        /// Register a new source.
        /// </summary>
        public bool Register(SourceInfo source)
        {
            lock (this)
            {
                // See if this source already added.
                // NOTE: using IComparable on the structure does not work inside the list.
                foreach (SourceInfo info in _sources)
                {
                    if (info.ComponentId == source.ComponentId &&
                        info.SourceType == source.SourceType)
                    {
                        return(false);
                    }
                }

                _sources.Add(source);
            }

            return(true);
        }
        /// <summary>
        /// Register a new source.
        /// </summary>
        public bool Register(SourceInfo source)
        {
            lock (this)
            {
                // See if this source already added.
                // NOTE: using IComparable on the structure does not work inside the list.
                foreach (SourceInfo info in _sources)
                {
                    if (info.ComponentId == source.ComponentId
                        && info.SourceType == source.SourceType)
                    {
                        return false;
                    }
                }

                _sources.Add(source);
            }

            return true;
        }
Esempio n. 3
0
 public bool RegisterSource(SourceInfo source)
 {
     return(this.Sources.Register(source));
 }
        void SetItemsAsSource(ListViewItem item, SourceInfo source)
        {
            item.SubItems.Clear();
            item.Text = source.ComponentId.Name;

            if (source.ComponentId.IdentifiedComponentType != null)
            {
                item.SubItems.Add(source.ComponentId.IdentifiedComponentType.Name);
            }
            else
            {
                item.SubItems.Add("NA");
            }

            item.SubItems.Add(GeneralHelper.GetCombinedEnumName(typeof(SourceTypeEnum), (int)source.SourceType));
            item.SubItems.Add(source.ComponentId.Print());
        }