Esempio n. 1
0
            // Methods
            public LogicalViewModelNode(
                LogicalViewModel viewModel,
                IProductElementViewModel root,
                ObservableCollection <IProductElementViewModel> children
                )
            {
                this.IsExpanded = true;
                this.ViewModel  = viewModel;
                WireInnerViewModel(root);

                if (children != null)
                {
                    Func <IProductElementViewModel, LogicalViewModelNode> LogicalViewCreator = n =>
                    {
                        return(new LogicalViewModelNode(viewModel, n, null));
                    };
                    this.LogicalViewNodes = new ObservableCollection <LogicalViewModelNode>(children.Select(n => LogicalViewCreator(n)));
                }
                else
                {
                    this.LogicalViewNodes = new ObservableCollection <LogicalViewModel.LogicalViewModelNode>();
                }

                if (!viewModel.IsMasterView)
                {
                    this.RemoveDeleteMenuItem();
                }
            }
        public ComponentNode GetOrCreateComponentLink(Guid endpointId, IProductElementViewModel serviceViewModel, IProductElementViewModel componentViewModel, IProductElementViewModel viewModel)
        {
            // Find undeployed component
            var undeployedComponentNode = FindComponent(EmptyEndpointNode.NodeId,
                                                        serviceViewModel.Data.Id,
                                                        componentViewModel.Data.Id);

            if (undeployedComponentNode != null)
            {
                this.DeleteNode(undeployedComponentNode);
            }

            // Create New Component Link
            var componentNode = FindComponent(endpointId,
                                              serviceViewModel.Data.Id,
                                              componentViewModel.Data.Id);

            if (componentNode == null)
            {
                var serviceNode = GetOrCreateServiceNode(endpointId,
                                                         serviceViewModel);

                componentNode = new ComponentNode(componentViewModel,
                                                  serviceNode,
                                                  viewModel);
                AddNode(componentNode);
            }

            return(componentNode);
        }
Esempio n. 3
0
        public ServiceNode(IProductElementViewModel innerViewModel, EndpointNode parent)
            : base(innerViewModel)
        {
            this.SHAPE_MIN_HEIGHT = 130;
            this.Bounds = new Rect(12, 40, 296, this.SHAPE_MIN_HEIGHT);

            this.SetParent(parent);
        }
Esempio n. 4
0
        public ServiceNode(IProductElementViewModel innerViewModel, EndpointNode parent)
            : base(innerViewModel)
        {
            this.SHAPE_MIN_HEIGHT = 130;
            this.Bounds           = new Rect(12, 40, 296, this.SHAPE_MIN_HEIGHT);

            this.SetParent(parent);
        }
Esempio n. 5
0
        public GroupNode(IProductElementViewModel innerViewModel)
            : base(innerViewModel)
        {
            RotationChanged += new EventHandler(GroupNode_RotationChanged);
            this.IsResizable = false;

            this.ChildNodes = new List<GroupableNode>();
        }
Esempio n. 6
0
        public GroupNode(IProductElementViewModel innerViewModel)
            : base(innerViewModel)
        {
            RotationChanged += new EventHandler(GroupNode_RotationChanged);
            this.IsResizable = false;

            this.ChildNodes = new List <GroupableNode>();
        }
Esempio n. 7
0
        public ComponentNode(IProductElementViewModel innerViewModel, ServiceNode parent)
            : base(innerViewModel)
        {
            this.IsResizable = false;

            this.Bounds = new Rect(12, 40, 276, 38);

            this.SetParent(parent);
        }
Esempio n. 8
0
        public MessageBaseNode(IProductElementViewModel innerViewModel)
            : base(innerViewModel)
        {
            ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left));
            ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right));

            this.IsResizable = false;
            this.Bounds      = new Rect(0, 0, 320, 52);
        }
Esempio n. 9
0
        public ComponentNode(IProductElementViewModel innerViewModel, ServiceNode parent)
            : base(innerViewModel)
        {
            this.IsResizable = false;

            this.Bounds = new Rect(12, 40, 276, 38);

            this.SetParent(parent);
        }
Esempio n. 10
0
        public MessageBaseNode(IProductElementViewModel innerViewModel)
            : base(innerViewModel)
        {
            ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left));
            ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right));

            this.IsResizable = false;
            this.Bounds = new Rect(0, 0, 320, 52);
        }
Esempio n. 11
0
        public GroupableNode(IProductElementViewModel innerViewModel)
        {
            this.InnerViewModel = innerViewModel;
            if (this.InnerViewModel != null)
            {
                this.InnerViewModel.Data.PropertyChanged += InnerViewModelData_PropertyChanged;
            }

            this.ZOrder = ++ZOrderCounter;
        }
Esempio n. 12
0
        public GroupableNode(IProductElementViewModel innerViewModel)
        {
            this.InnerViewModel = innerViewModel;
            if (this.InnerViewModel != null)
            {
                this.InnerViewModel.Data.PropertyChanged += InnerViewModelData_PropertyChanged;
            }

            this.ZOrder = ++ZOrderCounter;
        }
        private void AddElement(IProductElementViewModel newElement)
        {
            var elementType = newElement.Data.Info.Name;

            switch (elementType)
            {
            case "NServiceBusHost":
            case "NServiceBusMVC":
            case "NServiceBusWeb":
                this.ViewModel.GetOrCreateEndpointNode(newElement);
                break;

            case "Service":
                this.ViewModel.GetOrCreateServiceNode(Guid.Empty, newElement);
                break;

            case "Component":
                this.ViewModel.GetOrCreateComponentNode(newElement);
                break;

            case "Command":
                this.ViewModel.GetOrCreateCommandNode(newElement);
                break;

            case "Event":
                this.ViewModel.GetOrCreateEventNode(newElement);
                break;

            case "ComponentLink":
                var componentLink = newElement.Data.As <IAbstractComponentLink>();
                CreateComponentLink(componentLink);
                break;

            // Connections
            case "CommandLink":     // Component -> Command
                var commandLink = newElement.Data.As <ICommandLink>();
                CreateCommandLink(commandLink);
                break;

            case "EventLink":     // Component -> Event
                var eventLink = newElement.Data.As <IEventLink>();
                CreateEventLink(eventLink);
                break;

            case "ProcessedCommandLink":     // Command -> Component
                var processedCommandLink = newElement.Data.As <IProcessedCommandLink>();
                CreateProcessedCommandLink(processedCommandLink);
                break;

            case "SubscribedEventLink":     // Event -> Component
                var subscribedEventLink = newElement.Data.As <ISubscribedEventLink>();
                CreateSubscribedEventLink(subscribedEventLink);
                break;
            }
        }
Esempio n. 14
0
        public GroupableNode(IProductElementViewModel innerViewModel)
        {
            InnerViewModel = innerViewModel;
            if (InnerViewModel != null)
            {
                InnerViewModel.Data.PropertyChanged += InnerViewModelData_PropertyChanged;
                SetupMenuOptions();
            }

            ZOrder = ++ZOrderCounter;
        }
Esempio n. 15
0
        private void RemoveComponentLink(IProductElementViewModel removedElement)
        {
            var componentViewModel = this.ViewModel.DeleteComponentLinkNode(removedElement);

            if (componentViewModel != null && componentViewModel.Data.Product != null)
            {
                this.ViewModel.GetOrCreateComponentNode(componentViewModel);

                var component = componentViewModel.Data.As <IComponent>();
                this.CreateComponentLinks(component);
            }
        }
        private EmptyEndpointNode GetOrCreateEmptyEndpointNode(IProductElementViewModel endpointsViewModel)
        {
            var emptyEndpoint = this.FindNode <EmptyEndpointNode>(EmptyEndpointNode.NodeId);

            if (emptyEndpoint == null)
            {
                emptyEndpoint = new EmptyEndpointNode(endpointsViewModel.MenuOptions.FirstOrDefault(x => x.Caption == "Deploy Unhosted Components..."));
                this.LayoutAlgorithm.SetElementPosition(emptyEndpoint);

                AddNode(emptyEndpoint);
            }

            return(emptyEndpoint);
        }
        public CommandNode GetOrCreateCommandNode(IProductElementViewModel viewModel)
        {
            var command = this.FindNode <CommandNode>(viewModel.Data.Id);

            if (command == null)
            {
                command = new CommandNode(viewModel);
                this.LayoutAlgorithm.SetElementPosition(command);

                AddNode(command);
            }

            return(command);
        }
        public EventNode GetOrCreateEventNode(IProductElementViewModel viewModel)
        {
            var @event = this.FindNode <EventNode>(viewModel.Data.Id);

            if (@event == null)
            {
                @event = new EventNode(viewModel);
                this.LayoutAlgorithm.SetElementPosition(@event);

                AddNode(@event);
            }

            return(@event);
        }
        public ComponentNode GetOrCreateComponentNode(IProductElementViewModel viewModel)
        {
            var component = this.FindNode <ComponentNode>(viewModel.Data.Id);

            if (component == null)
            {
                var service = GetOrCreateServiceNode(EmptyEndpointNode.NodeId, viewModel.ParentNode.ParentNode);

                component = new ComponentNode(viewModel, service, null);
                AddNode(component);
            }

            return(component);
        }
        public MessageNode GetOrCreateMessageNode(IProductElementViewModel viewModel)
        {
            var message = this.FindNode <MessageNode>(viewModel.Data.Id);

            if (message == null)
            {
                message = new MessageNode(viewModel);
                this.LayoutAlgorithm.SetElementPosition(message);

                AddNode(message);
            }

            return(message);
        }
Esempio n. 21
0
        public LogicalViewModel(ISolutionBuilderViewModel sourceViewModel, InnerPanelViewModel innerView)
        {
            this.Title = innerView.Title;
            this.WireSolutionBuilderViewModel(sourceViewModel, true);
            this.LogicalViewNodes = new ObservableCollection <LogicalViewModelNode>();
            IProductElementViewModel root        = null;
            IEnumerable <string>     menuFilters = null;
            InnerPanelItem           rootItem    = null;
            ObservableCollection <IProductElementViewModel> children = new ObservableCollection <IProductElementViewModel>();

            foreach (InnerPanelItem item in innerView.Items)
            {
                if (item is InnerPanelTitle)
                {
                    if (root != null)
                    {
                        var rootNode = new LogicalViewModelNode(this, root, children)
                        {
                            CustomIconPath = rootItem.IconPath
                        };
                        if (menuFilters != null)
                        {
                            rootNode.FilterMenuItems(menuFilters.ToArray());
                        }
                        this.LogicalViewNodes.Add(rootNode);
                    }
                    rootItem    = item;
                    root        = this.GetProductNode(item);
                    menuFilters = (item as InnerPanelTitle).MenuFilters;
                    children    = new ObservableCollection <IProductElementViewModel>();
                }
                else
                {
                    children.Add(this.GetProductNode(item));
                }
            }
            if (root != null)
            {
                var rootNode = new LogicalViewModelNode(this, root, children)
                {
                    CustomIconPath = rootItem.IconPath
                };
                if (menuFilters != null)
                {
                    rootNode.FilterMenuItems(menuFilters.ToArray());
                }
                this.LogicalViewNodes.Add(rootNode);
            }
        }
Esempio n. 22
0
        public void SetView(IServiceProvider serviceProvider, IProductElementViewModel selectedElementViewModel, object logicalViewDataContext)
        {
            this.Caption = "ServiceMatrix Details - " + selectedElementViewModel.Data.InstanceName;
            if (this.CaptionHasChanged != null)
            {
                this.CaptionHasChanged(this, EventArgs.Empty);
            }

            var    model          = selectedElementViewModel.Data;
            string definitionName = model.DefinitionName.ToString();

            switch (definitionName)
            {
            case "Application":
                this.ViewModel.BuildDetailsForApplication(model.As <IApplication>(), logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "NServiceBusHost":
            case "NServiceBusMVC":
            case "NServiceBusWeb":
                this.ViewModel.BuildDetailsForEndpoint(model.As <IToolkitInterface>() as IAbstractEndpoint, logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "Component":
                this.ViewModel.BuildDetailsForComponent(model.As <IComponent>(), logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "Command":
                this.ViewModel.BuildDetailsForCommand(model.As <ICommand>(), logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "Event":
                this.ViewModel.BuildDetailsForEvent(model.As <IEvent>(), logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "UseCase":
                this.ViewModel.BuildDetailsForUseCase(model.As <IUseCase>(), logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            case "Library":
            case "ServiceLibrary":
                this.ViewModel.BuildDetailsForLibrary(model, logicalViewDataContext as ISolutionBuilderViewModel);
                break;

            default:
                this.CleanDetails();
                break;
            }
        }
Esempio n. 23
0
 private void WireInnerViewModel(IProductElementViewModel root)
 {
     this.InnerViewModel = root;
     this.InnerViewModel.PropertyChanged += (s, e) =>
     {
         if (e.PropertyName == "IsSelected")
         {
             // this.IsSelected = this.InnerViewModel.IsSelected;
             if (!this.IsNServiceBusView)
             {
                 this.RaisePropertyChanged("IsSelected");
             }
         }
     };
 }
Esempio n. 24
0
        private void CreateComponentLink(IProductElementViewModel viewModel)
        {
            var componentLink      = viewModel.Data.As <IAbstractComponentLink>();
            var component          = componentLink.ComponentReference.Value;
            var service            = component.Parent.Parent;
            var serviceViewModel   = FindViewModel(service.AsElement().Id);
            var componentViewModel = FindViewModel(component.AsElement().Id);

            this.ViewModel.GetOrCreateComponentLink(componentLink.ParentEndpointComponents.ParentEndpoint.As <NuPattern.Runtime.IProductElement>().Id,
                                                    serviceViewModel,
                                                    componentViewModel,
                                                    viewModel);

            CreateComponentLinks(component);
        }
 public static IProductElementViewModel SearchInNodes(IEnumerable <IProductElementViewModel> nodesCollection, IProductElement target)
 {
     foreach (IProductElementViewModel model in nodesCollection)
     {
         if (model.Data == target)
         {
             return(model);
         }
         IProductElementViewModel model2 = SearchInNodes(model.ChildNodes, target);
         if (model2 != null)
         {
             return(model2);
         }
     }
     return(null);
 }
Esempio n. 26
0
 private IProductElementViewModel SearchInNodes(ObservableCollection <IProductElementViewModel> observableCollection, IProductElement target)
 {
     foreach (IProductElementViewModel model in observableCollection)
     {
         if (model.Data == target)
         {
             return(model);
         }
         IProductElementViewModel model2 = this.SearchInNodes(model.ChildNodes, target);
         if (model2 != null)
         {
             return(model2);
         }
     }
     return(null);
 }
Esempio n. 27
0
        public ComponentNode GetOrCreateComponentLink(Guid endpointId, IProductElementViewModel serviceViewModel, IProductElementViewModel viewModel)
        {
            // Find undeployed component
            var undeployedComponentNode = FindComponent(EmptyEndpointNode.NodeId,
                                                        serviceViewModel.Data.Id,
                                                        viewModel.Data.Id);

            this.DeleteNode(undeployedComponentNode);

            // Remove service if it's empty on Empty Endpoint
            var emptyserviceNode = undeployedComponentNode.ParentNode;

            if (emptyserviceNode != null &&
                !emptyserviceNode.ChildNodes.Any())
            {
                this.DeleteNode(emptyserviceNode);

                // Remove empty endpoint if it's empty
                var emptyendpointNode = emptyserviceNode.ParentNode;
                if (emptyendpointNode != null &&
                    !emptyendpointNode.ChildNodes.Any())
                {
                    this.DeleteNode(emptyendpointNode);
                }
            }


            // Create New Component Link
            var componentNode = FindComponent(endpointId,
                                              serviceViewModel.Data.Id,
                                              viewModel.Data.Id);

            if (componentNode == null)
            {
                var serviceNode = GetOrCreateServiceNode(endpointId,
                                                         serviceViewModel);

                componentNode = new ComponentNode(viewModel,
                                                  serviceNode);
                AddNode(componentNode);
            }

            return(componentNode);
        }
        private void RemoveElement(IProductElementViewModel removedElement)
        {
            switch (removedElement.Data.Info.Name)
            {
            case "NServiceBusHost":
            case "NServiceBusMVC":
                foreach (var cl in removedElement.ChildNodes.First().ChildNodes)
                {
                    RemoveComponentLink(cl);
                }
                break;

            case "ComponentLink":
                RemoveComponentLink(removedElement);
                break;
            }

            ViewModel.DeleteNodesById(removedElement.Data.Id);
        }
        public IProductElementViewModel DeleteComponentLinkNode(IProductElementViewModel removedElement)
        {
            var component = this.Nodes.FirstOrDefault(x => x is ComponentNode && ((ComponentNode)x).ComponentLinkViewModel == removedElement) as ComponentNode;

            if (component != null)
            {
                this.DeleteNode(component);

                // Remove service if it's empty
                var serviceNode = component.ParentNode;
                if (serviceNode != null &&
                    !serviceNode.ChildNodes.Any())
                {
                    this.DeleteNode(serviceNode);
                }

                return(component.InnerViewModel);
            }

            return(null);
        }
        public ServiceNode GetOrCreateServiceNode(Guid endpointId, IProductElementViewModel viewModel)
        {
            var service = this.FindNode <ServiceNode>((x) => x.Id == viewModel.Data.Id &&
                                                      x.ParentNode.Id == endpointId);

            if (service == null)
            {
                var endpoint = this.FindNode <EndpointNode>(endpointId);

                if (endpoint == null &&
                    endpointId == EmptyEndpointNode.NodeId)
                {
                    var endpointsViewModel = viewModel.ParentNode.ParentNode.ChildNodes.First(x => x.Data.InstanceName == "Endpoints");
                    endpoint = GetOrCreateEmptyEndpointNode(endpointsViewModel);
                }

                service = new ServiceNode(viewModel, endpoint);
                AddNode(service);
            }

            return(service);
        }
Esempio n. 31
0
        private IProductElementViewModel GetProductNode(InnerPanelItem item)
        {
            IProductElement          target = item.Product;
            string                   label  = item.Text;
            IProductElementViewModel model  = this.SearchInNodes(this.SourceViewModel.TopLevelNodes, target);

            if (model == null)
            {
                var element = this.SourceViewModel.TopLevelNodes[0].Data.As <IApplication>().Design.DummyCollection.As <IAbstractElement>();
                var ctx     = this.SourceViewModel.TopLevelNodes[0].Context;
                LabelElementViewModel model2 = new LabelElementViewModel(element, ctx)
                {
                    Label = label
                };
                model = model2;
            }
            else if (item is InnerPanelTitle && (item as InnerPanelTitle).ForceText)
            {
                var ctx = this.SourceViewModel.TopLevelNodes[0].Context;
                if (model.Data is IAbstractElement)
                {
                    LabelElementViewModel model2 = new LabelElementViewModel(model.Data.As <IAbstractElement>(), ctx)
                    {
                        Label = item.Text
                    };
                    model = model2;
                }
                //else
                //{
                //    LabelProductElementViewModel model2 = new LabelProductElementViewModel(model.Data.As<IProduct>(), ctx)
                //    {
                //        Label = item.Text
                //    };
                //    model = model2;
                //}
            }
            return(model);
        }
Esempio n. 32
0
 public EndpointNode(IProductElementViewModel innerViewModel) : base(innerViewModel)
 {
     this.SHAPE_MIN_HEIGHT = 190;
     this.Bounds           = new System.Windows.Rect(0, 0, 320, this.SHAPE_MIN_HEIGHT);
 }
 private void RemoveElement(IProductElementViewModel removedElement)
 {
     this.ViewModel.DeleteNodesById(removedElement.Data.Id);
 }
        private void AddElement(IProductElementViewModel newElement)
        {
            var elementType = newElement.Data.Info.Name;

            switch (elementType)
            {
                case "NServiceBusHost":
                case "NServiceBusMVC":
                case "NServiceBusWeb":
                    this.ViewModel.GetOrCreateEndpointNode(newElement);
                    break;
                case "Service":
                    this.ViewModel.GetOrCreateServiceNode(Guid.Empty, newElement);
                    break;
                case "Component":
                    this.ViewModel.GetOrCreateComponentNode(newElement);
                    break;
                case "Command":
                    this.ViewModel.GetOrCreateCommandNode(newElement);
                    break;
                case "Event":
                    this.ViewModel.GetOrCreateEventNode(newElement);
                    break;
                case "ComponentLink":
                    var componentLink = newElement.Data.As<IAbstractComponentLink>();
                    CreateComponentLink(componentLink);
                    break;

                // Connections
                case "CommandLink": // Component -> Command
                    var commandLink = newElement.Data.As<ICommandLink>();
                    CreateCommandLink(commandLink);
                    break;
                case "EventLink": // Component -> Event
                    var eventLink = newElement.Data.As<IEventLink>();
                    CreateEventLink(eventLink);
                    break;
                case "ProcessedCommandLink": // Command -> Component
                    var processedCommandLink = newElement.Data.As<IProcessedCommandLink>();
                    CreateProcessedCommandLink(processedCommandLink);
                    break;
                case "SubscribedEventLink": // Event -> Component
                    var subscribedEventLink = newElement.Data.As<ISubscribedEventLink>();
                    CreateSubscribedEventLink(subscribedEventLink);
                    break;

            }
        }
Esempio n. 35
0
 private void WireInnerViewModel(IProductElementViewModel root)
 {
     this.InnerViewModel = root;
     this.InnerViewModel.PropertyChanged += (s, e) =>
         {
             if (e.PropertyName == "IsSelected")
             {
                 // this.IsSelected = this.InnerViewModel.IsSelected;
                 if (!this.IsNServiceBusView)
                 {
                     this.RaisePropertyChanged("IsSelected");
                 }
             }
         };
 }
Esempio n. 36
0
            // Methods
            public LogicalViewModelNode(
                LogicalViewModel viewModel,
                IProductElementViewModel root,
                ObservableCollection<IProductElementViewModel> children
                )
            {
                this.IsExpanded = true;
                this.ViewModel = viewModel;
                WireInnerViewModel(root);

                if (children != null)
                {
                    Func<IProductElementViewModel, LogicalViewModelNode> LogicalViewCreator = n =>
                        {
                            return new LogicalViewModelNode(viewModel, n, null);
                        };
                    this.LogicalViewNodes = new ObservableCollection<LogicalViewModelNode>(children.Select(n => LogicalViewCreator(n)));
                }
                else
                {
                    this.LogicalViewNodes = new ObservableCollection<LogicalViewModel.LogicalViewModelNode>();
                }

                if (!viewModel.IsMasterView)
                {
                    this.RemoveDeleteMenuItem();
                }
            }
 private void RemoveElement(IProductElementViewModel removedElement)
 {
     this.ViewModel.DeleteNodesById(removedElement.Data.Id);
 }
Esempio n. 38
0
 public ChildNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
     ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left));
     ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right));
 }
Esempio n. 39
0
        public void SetView(IServiceProvider serviceProvider, IProductElementViewModel selectedElementViewModel, object logicalViewDataContext)
        {
            this.Caption = "ServiceMatrix Details - " + selectedElementViewModel.Data.InstanceName;
            if (this.CaptionHasChanged != null)
            {
                this.CaptionHasChanged(this, EventArgs.Empty);
            }

            var model = selectedElementViewModel.Data;
            string definitionName = model.DefinitionName.ToString();
            switch (definitionName)
            {
                case "Application":
                    this.ViewModel.BuildDetailsForApplication(model.As<IApplication>(), logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "NServiceBusHost":
                case "NServiceBusMVC":
                case "NServiceBusWeb":
                    this.ViewModel.BuildDetailsForEndpoint(model.As<IToolkitInterface>() as IAbstractEndpoint, logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "Component":
                    this.ViewModel.BuildDetailsForComponent(model.As<IComponent>(), logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "Command":
                    this.ViewModel.BuildDetailsForCommand(model.As<ICommand>(), logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "Event":
                    this.ViewModel.BuildDetailsForEvent(model.As<IEvent>(), logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "UseCase":
                    this.ViewModel.BuildDetailsForUseCase(model.As<IUseCase>(), logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                case "Library":
                case "ServiceLibrary":
                    this.ViewModel.BuildDetailsForLibrary(model, logicalViewDataContext as ISolutionBuilderViewModel);
                    break;
                default:
                    this.CleanDetails();
                    break;
            }
        }
        private void RemoveComponentLink(IProductElementViewModel removedElement)
        {
            var componentViewModel = this.ViewModel.DeleteComponentLinkNode(removedElement);
            if (componentViewModel != null && componentViewModel.Data.Product != null)
            {
                this.ViewModel.GetOrCreateComponentNode(componentViewModel);

                var component = componentViewModel.Data.As<IComponent>();
                this.CreateComponentLinks(component);
            }
        }
Esempio n. 41
0
 public CommandNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
 }
Esempio n. 42
0
 public EventNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
 }
Esempio n. 43
0
 public EndpointNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
     this.SHAPE_MIN_HEIGHT = 190;
     this.Bounds = new System.Windows.Rect(0, 0, 320, this.SHAPE_MIN_HEIGHT);
 }
Esempio n. 44
0
 public ChildNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
     ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Left));
     ConnectionPoints.Add(new DiagramConnectionPoint(this, Edge.Right));
 }
        private void AddElement(IProductElementViewModel newElement)
        {
            var elementType = newElement.Data.Info.Name;

            switch (elementType)
            {
                case "Application":
                    newElement.ChildNodes.Traverse(x => x.ChildNodes).Where(x => x.Data.DefinitionName != "Service").ForEach (x => AddElement (x));
                    break;

                case "NServiceBusHost":
                case "NServiceBusMVC":
                case "NServiceBusWeb":
                    this.ViewModel.GetOrCreateEndpointNode(newElement);
                    break;
                case "Service":
                    this.ViewModel.GetOrCreateServiceNode(Guid.Empty, newElement);
                    break;
                case "Component":
                    this.ViewModel.GetOrCreateComponentNode(newElement);
                    break;
                case "Command":
                    this.ViewModel.GetOrCreateCommandNode(newElement);
                    break;
                case "Event":
                    this.ViewModel.GetOrCreateEventNode(newElement);
                    break;
                case "Message":
                    this.ViewModel.GetOrCreateMessageNode(newElement);
                    break;
                case "ComponentLink":
                    CreateComponentLink(newElement);
                    break;

                // Connections
                case "CommandLink": // Component -> Command
                    var commandLink = newElement.Data.As<ICommandLink>();
                    CreateCommandLink(commandLink);
                    break;
                case "EventLink": // Component -> Event
                    var eventLink = newElement.Data.As<IEventLink>();
                    CreateEventLink(eventLink);
                    break;
                case "ProcessedCommandLink": // Command -> Component
                    var processedCommandLink = newElement.Data.As<IProcessedCommandLink>();
                    CreateProcessedCommandLink(processedCommandLink);
                    break;
                case "SubscribedEventLink": // Event -> Component
                    var subscribedEventLink = newElement.Data.As<ISubscribedEventLink>();
                    CreateSubscribedEventLink(subscribedEventLink);
                    break;

                case "ProcessedCommandLinkReply": // Component -> Mesage
                    var processedCommandLinkReply = newElement.Data.As<IProcessedCommandLinkReply>();
                    CreateProcessedCommandLinkReply(processedCommandLinkReply);
                    break;

                case "HandledMessageLink": // Message -> Component
                    var handledMessageLink = newElement.Data.As<IHandledMessageLink>();
                    CreateHandledMessageLink(handledMessageLink);
                    break;
            }
        }
        private void CreateComponentLink(IProductElementViewModel viewModel)
        {
            var componentLink = viewModel.Data.As<IAbstractComponentLink>();
            var component = componentLink.ComponentReference.Value;
            var service = component.Parent.Parent;
            var serviceViewModel = FindViewModel(service.AsElement().Id);
            var componentViewModel = FindViewModel(component.AsElement().Id);

            this.ViewModel.GetOrCreateComponentLink(componentLink.ParentEndpointComponents.ParentEndpoint.As<NuPattern.Runtime.IProductElement>().Id,
                                                    serviceViewModel,
                                                    componentViewModel,
                                                    viewModel);

            CreateComponentLinks(component);
        }
Esempio n. 47
0
 public MessageNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
 }
        private void RemoveElement(IProductElementViewModel removedElement)
        {
            switch (removedElement.Data.Info.Name)
            {
                case "NServiceBusHost":
                case "NServiceBusMVC":
                case "NServiceBusWeb":
                    foreach (var cl in removedElement.ChildNodes.First().ChildNodes)
                    {
                        RemoveComponentLink(cl);
                    }
                    break;
                case "ComponentLink":
                    RemoveComponentLink(removedElement);
                    break;

            }

            this.ViewModel.DeleteNodesById(removedElement.Data.Id);
        }
Esempio n. 49
0
 public CommandNode(IProductElementViewModel innerViewModel)
     : base(innerViewModel)
 {
 }