Example #1
0
        private SmartResolver CreateResolver(IComponentProvider provider)
        {
            var config = new ResolverConfig()
                         .UseAutoBinding()
                         .UseArrayBinding()
                         .UseAssignableBinding()
                         .UsePropertyInjector()
                         .UsePageContextScope();

            config.UseXamarinFormsComponents(adapter =>
            {
                adapter.AddDialogs();
                adapter.AddPopupNavigator();
                adapter.AddJsonSerializer();
                adapter.AddSettings();

                // Custom
                adapter.UsePopupPageFactory <PopupPageFactory>();
            });

            config.BindSingleton <INavigator>(_ => navigator);

            config.BindSingleton <ApplicationState>();

            config.BindSingleton <Configuration>();
            config.BindSingleton <Session>();

            config.BindSingleton <IAttachableBarcodeReader, AttachableEntryBarcodeReader>();

            provider.RegisterComponents(config);

            return(config.ToResolver());
        }
Example #2
0
        public App(IComponentProvider provider)
        {
            InitializeComponent();

            var config = new ResolverConfig();

            RegisterComponents(config);
            provider.RegisterComponents(config);
            Resolver = config.ToResolver();

            MainPage = new NavigationPage {
                BarBackgroundColor = (Color)Resources["MetroBlueDark"]
            };

            var navigationService = Resolver.Get <INavigator>();

            navigationService.ForwardAsync("/LoginPage");
        }
Example #3
0
        private SmartResolver CreateResolver(IComponentProvider provider)
        {
            var config = new ResolverConfig()
                         .UseAutoBinding()
                         .UseArrayBinding()
                         .UseAssignableBinding()
                         .UsePropertyInjector()
                         .UsePageContextScope();

            config.UseXamarinFormsComponents(adapter =>
            {
                adapter.AddDialogs();
                adapter.AddPopupNavigator();
                adapter.AddJsonSerializer();
                adapter.AddSettings();
            });

            config.BindSingleton <INavigator>(_ => navigator);

            config.BindSingleton <ApplicationState>();

            config.BindSingleton <IMapper>(new Mapper(new MapperConfiguration(c =>
            {
                c.AddProfile <MappingProfile>();
            })));

            config.BindSingleton <Configuration>();
            config.BindSingleton <Session>();

            config.BindSingleton(new DataServiceOptions
            {
                Path = Path.Combine(FileSystem.AppDataDirectory, "Mobile.db")
            });
            config.BindSingleton <DataService>();
            config.BindSingleton <NetworkService>();

            config.BindSingleton <NetworkOperator>();

            config.BindSingleton <SampleUsecase>();

            provider.RegisterComponents(config);

            return(config.ToResolver());
        }