/// <summary> /// Implements <see cref="CADability.UserInterface.ICommandHandler.OnCommand (string)"/> /// </summary> /// <param name="MenuId"></param> /// <returns></returns> virtual public bool OnCommand(string MenuId) { switch (MenuId) { case "MenuId.VisibleLayer.SelectAll": checkedLayers.Clear(); checkedLayers.AddRange(layerList.ToArray()); subEntries = null; if (propertyPage != null) { propertyPage.Refresh(this); propertyPage.OpenSubEntries(this, true); } return(true); case "MenuId.VisibleLayer.SelectNone": checkedLayers.Clear(); subEntries = null; if (propertyPage != null) { propertyPage.Refresh(this); propertyPage.OpenSubEntries(this, true); } return(true); } return(false); }
/// <summary> /// Creates a new <see cref="CheckedLayerlist"/> with the provided layer list and a set of /// initially checked layers /// </summary> /// <param name="layerList">List of all layers to display</param> /// <param name="checkedLayers">Subset of the layerlist that is to be checked initially</param> /// <param name="resourceId">Resource id for the title of the Controlcenter entry</param> public CheckedLayerList(LayerList layerList, Layer[] checkedLayers, string resourceId) { this.layerList = layerList; if (checkedLayers == null) { this.checkedLayers = new List <Layer>(layerList.ToArray()); } else { this.checkedLayers = new List <Layer>(checkedLayers); } this.resourceId = resourceId; layerList.LayerAddedEvent += new LayerList.LayerAddedDelegate(OnLayerAdded); layerList.LayerRemovedEvent += new LayerList.LayerRemovedDelegate(OnLayerRemoved); layerList.DidModifyEvent += new DidModifyDelegate(OnLayerModified); }