Пример #1
0
        private void AddSymbolReference(ISimpleSymbolReferenceBase symRef)
        {
            var li = new ListViewItem();

            if (symRef.Type == SimpleSymbolReferenceType.Library)
            {
                var sref = (ISimpleSymbolLibraryReference)symRef;
                li.Text       = sref.ResourceId;
                li.ImageIndex = 1;
                li.Tag        = symRef;
                lstSymbols.Items.Add(li);
            }
            else if (symRef.Type == SimpleSymbolReferenceType.Inline)
            {
                var inline = (ISimpleSymbolInlineReference)symRef;
                li.Text = inline.SimpleSymbolDefinition.Name;
                PropertyChangedEventHandler symChange = (s, e) =>
                {
                    if (e.PropertyName == "Name" && li != null)
                    {
                        li.Text = inline.SimpleSymbolDefinition.Name;
                    }
                };
                var simpleSym = inline.SimpleSymbolDefinition;
                simpleSym.PropertyChanged += WeakEventHandler.Wrap <PropertyChangedEventHandler>(symChange, (eh) => simpleSym.PropertyChanged -= eh);
                li.ImageIndex              = 0;
                li.Tag = symRef;
                lstSymbols.Items.Add(li);
            }
            else
            {
                throw new ArgumentException("Unknown symbol reference type");
            }
        }
        void ICompoundSymbolDefinition.RemoveSimpleSymbol(ISimpleSymbolReferenceBase sym)
        {
            var symb = sym as SimpleSymbol;

            if (symb != null)
            {
                this.SimpleSymbol.Remove(symb);
            }
        }
Пример #3
0
        private void RemoveSymbolReference(ISimpleSymbolReferenceBase symRef)
        {
            ListViewItem remove = null;

            foreach (ListViewItem li in lstSymbols.Items)
            {
                if (li.Tag == symRef)
                {
                    remove = li;
                    break;
                }
            }

            if (remove != null)
            {
                lstSymbols.Items.Remove(remove);
                _compSym.RemoveSimpleSymbol(symRef);
            }
        }
 private void AddSymbolReference(ISimpleSymbolReferenceBase symRef)
 {
     var li = new ListViewItem();
     if (symRef.Type == SimpleSymbolReferenceType.Library)
     {
         var sref = (ISimpleSymbolLibraryReference)symRef;
         li.Text = sref.ResourceId;
         li.ImageIndex = 1;
         li.Tag = symRef;
         lstSymbols.Items.Add(li);
     }
     else if (symRef.Type == SimpleSymbolReferenceType.Inline)
     {
         var inline = (ISimpleSymbolInlineReference)symRef;
         li.Text = inline.SimpleSymbolDefinition.Name;
         inline.SimpleSymbolDefinition.PropertyChanged += (s, e) =>
         {
             if (e.PropertyName == "Name" && li != null)
                 li.Text = inline.SimpleSymbolDefinition.Name;
         };
         li.ImageIndex = 0;
         li.Tag = symRef;
         lstSymbols.Items.Add(li);
     }
     else
     {
         throw new ArgumentException("Unknown symbol reference type");
     }
 }
        private void RemoveSymbolReference(ISimpleSymbolReferenceBase symRef)
        {
            ListViewItem remove = null;
            foreach (ListViewItem li in lstSymbols.Items)
            {
                if (li.Tag == symRef)
                {
                    remove = li;
                    break;
                }
            }

            if (remove != null)
            {
                lstSymbols.Items.Remove(remove);
                _compSym.RemoveSimpleSymbol(symRef);
            }
        }