예제 #1
0
        protected void InformServicesOfNewCanvas(BaseController controller)
        {
            // Wire up menu for this canvas controller.
            IFlowSharpMenuService menuService = ServiceManager.Get <IFlowSharpMenuService>();

            menuService.Initialize(controller);

            // Wire up mouse for this canvas controller.
            IFlowSharpMouseControllerService mouseService = ServiceManager.Get <IFlowSharpMouseControllerService>();

            mouseService.Initialize(controller);

            // Debug window needs to know too.
            ServiceManager.Get <IFlowSharpDebugWindowService>().Initialize(controller);

            // PropertyGrid service needs to hook controller events.
            ServiceManager.Get <IFlowSharpPropertyGridService>().Initialize(controller);

            // Update document tab when canvas name changes.
            controller.CanvasNameChanged += (sndr, args) =>
            {
                IDockDocument doc = ((IDockDocument)((BaseController)sndr).Canvas.Parent.Parent);
                doc.TabText = controller.CanvasName;

                // Update the metadata for the controller document so the layout contains this info on save.
                doc.Metadata = Constants.META_CANVAS + "," + controller.Filename + "," + doc.TabText;
            };

            // Update the metadata for the controller document so the layout contains this info on save.
            controller.FilenameChanged += (sndr, args) =>
            {
                IDockDocument doc = ((IDockDocument)((BaseController)sndr).Canvas.Parent.Parent);
                doc.Metadata = Constants.META_CANVAS + "," + controller.Filename + "," + doc.TabText;
            };

            // Inform debug window, so it can select the shape in the shape list when a shape is selected on the canvas.
            controller.ElementSelected += (sndr, args) =>
            {
                ServiceManager.Get <IFlowSharpDebugWindowService>().FindShape(args.Element);
            };

            ServiceManager.Get <IFlowSharpEditService>().NewCanvas(controller);

            // Update any other services needing to know about the new canvas.  These are additional services that are not
            // part of the core FlowSharp application (for example, the FlowSharpCode services.)
            NewCanvas.Fire(this, new NewCanvasEventArgs()
            {
                Controller = controller
            });
        }
예제 #2
0
        protected void InformServicesOfNewCanvas(BaseController controller)
        {
            // Wire up menu for this canvas controller.
            IFlowSharpMenuService menuService = ServiceManager.Get <IFlowSharpMenuService>();

            menuService.Initialize(controller);

            // Wire up mouse for this canvas controller.
            IFlowSharpMouseControllerService mouseService = ServiceManager.Get <IFlowSharpMouseControllerService>();

            mouseService.Initialize(controller);

            // Debug window needs to know too.
            ServiceManager.Get <IFlowSharpDebugWindowService>().Initialize(controller);

            // PropertyGrid service needs to hook controller events.
            ServiceManager.Get <IFlowSharpPropertyGridService>().Initialize(controller);

            // Update document tab when canvas name changes.
            controller.CanvasNameChanged += (sndr, args) =>
            {
                IDockDocument doc = ((IDockDocument)((BaseController)sndr).Canvas.Parent.Parent);
                doc.TabText = controller.CanvasName;

                // Update the metadata for the controller document so the layout contains this info on save.
                doc.Metadata = Constants.META_CANVAS + "," + controller.Filename + "," + doc.TabText;
            };

            // Update the metadata for the controller document so the layout contains this info on save.
            controller.FilenameChanged += (sndr, args) =>
            {
                IDockDocument doc = ((IDockDocument)((BaseController)sndr).Canvas.Parent.Parent);
                doc.Metadata = Constants.META_CANVAS + "," + controller.Filename + "," + doc.TabText;
            };

            // Update any other services needing to know about the new canvas.
            NewCanvas.Fire(this, new NewCanvasEventArgs()
            {
                Controller = controller
            });
        }