Пример #1
0
        protected override void PrepareViewFirst(Frame rootFrame)
        {
            _container.Instance(rootFrame);
            _container.RegisterNavigationService(rootFrame);
            _events = _container.GetInstance <IEventAggregator>();

            var messages = new GlobalMessagesService();

            _events.Subscribe(messages);
            _container.Instance(messages);
        }
        public static void RegisterSqliteEncryption(ref WinRTContainer container)
        {
            //Initialize the Db directory, including access
            string directoryPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "CryptoCoinLocalData");

            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }

            string dbPath = Path.Combine(directoryPath, $"{AppInformation.AppName}.db3");

            if (!File.Exists(dbPath))
            {
                File.Create(dbPath);
            }

            SQLitePCL.Batteries_V2.Init(); //This is to enforce encryption of the database

            var options = new SQLiteConnectionString(dbPath, false,
                                                     key: SecurityConstants.SQLCipherKey.HashPassword(),
                                                     preKeyAction: db => db.Execute("PRAGMA cipher_default_use_hmac = OFF;PRAGMA hexkey=\"0x0102030405060708090a0b0c0d0e0f10\""),
                                                     postKeyAction: db => db.Execute("PRAGMA kdf_iter = 128000;"));

            try { container.Instance <IDatabase>(new Database(new SQLiteConnection(options))); } catch { } //Register the Sqlite dependency into the iOC Container for dependency injection
        }
Пример #3
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hubb.App.UWP.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.App.UWP.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container.Instance <IGitHubClient>(new GitHubClient(new ProductHeaderValue("hubb-uwp", "1.0.0")));

            container
            .Singleton <IAppNavigationService, AppNavigationService>()
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IRepositoryService, RepositoryService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <RepositorySearchViewModel>();

            Coroutine.Completed += (s, e) =>
            {
                if (e.Error == null)
                {
                    return;
                }

                Debug.Write(e.Error.Message);
            };

            ConventionManager.AddElementConvention <AutoSuggestBox>(AutoSuggestBox.TextProperty, "Text", "QuerySubmitted");
        }
Пример #4
0
        /// <summary>
        /// Overrides of Configure method from <see cref="CaliburnApplication"/>
        /// </summary>
        protected override void Configure()
        {
            _container = new WinRTContainer();
            _container.RegisterWinRTServices();

            _container
            .Instance(new SettingsModel())
#if DEBUG
            .Singleton <ITuServiceProvider, TestTuServiceProvider>();
Пример #5
0
        protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
        {
            // Normally wouldn't need to do this but need the container to be initialised
            Initialize();

            // replace the share operation in the container
            container.UnregisterHandler(typeof(ShareOperation), null);
            container.Instance(args.ShareOperation);

            DisplayRootViewFor <ShareTargetViewModel>();
        }
Пример #6
0
        protected override void Configure()
        {
            _container = new WinRTContainer();

            // make the container available for resolution
            _container.Instance(_container);
            _container.Singleton <App>(); //Register the application PCL dependency first then register all other platform specific dependencies
            _container.PerRequest <IPlayAudio, AudioService>();

            //Local DB Mngr
            string DbPath = System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "IEModule.db");

            DbPath.CreateFileIfNotExists(); //Create the File from the Utilities library

            SQLiteConnection DbConnection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DbPath, false);

            _container.Instance <IDatabase>(new Database(DbPath, DbConnection)); //Register the Sqlite Apis -- This is found in the infrastructure directory

            // TODO: Register any Platform-Specific abstractions here
        }
Пример #7
0
        protected override void Configure()
        {
            _container = new WinRTContainer();

            _container.RegisterWinRTServices();

            _container
            .Instance(_container);

            _container
            .Singleton <XMCM.App>();

            // TODO: Register any Platform Specific abstractions here
        }
Пример #8
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Hubb.App.UWP.Views", "Hubb.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Hubb.Core.ViewModels", "Hubb.App.UWP.Views");

            MessageBinder.SpecialValues.Add("$clickedItem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem);

            container = new WinRTContainer();

            container.RegisterWinRTServices();

            container.Instance <IGitHubClient>(new GitHubClient(new ProductHeaderValue("Hubb", "0.0.1")));
            container.Singleton <IHubbClient, OfflineHubbClient>();
            container.PerRequest <ShellViewModel>();
        }
Пример #9
0
        protected override void Configure()
        {
            _container = new WinRTContainer();
            _container.RegisterInstance(typeof(WinRTContainer), null, _container);
            _container.RegisterInstance(typeof(SimpleContainer), null, _container);

            _container.Singleton <InfusionGames.CityScramble.App>();

            _container.Singleton <IMessageDialogService, UwpDialogService>();
            _container.Singleton <IPlatformAuthenticator, UwpPlatformAuthenticator>();
            _container.Instance <AccountStore>(new UwpAccountStore());
            _container.Singleton <IImageService, UwpImageService>();
            //_container.Singleton<IApplicationService, LocationService>();
            //_container.Singleton<IApplicationService, TouchPushNotificationService>();
            //_container.Singleton<INetworkService, UwpNetworkService>();
        }
Пример #10
0
        protected override void Configure()
        {
            MessageBinder.SpecialValues.Add("$clickeditem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem);

            var gitHubClient = new GitHubClient(
                new ProductHeaderValue("Caliburn.Micro.State", "1.0"),
                new InMemoryCredentialStore(Credentials.Anonymous));

            _container = new WinRTContainer();

            _container.RegisterWinRTServices();

            _container.Instance <IGitHubClient>(gitHubClient);

            _container
            .PerRequest <RepositorySearchViewModel>()
            .PerRequest <RepositoryDetailsViewModel>();
        }
Пример #11
0
        protected override void Configure()
        {
            MessageBinder.SpecialValues.Add("$clickeditem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem);

            var gitHubClient = new GitHubClient(
                new ProductHeaderValue("Caliburn.Micro.State", "1.0"),
                new InMemoryCredentialStore(Credentials.Anonymous));

            _container = new WinRTContainer();

            _container.RegisterWinRTServices();

            _container.Instance<IGitHubClient>(gitHubClient);

            _container
                .PerRequest<RepositorySearchViewModel>()
                .PerRequest<RepositoryDetailsViewModel>();
        }
Пример #12
0
        protected override void Configure()
        {
#if DEBUG
            LogManager.GetLog = type => new CaliburnDebugLogger(type);
#endif

            _container = new WinRTContainer();
            _container.RegisterWinRTServices();

            _container.Singleton <GattInformationProvider>().GetInstance <GattInformationProvider>().Initialize();

            _container.Singleton <InfoManager>();
            _container.Instance(new CommandRunner());
            _container.Singleton <EventTracer>();
            _container.Singleton <CharacteristicSubscriptionService>();
            _container.Singleton <DeviceController>();

            _container.Singleton <CommandPanelViewModel>();

            _container.Singleton <Services.ApplicationSettings>();
            _container.Singleton <ApplicationState>();

            _container
            .PerRequest <MainViewModel>()
            .PerRequest <DeviceShellViewModel>()
            .PerRequest <SettingsViewModel>()
            .PerRequest <SelectDeviceViewModel>()
            .PerRequest <AboutViewModel>();

            _container
            .PerRequest <ICommandFormatter, ReadFormatter>()
            .PerRequest <ICommandFormatter, WriteFormatter>()
            .PerRequest <ICommandFormatter, ReadClientConfigDescriptorFormatter>()
            .PerRequest <ICommandFormatter, WriteClientConfigDescriptorFormatter>()
            .PerRequest <ICommandFormatter, SubscribeFormatter>()
            .PerRequest <ICommandFormatter, UnsubscribeFormatter>()
            .PerRequest <ICommandFormatter, ConnectDeviceFormatter>()
            .PerRequest <ICommandFormatter, DisconnectDeviceFormatter>();

            var tracer = _container.GetInstance <EventTracer>();

            _eventAggregator = _container.GetInstance <IEventAggregator>();
        }
Пример #13
0
        protected override void Configure()
        {
            MarkedUp.AnalyticClient.Initialize("5809dd47-4d72-4c1e-b125-c7272bfc149d");

            container = new WinRTContainer();

            container
            .Instance(container);

            container
            .Singleton <IEventAggregator, EventAggregator>()
            .Singleton <IPlayHistoryService, PlayHistoryService>()
            .Singleton <IApplicationSettingsService, ApplicationSettingsService>();

            container
            .PerRequest <MediaHubViewModel>()
            .PerRequest <BrowseFolderViewModel>()
            .PerRequest <SearchResultsViewModel>()
            .PerRequest <AboutViewModel>()
            .PerRequest <PrivacyPolicyViewModel>()
            .PerRequest <PlayHistoryViewModel>();

            var settings = container.RegisterSettingsService();

            settings.RegisterFlyoutCommand <AboutViewModel>(Strings.SettingsAbout);
            settings.RegisterFlyoutCommand <PrivacyPolicyViewModel>(Strings.SettingsPrivacyPolicy);


            ApplicationData.Current.SetVersionAsync(1, async r =>
            {
                if (r.CurrentVersion == 0 && r.DesiredVersion == 1)
                {
                    var deferral = r.GetDeferral();

                    var playHistory = container.GetInstance <IPlayHistoryService>();

                    await playHistory.MigrateToDictionaryAsync();

                    deferral.Complete();
                }
            });
        }
Пример #14
0
        private void RegisterServices()
        {
            _container            = new WinRTContainer();
            _container.Activated += TryRegister;
            _container.RegisterWinRTServices();

            _container
            .AssemblyContainingType <MainViewModel>()
            .RegisterViewModels();

            _container.Instance(AutoMaps.Initialize());
            _container.Singleton <ICacheService, CacheService>();
            _container.Singleton <IFilePickerService, FilePickerService>();
            _container.Singleton <IRegisteredDbsService, RegisteredDbsService>();

            _container.PerRequest <IEntrySubViewModel, EntryDetailsViewModel>();
            _container.PerRequest <IEntrySubViewModel, EntryNotesViewModel>();
            _container.PerRequest <IEntrySubViewModel, EntryAttachmentsViewModel>();
            _container.PerRequest <IEntrySubViewModel, EntryFieldsViewModel>();
        }
Пример #15
0
        protected override void Configure()
        {
            ViewModelLocator.AddNamespaceMapping("Spending.App.Windows.Views", "Spending.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Spending.Core.ViewModels", "Spending.App.Windows.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container
            .Instance <IMobileServiceClient>(new MobileServiceClient("https://spending.azurewebsites.net"));

            container
            .Singleton <IAuthenticationService, AuthenticationService>()
            .Singleton <IApplicationNavigationService, ApplicationNavigationService>()
            .Singleton <IExpenseService, ExpenseService>()
            .Singleton <INotificationsService, NotificationsService>();

            container
            .PerRequest <LoginViewModel>()
            .PerRequest <CurrentExpensesViewModel>()
            .PerRequest <AddExpenseViewModel>();
        }
Пример #16
0
        protected override void Configure()
        {
            ConfigureTitleBar();

            ViewModelLocator.AddNamespaceMapping("Demo.App.Views", "Demo.Core.ViewModels");
            ViewLocator.AddNamespaceMapping("Demo.Core.ViewModels", "Demo.App.Views");

            container = new WinRTContainer();
            container.RegisterWinRTServices();

            container.Singleton <ISettingsService, StorageSettingsService>();
            container.Singleton <IRepositoryService, RepositoryService>();
            container.Singleton <IIssuesService, IssuesService>();

            container.Instance(CreateClient());

            container
            .ViewModel <ShellViewModel>()
            .ViewModel <MenuViewModel>()
            .ViewModel <RepositoryDetailsViewModel>()
            .ViewModel <IssuesListViewModel>();
        }
Пример #17
0
 protected override void PrepareViewFirst(Frame rootFrame)
 {
     _container.Instance <INavigationServiceExtensions>(new CryptoCoinNavigationAdapter(rootFrame));
 }