private void CreateEventsForUseCasePanel(ISolutionBuilderViewModel solutionBuilderModel, IUseCase useCase, int position) { var events = useCase.RelatedEvents; var eventsVM = new InnerPanelViewModel(); eventsVM.Title = "Events"; var eventsNode = new InnerPanelTitle { Product = useCase.As <IProductElement>(), Text = "Events", ForceText = true, MenuFilters = new string[] { "Add Event" }, IconPath = solutionBuilderModel.FindNodeFor(useCase.Parent.As <IProductElement>()).IconPath }; eventsVM.Items.Add(eventsNode); foreach (var service in events.Select(c => c.Parent.Parent.Parent).Distinct()) { eventsVM.Items.Add(new InnerPanelTitle { Product = service.As <IProductElement>(), Text = service.InstanceName }); foreach (var @event in events.Where(c => c.Parent.Parent.Parent == service)) { eventsVM.Items.Add(new InnerPanelItem { Product = @event.As <IProductElement>(), Text = @event.InstanceName }); } } this.SetPanel(position, new LogicalView(new LogicalViewModel(solutionBuilderModel, eventsVM))); }
private void CreateEventsForUseCasePanel(ISolutionBuilderViewModel solutionBuilderModel, IUseCase useCase, int position) { var events = useCase.RelatedEvents; var eventsVM = new InnerPanelViewModel(); eventsVM.Title = "Events"; var eventsNode = new InnerPanelTitle { Product = useCase.As<IProductElement>(), Text = "Events", ForceText = true, MenuFilters = new string[] { "Add Event" }, IconPath = solutionBuilderModel.FindNodeFor(useCase.Parent.As<IProductElement>()).IconPath }; eventsVM.Items.Add(eventsNode); foreach (var service in events.Select(c => c.Parent.Parent.Parent).Distinct()) { eventsVM.Items.Add(new InnerPanelTitle { Product = service.As<IProductElement>(), Text = service.InstanceName }); foreach (var @event in events.Where(c => c.Parent.Parent.Parent == service)) { eventsVM.Items.Add(new InnerPanelItem { Product = @event.As<IProductElement>(), Text = @event.InstanceName }); } } this.SetPanel(position, new LogicalView(new LogicalViewModel(solutionBuilderModel, eventsVM))); }