Beispiel #1
0
        protected override void SetEnabledStateOfControls()
        {
            base.SetEnabledStateOfControls();
            DeleteTool deleteTool = (DeleteTool)this.Controller.Tools.Where(t => t.Name == ControllerBase.DeleteToolName).FirstOrDefault();

            HeuristicLab.Netron.Controller controller = this.Controller as HeuristicLab.Netron.Controller;
            if (Content == null && deleteTool != null && controller != null)
            {
                controller.RemoveTool(deleteTool);
            }
            else
            {
                if ((ReadOnly || Locked) && deleteTool != null && controller != null)
                {
                    controller.RemoveTool(deleteTool);
                }
                else if ((!ReadOnly && !Locked) && deleteTool == null)
                {
                    this.Controller.AddTool(new DeleteTool(ControllerBase.DeleteToolName));
                }
            }
        }
Beispiel #2
0
        public GraphVisualizationInfoView()
        {
            InitializeComponent();
            this.shapeInfoShapeMapping           = new BidirectionalDictionary <IShapeInfo, IShape>();
            this.connectionInfoConnectionMapping = new BidirectionalDictionary <IConnectionInfo, IConnection>();
            this.connectionPenStyle        = new LinePenStyle();
            this.connectionPenStyle.EndCap = LineCap.ArrowAnchor;

            PasteTool pasteTool = (PasteTool)this.Controller.Tools.Where(t => t.Name == ControllerBase.PasteToolName).FirstOrDefault();
            CopyTool  copyTool  = (CopyTool)this.Controller.Tools.Where(t => t.Name == ControllerBase.CopyToolName).FirstOrDefault();

            HeuristicLab.Netron.Controller controller = this.Controller as HeuristicLab.Netron.Controller;
            if (controller != null)
            {
                if (pasteTool != null)
                {
                    controller.RemoveTool(pasteTool);
                }
                if (copyTool != null)
                {
                    controller.RemoveTool(copyTool);
                }
            }
        }