예제 #1
0
        /// <ToBeCompleted></ToBeCompleted>
        public void RenameLayer(Diagram diagram, Layer layer, string oldName, string newName)
        {
            if (diagram == null)
            {
                throw new ArgumentNullException("diagram");
            }
            if (layer == null)
            {
                throw new ArgumentNullException("layer");
            }
            if (oldName == null)
            {
                throw new ArgumentNullException("oldName");
            }
            if (newName == null)
            {
                throw new ArgumentNullException("newName");
            }
            AssertDiagramSetControllerIsSet();
            ICommand cmd = new EditLayerCommand(diagram, layer, EditLayerCommand.ChangedProperty.Name, oldName, newName);

            Project.ExecuteCommand(cmd);
            if (LayerModified != null)
            {
                LayerModified(this, LayerHelper.GetLayersEventArgs(LayerHelper.GetLayers(layer.Id, diagram)));
            }
        }
예제 #2
0
        /// <ToBeCompleted></ToBeCompleted>
        public void SetLayerZoomBounds(Diagram diagram, Layer layer, int lowerZoomBounds, int upperZoomBounds)
        {
            if (diagram == null)
            {
                throw new ArgumentNullException("diagram");
            }
            if (layer == null)
            {
                throw new ArgumentNullException("layer");
            }
            AssertDiagramSetControllerIsSet();
            ICommand cmdMinZoom = null;
            ICommand cmdMaxZoom = null;

            if (layer.LowerZoomThreshold != lowerZoomBounds)
            {
                cmdMinZoom = new EditLayerCommand(diagram, layer,
                                                  EditLayerCommand.ChangedProperty.LowerZoomThreshold,
                                                  layer.LowerZoomThreshold, lowerZoomBounds);
            }
            if (layer.UpperZoomThreshold != upperZoomBounds)
            {
                cmdMaxZoom = new EditLayerCommand(diagram, layer,
                                                  EditLayerCommand.ChangedProperty.UpperZoomThreshold,
                                                  layer.UpperZoomThreshold, upperZoomBounds);
            }

            ICommand cmd;

            if (cmdMinZoom != null && cmdMaxZoom != null)
            {
                cmd = new AggregatedCommand();
                ((AggregatedCommand)cmd).Add(cmdMinZoom);
                ((AggregatedCommand)cmd).Add(cmdMaxZoom);
            }
            else if (cmdMinZoom != null && cmdMaxZoom == null)
            {
                cmd = cmdMinZoom;
            }
            else if (cmdMaxZoom != null && cmdMinZoom == null)
            {
                cmd = cmdMaxZoom;
            }
            else
            {
                cmd = null;
            }

            if (cmd != null)
            {
                Project.ExecuteCommand(cmd);
                if (LayerModified != null)
                {
                    LayerModified(this, LayerHelper.GetLayersEventArgs(LayerHelper.GetLayers(layer.Id, diagram)));
                }
            }
        }
예제 #3
0
		/// <ToBeCompleted></ToBeCompleted>
		public void SetLayerZoomBounds(Diagram diagram, Layer layer, int lowerZoomBounds, int upperZoomBounds)
		{
			if (diagram == null) throw new ArgumentNullException("diagram");
			if (layer == null) throw new ArgumentNullException("layer");
			AssertDiagramSetControllerIsSet();
			ICommand cmdMinZoom = null;
			ICommand cmdMaxZoom = null;
			if (layer.LowerZoomThreshold != lowerZoomBounds)
				cmdMinZoom = new EditLayerCommand(diagram, layer,
				                                  EditLayerCommand.ChangedProperty.LowerZoomThreshold,
				                                  layer.LowerZoomThreshold, lowerZoomBounds);
			if (layer.UpperZoomThreshold != upperZoomBounds)
				cmdMaxZoom = new EditLayerCommand(diagram, layer,
				                                  EditLayerCommand.ChangedProperty.UpperZoomThreshold,
				                                  layer.UpperZoomThreshold, upperZoomBounds);

			ICommand cmd;
			if (cmdMinZoom != null && cmdMaxZoom != null) {
				cmd = new AggregatedCommand();
				((AggregatedCommand) cmd).Add(cmdMinZoom);
				((AggregatedCommand) cmd).Add(cmdMaxZoom);
			}
			else if (cmdMinZoom != null && cmdMaxZoom == null)
				cmd = cmdMinZoom;
			else if (cmdMaxZoom != null && cmdMinZoom == null)
				cmd = cmdMaxZoom;
			else cmd = null;

			if (cmd != null) {
				Project.ExecuteCommand(cmd);
				if (LayerModified != null)
					LayerModified(this, LayerHelper.GetLayersEventArgs(LayerHelper.GetLayers(layer.Id, diagram)));
			}
		}
예제 #4
0
		/// <ToBeCompleted></ToBeCompleted>
		public void RenameLayer(Diagram diagram, Layer layer, string oldName, string newName)
		{
			if (diagram == null) throw new ArgumentNullException("diagram");
			if (layer == null) throw new ArgumentNullException("layer");
			if (oldName == null) throw new ArgumentNullException("oldName");
			if (newName == null) throw new ArgumentNullException("newName");
			AssertDiagramSetControllerIsSet();
			ICommand cmd = new EditLayerCommand(diagram, layer, EditLayerCommand.ChangedProperty.Name, oldName, newName);
			Project.ExecuteCommand(cmd);
			if (LayerModified != null)
				LayerModified(this, LayerHelper.GetLayersEventArgs(LayerHelper.GetLayers(layer.Id, diagram)));
		}