protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            var config = new RealmConfiguration()
            {
                SchemaVersion = 25
            };

            containerRegistry.RegisterSingleton <AppSettings>();

            // Register repositories
            containerRegistry.RegisterInstance(Realm.GetInstance(config));
            containerRegistry.Register <IUserRepository, UserRepository>();
            containerRegistry.Register <IUserSettingsRepository, UserSettingsRepository>();
            containerRegistry.Register <ISensorRepository, SensorRepository>();
            containerRegistry.Register <IGlucoseMeasureRepository, GlucoseMeasureRepository>();

            //containerRegistry.RegisterForNavigation<NavigationPage>();
            containerRegistry.RegisterForNavigation <PrismNavigationPage>();
            containerRegistry.RegisterForNavigation <DrivePage, DrivePageViewModel>();

            var eventAggregator = Container.Resolve <IEventAggregator>();
            var appSettings     = Container.Resolve <AppSettings>();

            var glucoseService = new GlucoseService(eventAggregator, Container.Resolve <IUserRepository>(), Container.Resolve <IUserSettingsRepository>(), Container.Resolve <ISensorRepository>(), Container.Resolve <IGlucoseMeasureRepository>(), appSettings);

            containerRegistry.RegisterInstance(glucoseService);
            containerRegistry.RegisterInstance(new MiaoMiaoProtocol(eventAggregator, glucoseService, appSettings));
        }
Esempio n. 2
0
        public MiaoMiaoProtocol(IEventAggregator eventAggregator, GlucoseService glucoseService, AppSettings settings)
        {
            this.GlucoseService  = glucoseService;
            this.EventAggregator = eventAggregator;
            this.settings        = settings;

            this.EventAggregator.GetEvent <MeasureChangeEvent>().Subscribe((value) =>
            {
                ProcessPacket(value);
            });
        }