public virtual void SetDataType(Type type, UiBase parent) { CloseCurrentService(); CurrentType = type; this.associatedParent = parent; if (type == typeof(UiClient)) { UiClient.InitService(); SelectService(UiClient.Service, typeof(UiClient), parent); return; } if (type == typeof(UiEmployee)) { UiEmployee.InitService(); SelectService(UiEmployee.Service, typeof(UiEmployee), parent); return; } if (type == typeof(UiProjectItemsCategory)) { // only as DetailController UiProjectItemsCategory.InitService(); SelectService(UiProjectItemsCategory.Service, typeof(UiProjectItemsCategory), parent); return; } if (type == typeof(UiProject)) { UiProject.InitService(); SelectService(UiProject.Service, typeof(UiProject), parent, new[] { "Budgets" }); return; } if (type == typeof(UiMaterial)) { UiMaterial.InitService(); SelectService(UiMaterial.Service, typeof(UiMaterial), parent); return; } if (type == typeof(UiProjectCategory)) { UiProjectCategory.InitService(); SelectService(UiProjectCategory.Service, typeof(UiProjectCategory), parent); return; } // TODO : throw an exception }
public static Solution GenerateWithAllReferences(UiProject mainProject, bool generateEntryProject, string binariesPath, IEnumerable<Project> extraProjects = null) { if(extraProjects == null) { extraProjects = new Project[0]; } var extensionProjects = Scanner.Instance.Elements.OfType<ExtensionProject>(); var pluginProjects = Scanner.Instance.Elements.OfType<PluginProject>().Where(x => !x.PluginModes.Any() || x.PluginModes.Contains(mainProject.UiType)); var projects = extensionProjects .Union(extraProjects) .Union(extraProjects.SelectMany(x => x.GetAllReferences())) .Union(extensionProjects.SelectMany(x => x.GetAllReferences())) .Union(pluginProjects) .Union(pluginProjects.SelectMany(x => x.GetAllReferences())).ToList(); return SolutionGenerator.Generate(mainProject, generateEntryProject, binariesPath, projects); }