예제 #1
0
 private void lstSymbols_SelectedIndexChanged(object sender, EventArgs e)
 {
     btnDelete.Enabled = (lstSymbols.SelectedItems.Count == 1);
     if (btnDelete.Enabled)
     {
         var symRef = lstSymbols.SelectedItems[0].Tag as ISimpleSymbolReferenceBase;
         if (symRef != null)
         {
             splitContainer1.Panel2.Controls.Clear();
             if (symRef.Type == SimpleSymbolReferenceType.Inline)
             {
                 var ctrl = new SimpleSymbolDefinitionEditorCtrl();
                 ctrl.Dock = DockStyle.Fill;
                 splitContainer1.Panel2.Controls.Add(ctrl);
                 var inline = (ISimpleSymbolInlineReference)symRef;
                 ctrl.Bind(new SymbolEditorService(_edSvc, inline.SimpleSymbolDefinition));
             }
             else if (symRef.Type == SimpleSymbolReferenceType.Library)
             {
                 var ctrl = new SimpleSymbolReferenceCtrl(_edSvc, (ISimpleSymbolLibraryReference)symRef);
                 ctrl.Dock = DockStyle.Fill;
                 splitContainer1.Panel2.Controls.Add(ctrl);
             }
         }
     }
 }
예제 #2
0
 protected override void Bind(Maestro.Editors.IEditorService service)
 {
     panelBody.Controls.Clear();
     var ssym = service.GetEditedResource() as ISimpleSymbolDefinition;
     var csym = service.GetEditedResource() as ICompoundSymbolDefinition;
     if (ssym != null)
     {
         var ssymCtrl = new SimpleSymbolDefinitionEditorCtrl();
         ssymCtrl.Dock = DockStyle.Fill;
         panelBody.Controls.Add(ssymCtrl);
         ssymCtrl.Bind(service);
     }
     else if (csym != null)
     {
         var csymCtrl = new CompoundSymbolDefinitionEditorCtrl();
         csymCtrl.Dock = DockStyle.Fill;
         panelBody.Controls.Add(csymCtrl);
         csymCtrl.Bind(service);
     }
 }
예제 #3
0
 private Control CreateEditor(ISymbolInstance symRef, IResourceService resSvc)
 {
     Check.NotNull(symRef, "symRef"); //NOXLATE
     if (symRef.Reference.Type == SymbolInstanceType.Reference)
     {
         return new ReferenceCtrl((ISymbolInstanceReferenceLibrary)symRef.Reference, resSvc);
     }
     else
     {
         var inline = (ISymbolInstanceReferenceInline)symRef.Reference;
         var symEditor = new SymbolEditorService(_edSvc, inline.SymbolDefinition);
         if (inline.SymbolDefinition.Type == SymbolDefinitionType.Simple)
         {
             var sed = new SimpleSymbolDefinitionEditorCtrl();
             sed.Bind(symEditor);
             return sed;
         }
         else
         {
             var sed = new CompoundSymbolDefinitionEditorCtrl();
             sed.Bind(symEditor);
             return sed;
         }
     }
 }
 private void lstSymbols_SelectedIndexChanged(object sender, EventArgs e)
 {
     btnDelete.Enabled = (lstSymbols.SelectedItems.Count == 1);
     if (btnDelete.Enabled)
     {
         var symRef = lstSymbols.SelectedItems[0].Tag as ISimpleSymbolReferenceBase;
         if (symRef != null)
         {
             splitContainer1.Panel2.Controls.Clear();
             if (symRef.Type == SimpleSymbolReferenceType.Inline)
             {
                 var ctrl = new SimpleSymbolDefinitionEditorCtrl();
                 ctrl.Dock = DockStyle.Fill;
                 splitContainer1.Panel2.Controls.Add(ctrl);
                 var inline = (ISimpleSymbolInlineReference)symRef;
                 ctrl.Bind(new SymbolEditorService(_edSvc, inline.SimpleSymbolDefinition));
             }
             else if (symRef.Type == SimpleSymbolReferenceType.Library)
             {
                 var ctrl = new SimpleSymbolReferenceCtrl(_edSvc.ResourceService, (ISimpleSymbolLibraryReference)symRef);
                 ctrl.Dock = DockStyle.Fill;
                 splitContainer1.Panel2.Controls.Add(ctrl);
             }
         }
     }
 }