コード例 #1
0
ファイル: MainActivity.cs プロジェクト: rygogre/MyTICs
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();



            var app = new XFormsAppDroid();

            // app.Init(this);

            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)

            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app);


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

            //    .Register<IDisplay>(t => t.Resolve<IDevice>().Display)

            //    .Register<IXFormsApp>(app)

            //    .Register<IDependencyContainer>(t => resolverContainer);

            //Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #2
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            //app.Init(this);

            var documents = app.AppDataDirectory;

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

            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IFontManager>(t => new FontManager(t.Resolve <IDisplay>()))
            .Register <IEmailService, EmailService>()
            .Register <IMediaPicker, MediaPicker>()
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app)
            .Register <ISecureStorage>(t => new KeyVaultStorage(t.Resolve <IDevice>().Id.ToCharArray()));


            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #3
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            app.Init(this);

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

            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IJsonSerializer, Services.Serialization.ServiceStackV3.JsonSerializer>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app)
            .Register <ISimpleCache>(
                t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(),
                                           new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve <IJsonSerializer>()));


            Resolver.SetResolver(resolverContainer.GetResolver());

            _initialized = true;
        }
コード例 #4
0
ファイル: MainActivity.cs プロジェクト: codelinguist/Pdia
		/// <summary>
		/// Sets the IoC.
		/// </summary>
		private void SetIoc()
		{
			var resolverContainer = new SimpleContainer();

			var app = new XFormsAppDroid();

			app.Init(this);

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

			resolverContainer.Register<IDevice> (t => AndroidDevice.CurrentDevice)
				.Register<IDisplay> (t => t.Resolve<IDevice> ().Display)
				.Register<IFontManager> (t => new FontManager (t.Resolve<IDisplay> ()))
			//.Register<IJsonSerializer, Services.Serialization.JsonNET.JsonSerializer>()
			//.Register<IJsonSerializer, JsonSerializer>()
			//.Register<IEmailService, EmailService>()
				.Register<IMediaPicker, MediaPicker> ()
			//.Register<ITextToSpeechService, TextToSpeechService>()
				.Register<IDependencyContainer> (resolverContainer)
				.Register<IXFormsApp> (app)
				.Register<ISecureStorage> (t => new KeyVaultStorage (t.Resolve<IDevice> ().Id.ToCharArray ()));
				/*.Register<ISimpleCache>(
					t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
						new SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));*/


			Resolver.SetResolver(resolverContainer.GetResolver());
		}
コード例 #5
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            app.Init(this);

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

            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IFontManager>(t => new FontManager(t.Resolve <IDisplay>()))
            //.Register<IJsonSerializer, Services.Serialization.JsonNET.JsonSerializer>()
            .Register <IJsonSerializer, JsonSerializer>()
            .Register <IEmailService, EmailService>()
            .Register <IMediaPicker, MediaPicker>()
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app)
            .Register <ISecureStorage>(t => new KeyVaultStorage(t.Resolve <IDevice>().Id.ToCharArray()))
            .Register <ISimpleCache>(
                t => new SQLiteSimpleCache(new SQLitePlatformAndroid(),
                                           new SQLiteConnectionString(pathToDatabase, true), t.Resolve <IJsonSerializer>()));


            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #6
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            app.Init(this);

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

            resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice)
                .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
                .Register<IJsonSerializer, Services.Serialization.ServiceStackV3.JsonSerializer>()
                .Register<IDependencyContainer>(resolverContainer)
                .Register<IXFormsApp>(app)
                .Register<ISimpleCache>(
                    t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(),
                        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));


            Resolver.SetResolver(resolverContainer.GetResolver());

            _initialized = true;
        }
コード例 #7
0
ファイル: MainActivity.cs プロジェクト: mogwai/LoudMouth
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            try {
                LoadApplication(new App());

                var container = App.container;
                var device    = AndroidDevice.CurrentDevice;

                if (!Resolver.IsSet)
                {
                    var app = new XFormsAppDroid();
                    app.Init(this);

                    container.Register <IDevice>((arg) => device)
                    .Register <IAudioStream>(t => device.Microphone)
                    .Register <IDisplay>((t) => t.Resolve <IDevice>().Display)
                    .Register <ISoundService>(t => t.Resolve <ISoundService>())
                    .Register <IXFormsApp>(app);

                    Resolver.SetResolver(container.GetResolver());
                }
            } catch (Exception e) {
                System.Diagnostics.Debug.WriteLine(e);
            }
        }
コード例 #8
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();
            var app = new XFormsAppDroid();

            app.Init(this);

            resolverContainer.Register <IMediaPicker, MediaPicker>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #9
0
ファイル: MainActivity.cs プロジェクト: devperson/mgform
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

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

            resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice).Register<IDisplay>(t => t.Resolve<IDevice>().Display).Register<IJsonSerializer, JsonSerializer>().Register<IDependencyContainer>(resolverContainer).Register<IXFormsApp>(app);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #10
0
ファイル: MainActivity.cs プロジェクト: bnroode/training
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

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

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #11
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

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

            resolverContainer
                .Register<IXFormsApp>(app);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #12
0
        private void SetIoC()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            resolverContainer.Register(t => AndroidDevice.CurrentDevice)
            .Register <IDependencyContainer>(t => resolverContainer)
            .Register <IXFormsApp>(app)
            .Register <IGeolocator, Geolocator>()
            .Register <IMediaPicker, MediaPicker>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #13
0
ファイル: MainActivity.cs プロジェクト: Xemmy/healapp-master
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            app.Init(this);
            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            //.Register<IJsonSerializer, Services.Serialization.JsonNET.JsonSerializer>()
            //.Register<IJsonSerializer, XLabs.Serialization.ServiceStack.JsonSerializer>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app);
            //.Register<ISimpleCache>(
            //    t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(),
            //        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
コード例 #14
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            app.Init(this);

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

            Resolver.SetResolver(resolverContainer.GetResolver());

            _initialized = true;
        }
コード例 #15
0
        private void SetIoc()
        {
            var app = new XFormsAppDroid();

            app.Init(this);

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

            var container = new SimpleContainer();

            container.Register(t => t.Resolve <IDevice>().Display)
            .Register <IDependencyContainer>(t => container)
            .Register <IXFormsApp>(app)
            .Register <IByteSerializer, JsonSerializer>();
            container.Register <IGeolocator, Geolocator>();
            container.Register <ISimpleCache>(resolver => new SQLiteSimpleCache(
                                                  new SQLitePlatformAndroid(),
                                                  new SQLiteConnectionString(path, true),
                                                  resolver.Resolve <IByteSerializer>()));
            Resolver.SetResolver(container.GetResolver());
        }
コード例 #16
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppDroid();

            var documents      = Environment.ExternalStorageDirectory.AbsolutePath;
            var pathToDatabase = Path.Combine(documents, "xforms.db");

            //app.Init(this);

            resolverContainer.Register <IDevice>(t => AndroidDevice.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IJsonSerializer, Xamarin.Forms.Labs.Services.Serialization.JsonNET.JsonSerializer>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <IXFormsApp>(app);
            //.Register<ISimpleCache>(t => new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(),
            //    new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));


            Resolver.SetResolver(resolverContainer.GetResolver());

            _initialized = true;
        }