/// <summary> /// Does a command</summary> /// <param name="commandTag">Command</param> void ICommandClient.DoCommand(object commandTag) { if (CommandTag.AddLayerFolder.Equals(commandTag)) { LayerFolder newLayer = new DomNode(LayerFolderType).As <LayerFolder>(); newLayer.Name = "New Layer".Localize(); IList <LayerFolder> layerList = null; object target = m_targetRef.Target; if (target != null) { LayerFolder parentLayer = target.As <LayerFolder>(); if (parentLayer != null) { layerList = parentLayer.Folders; } else { LayeringContext layeringContext = target.As <LayeringContext>(); if (layeringContext != null) { layerList = layeringContext.Layers; } } } if (layerList != null) { ILayeringContext layeringContext = m_contextRegistry.GetMostRecentContext <ILayeringContext>(); ITransactionContext transactionContext = layeringContext.As <ITransactionContext>(); transactionContext.DoTransaction(() => layerList.Add(newLayer), "Add Layer".Localize()); } } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { LayeringContext = m_contextRegistry.GetMostRecentContext <ILayeringContext>(); if (LayeringContext != null) { TreeControl.Text = "Copy items from the document and paste them here to create layers whose visibility can be controlled by clicking on a check box.".Localize(); } else { TreeControl.Text = null; } }
private void contextRegistry_ActiveContextChanged(object sender, EventArgs e) { LayeringContext = m_contextRegistry.GetMostRecentContext<ILayeringContext>(); if (LayeringContext != null) { TreeControl.Text = "Copy items from the document and paste them here to create layers whose visibility can be controlled by clicking on a check box.".Localize(); } else { TreeControl.Text = null; } }