void LoadDefinitionFiles() { templates = new TemplateRegistry(); pages = new PageRegistry(templates, "admin"); string dirpath = WebUtility.MapPath("resources/admin"); if (!Directory.Exists(dirpath)) { Directory.CreateDirectory(dirpath); } foreach (string dir in Directory.GetDirectories(dirpath)) { string path = dir + "\\definitions.xml"; if (File.Exists(path)) { XmlSourceFileDependent file = new XmlSourceFileDependent(path); definitionsFiles.Add(file); XmlElement xml = file.Data.SelectSingleNode("/Definitions") as XmlElement; if (xml == null) { continue; } xml = file.Data.SelectSingleNode("/Definitions/Templates") as XmlElement; if (xml != null) { templates.Load(xml); } xml = file.Data.SelectSingleNode("/Definitions/Pages") as XmlElement; if (xml != null) { pages.Load(xml); } } } }
public static void Register(IContainerRegistry container, string key, Type view, Type viewModel) { if (viewModel != null) { container.Register(viewModel); ViewModelLocationProvider.Register(view.ToString(), viewModel); } PageRegistry.Register(key, (view, viewModel)); }
public static void InitializePageRegistry(ContainerBuilder builder) { var registry = new PageRegistry <TEKUtsavAppPage>(); registry.RegisterPage(TEKUtsavAppPage.LoginPage, typeof(LoginPage), typeof(LoginPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.RegistrationPage, typeof(RegistrationPage), typeof(RegistrationPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.NotificationsPage, typeof(NotificationsPage), typeof(NotificationsPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.VotingPage, typeof(VotingPage), typeof(VotingPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.AdminSettingsPage, typeof(AdminSettingsPage), typeof(AdminSettingsPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.SingleSelectionPage, typeof(SingleSelectionPage), typeof(SingleSelectionPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.ContactDetailsPage, typeof(ContactDetailsPage), typeof(ContactDetailsPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.EventSchedulePage, typeof(EventSchedulePage), typeof(EventSchedulePageViewModel)); registry.RegisterPage(TEKUtsavAppPage.MasterMenuPage, typeof(MasterMenuPage), typeof(MasterMenuPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.HomePage, typeof(HomePage), typeof(HomePageViewModel)); registry.RegisterPage(TEKUtsavAppPage.PurchaseOrderDetails, typeof(PurchaseOrderDetailsPage), typeof(PurchaseOrderDetailsPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.MeasurementPage, typeof(MeasurementPage), typeof(MeasurementPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.MultiSelectionPage, typeof(MultiSelectionPage), typeof(MultiSelectionPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.RejectPopupPage, typeof(RejectPopupPage), typeof(RejectPopupPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.WorkFlowCompletedPopupPage, typeof(WorkFlowCompletedPopupPage), typeof(WorkFlowCompletedPopupPageViewModel)); registry.RegisterPage(TEKUtsavAppPage.WarehouseApprovalPopupPage, typeof(WarehouseApprovalPopupPage), typeof(WarehouseApprovalPopupViewModel)); builder.RegisterInstance(registry).SingleInstance().As <IPageRegistry <TEKUtsavAppPage> >(); }