示例#1
0
        protected override void Configure()
        {
            this.viewSettings = new ViewSettings();
            Locator.CurrentMutable.RegisterConstant(this.viewSettings, typeof(ViewSettings));

            this.coreSettings = new CoreSettings();

            Locator.CurrentMutable.RegisterLazySingleton(() => new Library(new LibraryFileReader(AppInfo.LibraryFilePath),
                                                                           new LibraryFileWriter(AppInfo.LibraryFilePath), this.coreSettings, new FileSystem()), typeof(Library));

            Locator.CurrentMutable.RegisterLazySingleton(() => new WindowManager(), typeof(IWindowManager));

            Locator.CurrentMutable.RegisterLazySingleton(() => new SQLitePersistentBlobCache(Path.Combine(AppInfo.BlobCachePath, "api-requests.cache.db")),
                                                         typeof(IBlobCache), BlobCacheKeys.RequestCacheContract);

            Locator.CurrentMutable.RegisterLazySingleton(() =>
                                                         new ShellViewModel(Locator.Current.GetService <Library>(),
                                                                            this.viewSettings, this.coreSettings,
                                                                            Locator.Current.GetService <IWindowManager>(),
                                                                            Locator.Current.GetService <MobileApiInfo>()),
                                                         typeof(ShellViewModel));

            this.ConfigureLogging();
        }
        protected override void Configure()
        {
            this.viewSettings = new ViewSettings();
            Locator.CurrentMutable.RegisterConstant(this.viewSettings, typeof(ViewSettings));

            this.coreSettings = new CoreSettings();

            Locator.CurrentMutable.RegisterLazySingleton(() => new Library(new LibraryFileReader(AppInfo.LibraryFilePath),
                new LibraryFileWriter(AppInfo.LibraryFilePath), this.coreSettings, new FileSystem()), typeof(Library));

            Locator.CurrentMutable.RegisterLazySingleton(() => new WindowManager(), typeof(IWindowManager));

            Locator.CurrentMutable.RegisterLazySingleton(() => new SQLitePersistentBlobCache(Path.Combine(AppInfo.BlobCachePath, "api-requests.cache.db")),
                typeof(IBlobCache), BlobCacheKeys.RequestCacheContract);

            Locator.CurrentMutable.RegisterLazySingleton(() =>
                new ShellViewModel(Locator.Current.GetService<Library>(),
                    this.viewSettings, this.coreSettings,
                    Locator.Current.GetService<IWindowManager>(),
                    Locator.Current.GetService<MobileApiInfo>()),
                typeof(ShellViewModel));

            this.ConfigureLogging();
        }