protected override void Configure() { _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.Singleton <INotesService, NotesService>(); _container.Singleton <INotesProvider, NotesProvider>(); _container.Singleton <ILocalStorage, LocalStorage>(); _container.Singleton <AppNavigationService>(); _container.Singleton <IInteractionService, InteractionService>(); _container.Handler <IAppNavigationService>(cnt => cnt.GetInstance <AppNavigationService>()); _container.PerRequest <ShellViewModel>(); _container.PerRequest <ShowNotesViewModel>(); _container.PerRequest <CreateNoteViewModel>(); _container.PerRequest <FavoriteNotesViewModel>(); var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Notes.Views", DefaultSubNamespaceForViewModels = "Notes.Core.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
protected override void Configure() { // This configures the framework to map between MainViewModel and MainPage // Normally it would map between MainPageViewModel and MainPage var config = new TypeMappingConfiguration { IncludeViewSuffixInViewModelNames = false }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.PerRequest <ShellViewModel>(); _container.PerRequest <MainViewModel>(); _container.PerRequest <ContentGridDetailViewModel>(); _container.PerRequest <ContentGridViewModel>(); _container.PerRequest <MediaPlayerViewModel>(); _container.PerRequest <DataGridViewModel>(); _container.PerRequest <ChartViewModel>(); _container.PerRequest <TabbedPivotViewModel>(); _container.PerRequest <ImageGalleryDetailViewModel>(); _container.PerRequest <ImageGalleryViewModel>(); _container.PerRequest <SettingsViewModel>(); }
protected override void Configure() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "UIUniversal.Views", DefaultSubNamespaceForViewModels = "UIUniversal.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.PerRequest <MainPageViewModel>(); AddCustomConventions(); var isStatusBarPresent = ApiInformation.IsTypePresent(typeof(StatusBar).ToString()); if (isStatusBarPresent) { StatusBar statusBar = StatusBar.GetForCurrentView(); // Hide the status bar statusBar.HideAsync(); } }
protected override void Configure() { // This configures the framework to map between MainViewModel and MainPage // Normally it would map between MainPageViewModel and MainPage var config = new TypeMappingConfiguration { IncludeViewSuffixInViewModelNames = false }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.PerRequest <ShellViewModel>(); _container.PerRequest <MainViewModel>(); _container.PerRequest <BlankViewModel>(); _container.PerRequest <WebViewViewModel>(); _container.PerRequest <MediaPlayerViewModel>(); _container.PerRequest <MasterDetailViewModel>(); _container.PerRequest <ContentGridDetailViewModel>(); _container.PerRequest <ContentGridViewModel>(); _container.PerRequest <CameraViewModel>(); _container.PerRequest <InkSmartCanvasViewModel>(); _container.PerRequest <ImageGalleryDetailViewModel>(); _container.PerRequest <ImageGalleryViewModel>(); _container.PerRequest <SettingsViewModel>(); _container.PerRequest <SchemeActivationSampleViewModel>(); }
private static void WriteResource(HttpContext context, StreamWriter writer, TypeMappingConfiguration type) { var url = context.Request.Url; // TODO: find a better way to define when it's local or remote var domain = (context.Request["local"] == "1") ? string.Empty : string.Format("//{0}\\:{1}", url.Host, url.Port); var baseUrl = domain + VirtualPathUtility.ToAbsolute("~/"); writer.WriteLine("ro.factory('{0}', function($resource) {{ return $resource('{1}api/{0}/:id/:methodName/:index', {{id:'@id'}}, {{", type.UnderlineType.PartialName(), baseUrl); writer.WriteLine("'all': {method:'GET', isArray:true}, "); writer.WriteLine("'get': {method:'GET'}, "); writer.WriteLine("'insert': {method:'POST'}, "); writer.WriteLine("'update': {method:'PUT'}, "); writer.WriteLine("'delete': {method:'DELETE'}, "); var typeMapping = ModelMappingManager.MappingFor(type.UnderlineType); // write the instance methods foreach (var instanceMethod in typeMapping.InstanceMethods) { WriteMethod(writer, instanceMethod); } // write the static methods foreach (var staticMethod in typeMapping.StaticMethods) { WriteMethod(writer, staticMethod, true); } writer.WriteLine("})});"); writer.WriteLine(""); }
/// <summary> /// Configure the bootstrapper. /// </summary> protected override void Configure() { this.defaultElementLookup = BindingScope.GetNamedElements; BindingScope.GetNamedElements = k => { var namedElements = new List <FrameworkElement>(); namedElements.AddRange(this.defaultElementLookup(k)); var ribbon = this.LookForRibbon(k); if (null != ribbon) { this.AppendRibbonNamedItem(ribbon, namedElements); } return(namedElements); }; var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "View", DefaultSubNamespaceForViewModels = "ViewModel" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); this.kernel = new StandardKernel(); this.kernel.Load(Assembly.GetExecutingAssembly()); }
protected override void Configure() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "RealTimeFaceAnalytics.WPF.Views", DefaultSubNamespaceForViewModels = "RealTimeFaceAnalytics.Core.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _container = new SimpleContainer(); _container.Singleton <IWindowManager, WindowManager>(); _container.Singleton <IEventAggregator, EventAggregator>(); _container.Singleton <IComputerVisionService, ComputerVisionService>(); _container.Singleton <IEmotionService, EmotionService>(); _container.Singleton <IFaceService, FaceService>(); _container.Singleton <IOpenCvService, OpenCvService>(); _container.Singleton <IVideoFrameAnalyzerService, VideoFrameAnalyzerService>(); _container.Singleton <IVisualizationService, VisualizationService>(); _container.Singleton <IDataInsertionService, DataInsertionService>(); _container.PerRequest <ShellViewModel>(); }
protected override void Configure() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Client.Views", DefaultSubNamespaceForViewModels = "Common.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); container = new WinRTContainer(); container.RegisterWinRTServices(); // Register the ViewModels container.PerRequest <MainViewModel>(); MessageBinder.SpecialValues.Add("$account", context => { if (context == null || context.EventArgs == null) { return(null); } return (((ItemClickEventArgs)context.EventArgs).ClickedItem as AccountViewModel); }); }
/// <summary> /// Specifies how type mappings are created, including default type mappings. Calling this method will /// clear all existing name transformation rules and create new default type mappings according to the /// configuration. /// </summary> /// <param name="config">An instance of TypeMappingConfiguration that provides the settings for configuration</param> public static void ConfigureTypeMappings(TypeMappingConfiguration config) { if (String.IsNullOrEmpty(config.DefaultSubNamespaceForViews)) { throw new ArgumentException("DefaultSubNamespaceForViews field cannot be blank."); } if (String.IsNullOrEmpty(config.DefaultSubNamespaceForViewModels)) { throw new ArgumentException("DefaultSubNamespaceForViewModels field cannot be blank."); } if (String.IsNullOrEmpty(config.NameFormat)) { throw new ArgumentException("NameFormat field cannot be blank."); } NameTransformer.Clear(); ViewSuffixList.Clear(); defaultSubNsViews = config.DefaultSubNamespaceForViews; defaultSubNsViewModels = config.DefaultSubNamespaceForViewModels; nameFormat = config.NameFormat; useNameSuffixesInMappings = config.UseNameSuffixesInMappings; viewModelSuffix = config.ViewModelSuffix; ViewSuffixList.AddRange(config.ViewSuffixList); includeViewSuffixInVmNames = config.IncludeViewSuffixInViewModelNames; SetAllDefaults(); }
protected override void Configure() { _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.Singleton <IWeatherService, WeatherService>(); _container.Singleton <IWeatherProvider, WeatherProvider>(); _container.Singleton <AppNavigationService>(); _container.Singleton <IInteractionService, InteractionService>(); _container.Handler <IAppNavigationService>(cnt => cnt.GetInstance <AppNavigationService>()); _container.PerRequest <ShellViewModel>(); _container.PerRequest <HomeViewModel>(); _container.PerRequest <SecondPageViewModel>(); _container.PerRequest <ThirdPageViewModel>(); var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Weather.UWP.Views", DefaultSubNamespaceForViewModels = "Weather.Core.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
protected override void Configure() { // This configures the framework to map between MainViewModel and MainPage // Normally it would map between MainPageViewModel and MainPage var config = new TypeMappingConfiguration { IncludeViewSuffixInViewModelNames = false }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _container = new WinRTContainer(); _container.RegisterWinRTServices(); _container.PerRequest <FunctionOptimizationGaService>(); _container.EnablePropertyInjection = true; _container.PerRequest <ShellViewModel>(); _container.PerRequest <MainViewModel>(); _container.PerRequest <ContentGridDetailViewModel>(); _container.PerRequest <ContentGridViewModel>(); _container.PerRequest <ChartViewModel>(); _container.PerRequest <SettingsViewModel>(); _container.PerRequest <MutationSettingsViewModel>(); _container.PerRequest <PopulationSettingsViewModel>(); _container.PerRequest <CrossoverSettingsViewModel>(); _container.PerRequest <SelectionSettingsViewModel>(); _container.PerRequest <RunnersSetViewModel>(); _container.PerRequest <RunnerInstanceViewModel>(); _container.PerRequest <ProfileViewModel>(); }
/// <summary> /// By default, we are configured to use MEF /// </summary> protected override void Configure() { //Allow us to load views and view models from different location var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Sightstone.Views", DefaultSubNamespaceForViewModels = "Sightstone.ViewModels" }; Caliburn.Micro.ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); ConventionManager.ApplyValueConverter = ValueTypeConverter.ApplyValueConverter; var catalog = new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x))); _container = new CompositionContainer(catalog); var batch = new CompositionBatch(); batch.AddExportedValue <IWindowManager>(new WindowManager()); batch.AddExportedValue <IEventAggregator>(new EventAggregator()); batch.AddExportedValue(_container); batch.AddExportedValue(catalog); _container.Compose(batch); }
private static void ConfigureTypeMapping() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "BuildingBlocks.Presentation.Views", DefaultSubNamespaceForViewModels = "BuildingBlocks.Presentation.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
public void ConfigureTypeMappingsShouldThrowWhenDefaultSubNamespaceForViewModelsIsEmpty() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "not empty", DefaultSubNamespaceForViewModels = string.Empty, NameFormat = "not Empty" }; Assert.Throws<ArgumentException>(() => ViewLocator.ConfigureTypeMappings(config)); }
public void ConfigureTypeMappingsShouldThrowWhenNameFormatIsEmpty() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "not Empty", DefaultSubNamespaceForViewModels = "not Empty", NameFormat = string.Empty }; Assert.Throws <ArgumentException>(() => ViewModelLocator.ConfigureTypeMappings(config)); }
protected void ConfigureTypeMappings() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = NameSpaceBinding.View, DefaultSubNamespaceForViewModels = NameSpaceBinding.ViewModel, }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
private static void ConfigureTypeMapping() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = Consts.Mappings.View, DefaultSubNamespaceForViewModels = Consts.Mappings.ViewModel }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
public void ConfigureTypeMappingsShouldThrowWhenDefaultSubNamespaceForViewModelsIsNull() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "not null", DefaultSubNamespaceForViewModels = null, NameFormat = "not null" }; Assert.Throws <ArgumentException>(() => ViewModelLocator.ConfigureTypeMappings(config)); }
public void ConfigureTypeMappingsShouldThrowWhenNameFormatIsNull() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "not null", DefaultSubNamespaceForViewModels = "not null", NameFormat = null }; Assert.Throws<ArgumentException>(() => ViewLocator.ConfigureTypeMappings(config)); }
private static void ConfigureTypeMapping() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "InstantDelivery.Views", DefaultSubNamespaceForViewModels = "InstantDelivery.ViewModel" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
protected virtual void ConfigureBootstrapper() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = typeof(ShellView).Namespace, DefaultSubNamespaceForViewModels = typeof(ShellViewModel).Namespace }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
protected override void Configure() { var config = new TypeMappingConfiguration { IncludeViewSuffixInViewModelNames = false, DefaultSubNamespaceForViewModels = "ViewModel", DefaultSubNamespaceForViews = "View", ViewSuffixList = new List <string> { "View", "Page", "Control" } }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); var builder = new ContainerBuilder(); // Register Basic Tools builder.RegisterType <WindowManager>() .AsImplementedInterfaces() .SingleInstance(); //builder.RegisterType<EventAggregator>() // .AsImplementedInterfaces() // .SingleInstance(); //builder.RegisterType<FrameAdapter> // Register ViewModels builder.RegisterType <SelectProcessViewModel>(); builder.RegisterType <HookConfigViewModel>() .SingleInstance(); builder.RegisterType <GameViewModel>() .SingleInstance(); builder.RegisterType <PreferenceViewModel>() .SingleInstance(); builder.RegisterType <TextViewModel>() .SingleInstance(); builder.RegisterType <HookViewModel>() .SingleInstance(); builder.RegisterType <GeneralViewModel>() .SingleInstance(); builder.RegisterType <AboutViewModel>() .SingleInstance(); // Register Servieces builder.RegisterType <SelectProcessService>() .AsImplementedInterfaces(); builder.RegisterType <GameViewDataService>() .AsImplementedInterfaces(); builder.RegisterType <HookSettingPageService>() .AsImplementedInterfaces(); Container = builder.Build(); }
/// <summary> /// Change mapping locator between view & viewmodel. /// </summary> private void ChangeMappingLocator() { // configure view & viewmodel locator. var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "BookManagement.View", DefaultSubNamespaceForViewModels = "BookManagement.ViewModel" }; Caliburn.Micro.ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.AddSubNamespaceMapping("BookManagement.ViewModel", "BookManagement.View"); }
protected override void ConfigureBootstrapper() { base.ConfigureBootstrapper(); var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Caliburn.Micro.Training.Wpf.Views", DefaultSubNamespaceForViewModels = "Caliburn.Micro.Training.Wpf.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
private void ConfigureViewModelLocator() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViewModels = "CallCenter.Client.ViewModels.ViewModels", DefaultSubNamespaceForViews = "CallCenter.Client.WinApp.Views" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); }
public AppBootstrapper() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViewModels = "ViewModel", DefaultSubNamespaceForViews = "View" }; ViewModelLocator.ConfigureTypeMappings(config); ViewLocator.ConfigureTypeMappings(config); Initialize(); }
protected virtual void ConfigureBootstrapper() { var config = new TypeMappingConfiguration { //DefaultSubNamespaceForViews = typeof(ShellView).Namespace, //DefaultSubNamespaceForViewModels = typeof(ShellViewModel).Namespace //UseNameSuffixesInMappings = false }; ViewLocator.AddSubNamespaceMapping("*.ViewModels", "*.Views"); //ViewModelLocator.ConfigureTypeMappings(config); }
public App() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Views", DefaultSubNamespaceForViewModels = "Core.ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); this.Dispatcher.UnhandledException += OnDispatcherUnhandledException; }
protected override void Configure() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "Views", DefaultSubNamespaceForViewModels = "ViewModels" }; ViewLocator.ConfigureTypeMappings(config); ViewModelLocator.ConfigureTypeMappings(config); _DependencyInjector = DependencyInjector.Instance; }
private void LoadRootPage() { var config = new TypeMappingConfiguration { DefaultSubNamespaceForViews = "IE.Mobile.Forms.Views", DefaultSubNamespaceForViewModels = "IE.Mobile.Forms.ViewModels" }; Caliburn.Micro.Xamarin.Forms.ViewLocator.ConfigureTypeMappings(config); Caliburn.Micro.Xamarin.Forms.ViewModelLocator.ConfigureTypeMappings(config); DisplayRootViewFor <PackmanPageViewModel>(); }
protected override void Configure() { LogManager.GetLog = t => new DebugLog(t); var cfg = new TypeMappingConfiguration { DefaultSubNamespaceForViewModels = "Calculator.WPF.ViewModels", DefaultSubNamespaceForViews = "CalculatorWPFApplication.Views", IncludeViewSuffixInViewModelNames = false }; ViewLocator.ConfigureTypeMappings(cfg); ViewModelLocator.ConfigureTypeMappings(cfg); }
/// <summary> /// Configures the View-ViewModel type- and /// namespace mappings. /// </summary> protected override void Configure() { TypeMappingConfiguration map = new TypeMappingConfiguration() { DefaultSubNamespaceForViewModels = "Scrubbler.ViewModels", DefaultSubNamespaceForViews = "Scrubbler.Views" }; ViewLocator.ConfigureTypeMappings(map); ViewLocator.AddSubNamespaceMapping("Scrubbler.ViewModels.ScrobbleViewModels", "Scrubbler.Views.ScrobbleViews"); ViewLocator.AddSubNamespaceMapping("Scrubbler.ViewModels.SubViewModels", "Scrubbler.Views.SubViews"); ViewModelLocator.ConfigureTypeMappings(map); }
static ViewModelLocator() { var configuration = new TypeMappingConfiguration(); #if ANDROID configuration.DefaultSubNamespaceForViews = "Activities"; configuration.ViewSuffixList.Add("Activity"); configuration.IncludeViewSuffixInViewModelNames = false; #elif IOS configuration.DefaultSubNamespaceForViews = "ViewControllers"; configuration.ViewSuffixList.Add("ViewController"); configuration.IncludeViewSuffixInViewModelNames = false; #endif ConfigureTypeMappings(configuration); }
public void ConfigureTypeMappingsWithDefaultValuesShouldNotThrow() { var typeMappingConfiguration = new TypeMappingConfiguration(); Assert.DoesNotThrow(() => ViewLocator.ConfigureTypeMappings(typeMappingConfiguration)); }