Beispiel #1
0
        private void CreateInfrastructurePanel(ISolutionBuilderViewModel solutionBuilderModel, IInfrastructure infrastructure, int position)
        {
            var infrastructureVM = new InnerPanelViewModel();

            infrastructureVM.Title = "Infrastructure";

            infrastructureVM.Items.Add(new InnerPanelTitle {
                Product = infrastructure.As <IProductElement>(), Text = infrastructure.InstanceName
            });

            if (infrastructure.Security != null)
            {
                infrastructureVM.Items.Add(new InnerPanelTitle {
                    Product = infrastructure.Security.As <IProductElement>(), Text = infrastructure.Security.InstanceName
                });
                if (infrastructure.Security.Authentication != null)
                {
                    infrastructureVM.Items.Add(new InnerPanelItem {
                        Product = infrastructure.Security.Authentication.As <IProductElement>(), Text = infrastructure.Security.Authentication.InstanceName
                    });
                }
            }

            this.SetPanel(position, new LogicalView(new LogicalViewModel(solutionBuilderModel, infrastructureVM)));
        }
Beispiel #2
0
        /// <summary>
        /// If the infrastructure project doesn't exist, it creates the project
        /// and adds references to the project on each existing endpoint project.
        /// Also it adds the references when a new endpoint is created
        /// by listening the OnInstantiated event.
        /// </summary>
        /// <param name="infrastructure">Infrastructure</param>
        /// <param name="solution">Solution</param>
        /// <returns>The infrastructure project</returns>
        public static IProject GenerateInfrastructureProjectIfNeeded(IInfrastructure infrastructure, ISolution solution)
        {
            var projectName = infrastructure.Parent.Parent.InstanceName + ".Infrastructure";

            if (!solution.Items.Any(i => i.Name == projectName))
            {
                // Unfold the project
                infrastructure.As <IProductElement>().Execute("GenerateProjectCommand");
                infrastructure.As <IProductElement>().Execute("UnfoldPackagesConfig");

                // Add the references on existing projects
                AddInfrastructureReferences(infrastructure.Parent.Parent, solution);
                infrastructure.Parent.Parent.OnInstantiatedEndpoint += (s, e) =>
                {
                    // Add the references on each new endpoint project
                    AddInfrastructureReferences(infrastructure.Parent.Parent, solution);
                };
            }

            var item = solution.Items.First(i => i.Name == projectName);

            return(item.As <IProject>());
        }
Beispiel #3
0
        /// <summary>
        /// If the infrastructure project doesn't exist, it creates the project
        /// and adds references to the project on each existing endpoint project.
        /// Also it adds the references when a new endpoint is created
        /// by listening the OnInstantiated event.
        /// </summary>
        /// <param name="infrastructure">Infrastructure</param>
        /// <param name="solution">Solution</param>
        /// <returns>The infrastructure project</returns>
        public static IProject GenerateInfrastructureProjectIfNeeded(IInfrastructure infrastructure, ISolution solution)
        {
            var projectName = infrastructure.Parent.Parent.InstanceName + ".Infrastructure";
            if (!solution.Items.Any(i => i.Name == projectName))
            {
                // Unfold the project
                infrastructure.As<IProductElement>().Execute("GenerateProjectCommand");
                infrastructure.As<IProductElement>().Execute("UnfoldPackagesConfig");

                // Add the references on existing projects
                AddInfrastructureReferences(infrastructure.Parent.Parent, solution);
                infrastructure.Parent.Parent.OnInstantiatedEndpoint += (s, e) =>
                {
                    // Add the references on each new endpoint project
                    AddInfrastructureReferences(infrastructure.Parent.Parent, solution);
                };
            }

            var item = solution.Items.First(i => i.Name == projectName);
            return item.As<IProject>();
        }
        private void CreateInfrastructurePanel(ISolutionBuilderViewModel solutionBuilderModel, IInfrastructure infrastructure, int position)
        {
            var infrastructureVM = new InnerPanelViewModel();
            infrastructureVM.Title = "Infrastructure";

            infrastructureVM.Items.Add(new InnerPanelTitle { Product = infrastructure.As<IProductElement>(), Text = infrastructure.InstanceName });

            if (infrastructure.Security != null)
            {
                infrastructureVM.Items.Add(new InnerPanelTitle { Product = infrastructure.Security.As<IProductElement>(), Text = infrastructure.Security.InstanceName });
                if (infrastructure.Security.Authentication != null)
                {
                    infrastructureVM.Items.Add(new InnerPanelItem { Product = infrastructure.Security.Authentication.As<IProductElement>(), Text = infrastructure.Security.Authentication.InstanceName });
                }
            }

            this.SetPanel(position, new LogicalView(new LogicalViewModel(solutionBuilderModel, infrastructureVM)));
        }