Пример #1
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            var documents      = app.AppDataDirectory;
            var pathToDatabase = Path.Combine(documents, "xforms.db");

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IJsonSerializer, XLabs.Serialization.ServiceStack.JsonSerializer>()
            //.Register<IJsonSerializer, Services.Serialization.SystemJsonSerializer>()
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IXFormsApp>(app)
            .Register <ISecureStorage, SecureStorage>()
            .Register <IDependencyContainer>(t => resolverContainer)
            .Register <ISimpleCache>(
                t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(),
                                           new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve <IJsonSerializer>()));

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #2
0
        private void SetIoc()
        {
            Xamarin.Forms.Forms.Init();
            Xamarin.FormsMaps.Init();

            LitePlatform.Initialize(new LitePlatformiOS());

            var app = new XFormsAppiOS();

            app.Init(this);

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IFontManager>(t => new FontManager(t.Resolve <IDisplay>()))
            .Register <IGeolocator>(t => new Geolocator())
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IEmailService, EmailService>()
            .Register <IMediaPicker, MediaPicker>()
            .Register <ISecureStorage, SecureStorage>()
            .Register <IDependencyContainer>(t => resolverContainer);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #3
0
        //  Inversion of control setup
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();
            app.Init(this);
            resolverContainer.Register<IXFormsApp>(app);

            var documents = app.AppDataDirectory;

            // UNEEDED CONTROLS FOR TEST
            //resolverContainer.Register<IGeolocator, Geolocator>();
            //resolverContainer.Register<IEmailService, EmailService>();
            //resolverContainer.Register<IMediaPicker, MediaPicker>();
            //resolverContainer.Register<IDevice>( t => AppleDevice.CurrentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());

            DependencyService.Register<Geolocator> ();

            //resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            //Resolver.SetResolver(resolverContainer.GetResolver());

            //  Startup location services

            Util util = new Util ();
            util.EnableLocationServices ();
        }
Пример #4
0
		/// <summary>
		/// Sets the IoC.
		/// </summary>
		private void SetIoc()
		{
			var resolverContainer = new SimpleContainer();

			var app = new XFormsAppiOS();
			app.Init(this);

			var documents = app.AppDataDirectory;
			var pathToDatabase = Path.Combine(documents, "xforms.db");

			resolverContainer.Register<IDevice>(t => AppleDevice.CurrentDevice)
				.Register<IDisplay>(t => t.Resolve<IDevice>().Display)
				.Register<IFontManager>(t => new FontManager(t.Resolve<IDisplay>()))
				//.Register<IJsonSerializer, XLabs.Serialization.ServiceStack.JsonSerializer>()
				//.Register<IJsonSerializer, Services.Serialization.SystemJsonSerializer>()
				//.Register<ITextToSpeechService, TextToSpeechService>()
				//.Register<IEmailService, EmailService>()
				.Register<IMediaPicker, MediaPicker>()
				.Register<IXFormsApp>(app)
				.Register<ISecureStorage, SecureStorage>()
				.Register<IDependencyContainer>(t => resolverContainer)
				/*.Register<ISimpleCache>(
					t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(),
						new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()))*/;

			Resolver.SetResolver(resolverContainer.GetResolver());
		}
Пример #5
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new global::XLabs.Ioc.SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            var documents      = app.AppDataDirectory;
            var pathToDatabase = Path.Combine(documents, "xforms.db");

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IFontManager>(t => new FontManager(t.Resolve <IDisplay>()))
            .Register <XLabs.Serialization.IJsonSerializer, XLabs.Serialization.JsonNET.JsonSerializer>()
            //.Register<IJsonSerializer, Services.Serialization.SystemJsonSerializer>()
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IEmailService, EmailService>()
            .Register <IMediaPicker, MediaPicker>()
            .Register <IXFormsApp>(app)
            .Register <ISecureStorage, SecureStorage>()
            .Register <global::XLabs.Ioc.IDependencyContainer>(t => resolverContainer);
            //.Register<global::XLabs.Caching.ICacheProvider>(
            //    t => new SQLiteSimpleCache(new SQLitePlatformIOS(),
            //        new SQLiteConnectionString(pathToDatabase, true), t.Resolve<global::XLabs.Serialization.IJsonSerializer>()));

            XLabs.Ioc.Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #6
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();
            app.Init(this);
            resolverContainer.Register<IXFormsApp>(app);

            var documents = app.AppDataDirectory;

            //resolverContainer.Register<IGeolocator, Geolocator>();
            //resolverContainer.Register<IEmailService, EmailService>();
            //resolverContainer.Register<IMediaPicker, MediaPicker>();
            //resolverContainer.Register<IDevice>( t => AppleDevice.CurrentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());

            DependencyService.Register<Geolocator> ();

            //resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            //Resolver.SetResolver(resolverContainer.GetResolver());

            Console.WriteLine ("Here");
            Util util = new Util ();
            util.EnableLocationServices ();

            //manager.AuthorizationChanged += (sender, args) => {
               // Console.WriteLine ("Authorization changed to: {0}", args.Status);
            //};
            //if (UIDevice.CurrentDevice.CheckSystemVersion(8,0))
            //    manager.RequestWhenInUseAuthorization();
        }
Пример #7
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication uiApp, NSDictionary options)
        {
            Forms.Init();
            ToastNotificatorImplementation.Init();
            var myApp = new App();

            LoadApplication(myApp);

            const string sqliteFilename = "Advosys.db3";
            var          documentsPath  = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var          libraryPath    = Path.Combine(documentsPath, "..", "Library");
            var          path           = Path.Combine(libraryPath, sqliteFilename);

            var app = new XFormsAppiOS();

            app.Init(this);

            var container = new SimpleContainer();

            container.Register <IGeolocator, Geolocator>();
            container.Register(t => AppleDevice.CurrentDevice)
            .Register(t => t.Resolve <IDevice>().Display)
            .Register <IByteSerializer, JsonSerializer>()
            .Register <IDependencyContainer>(t => container)
            .Register <IXFormsApp>(app);
            container.Register <ISimpleCache>(resolver => new SQLiteSimpleCache(
                                                  new SQLitePlatformIOS(),
                                                  new SQLiteConnectionString(path, true),
                                                  resolver.Resolve <IByteSerializer>()));
            Resolver.SetResolver(container.GetResolver());

            return(base.FinishedLaunching(uiApp, options));
        }
Пример #8
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var app = new XFormsAppiOS();

            app.Init(this);

            var documents      = app.AppDataDirectory;
            var pathToDatabase = Path.Combine(documents, "RMMT.db");

            var builder = new ContainerBuilder();

            builder.RegisterType <AccountService>().As <IAccountService>();
            builder.RegisterType <NotifiMngService>().As <INotifiMngService>();
            builder.RegisterType <ImproveService>().As <IImproveService>();
            builder.RegisterType <TourService>().As <ITourService>();
            builder.RegisterType <CaseService>().As <ICaseService>();
            builder.RegisterType <CalendarService>().As <ICalendarService>();
            builder.RegisterType <CommonFun_IOS>().As <ICommonFun>();
            builder.RegisterType <FilePickerImplementation>().As <IFilePicker>();
            builder.RegisterType <ReviewPlansService>().As <IReviewPlansService>();
            builder.RegisterType <RemoteService>().As <IRemoteService>();
            builder.RegisterType <LocalScoreService>().As <ILocalScoreService>();
            builder.RegisterType <ReportService>().As <IReportService>();
            #region sqlite
            builder.RegisterType <SqliteRepository <TaskOfPlanDto> >().As <IRepository <TaskOfPlanDto> >();
            builder.RegisterType <SqliteRepository <Distributor> >().As <IRepository <Distributor> >();
            builder.RegisterType <SqliteRepository <LoaclItemOfTaskDto> >().As <IRepository <LoaclItemOfTaskDto> >();
            builder.RegisterType <SqliteRepository <CheckStandard> >().As <IRepository <CheckStandard> >();
            builder.RegisterType <SqliteRepository <StandardPic> >().As <IRepository <StandardPic> >();
            builder.RegisterType <SqliteRepository <PictureStandard> >().As <IRepository <PictureStandard> >();
            builder.RegisterType <SqliteRepository <Score> >().As <IRepository <Score> >();
            builder.RegisterType <SqliteRepository <TaskOfPlan> >().As <IRepository <TaskOfPlan> >();
            builder.RegisterType <SqliteRepository <CheckResult> >().As <IRepository <CheckResult> >();
            builder.RegisterType <SqliteRepository <Domain.StandardPic> >().As <IRepository <Domain.StandardPic> >();
            builder.RegisterType <SqliteRepository <CustomizedTaskDto> >().As <IRepository <CustomizedTaskDto> >();
            builder.RegisterType <SqliteRepository <PlanDto> >().As <IRepository <PlanDto> >();
            builder.RegisterType <SqliteRepository <CustImproveItemDB> >().As <IRepository <CustImproveItemDB> >();
            builder.RegisterType <SqliteRepository <TaskCard> >().As <IRepository <TaskCard> >();
            builder.RegisterType <SqliteRepository <TaskItem> >().As <IRepository <TaskItem> >();
            builder.RegisterType <SqliteRepository <NameValueObject> >().As <IRepository <NameValueObject> >();
            #endregion
            builder.RegisterInstance(new CommonHelper(new Config.Config()));
            builder.RegisterInstance(new Config.Config());
            builder.RegisterType <SQLite_iOS>().As <ISQLite>();
            builder.Register(ctx =>
            {
                return(new AccountInfo());
            });
            //builder.Register<IDevice>(t => AppleDevice.CurrentDevice);

            var container         = builder.Build();
            var resolverContainer = new AutofacContainer(container);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            resolverContainer.Register <IMediaPicker, MediaPicker> ();
            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #10
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer ();

            var app = new XFormsAppiOS ();
            app.Init (this);

            resolverContainer.Register<IXFormsApp> (app);

            Resolver.SetResolver (resolverContainer.GetResolver ());
        }
Пример #11
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();
            app.Init(this);
                resolverContainer.Register<IDevice> (t => AppleDevice.CurrentDevice)
              .Register<IDisplay> (t => t.Resolve<IDevice> ().Display)
                .Register<IXFormsApp> (app);
              Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #12
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();

            resolverContainer.Register(t => AppleDevice.CurrentDevice)
                .Register<IDependencyContainer>(t => resolverContainer)
                .Register<IXFormsApp>(app);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #13
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();
            XFormsAppiOS.Init();

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            window.RootViewController = App.GetMainPage().CreateViewController();
            window.MakeKeyAndVisible();

            return(true);
        }
Пример #14
0
        private void SetIoc()
        {
            var resolverContainer = new global::XLabs.Ioc.SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display);
            XLabs.Ioc.Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #15
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IMediaPicker, MediaPicker>()
            .Register <IDependencyContainer>(t => resolverContainer);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #16
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new global::XLabs.Ioc.SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            var documents = app.AppDataDirectory;

            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IJsonSerializer, XLabs.Serialization.JsonNET.JsonSerializer>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #17
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <INativeOperations, NativeOperations> ();
            resolverContainer.Register <IDevice> (t => AppleDevice.CurrentDevice);
            resolverContainer.Register <IGeolocator, Geolocator>();

            var app = new XFormsAppiOS();

            app.Init(this);
            resolverContainer.Register <IXFormsApp>(app);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Пример #18
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var container = new SimpleContainer();

            var app = new XFormsAppiOS();

            app.Init(this);

            var documents = app.AppDataDirectory;

            container.Register <IDevice>(t => AppleDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IXFormsApp>(app)
            .Register <INetwork>(t => t.Resolve <IDevice>().Network)
            .Register <IGeolocator, Geolocator>()
            .Register <INavigationService, NavigationService>()
            .Register <IDependencyContainer>(t => container);

            Resolver.SetResolver(container.GetResolver());
        }
Пример #19
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppiOS();
            app.Init(this);

            var documents = app.AppDataDirectory;
            var pathToDatabase = Path.Combine(documents, "xforms.db");

            resolverContainer.Register<IDevice>(t => AppleDevice.CurrentDevice)
                .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
                .Register<IJsonSerializer, Services.Serialization.ServiceStackV3.JsonSerializer>()
                .Register<IXFormsApp>(app)
                .Register<IDependencyContainer>(t => resolverContainer)
                .Register<ISimpleCache>(
                    t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(),
                        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));
            
            Resolver.SetResolver(resolverContainer.GetResolver());
        }