protected override void OnCreate(Bundle bundle)
        {
            //initialising shared project variables
            App.screenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
            App.screenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
            App.cameraAccessGranted = true;

            base.OnCreate(bundle);

            //initialising the resolver for the devices camera
            //used in the CameraViewModel class for cross-platform
            //camera functionality
            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            global::Xamarin.Forms.Forms.Init(this, bundle);
            global::Xamarin.FormsMaps.Init (this, bundle);
            LoadApplication(new App());
        }
 public void RegisterDependencies(SimpleContainer container)
 {
     container.Register<DefaultController>();
     container.Register<QuotesController>();
     container.Register<IClock, Clock>();
     container.Register<IQuotesRepository, QuotesRepository>();
 }
Exemple #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/Arial-Rounded-MT-Bold.ttf");

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

            MR.Gestures.Android.Settings.LicenseKey = "6XZT-V54J-73E4-4VK8-RFAJ-ZBS8-Q8UB-Y3W7-BSGP-FETM-EYQ9-QEPP-WRTA";
            CachedImageRenderer.Init ();

            //Necessary IOC Code To Get Device Properties
            var container = new SimpleContainer ();
            container.Register<IDevice> (t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay> (t => t.Resolve<IDevice> ().Display);
            if( !Resolver.IsSet )
                Resolver.SetResolver (container.GetResolver ());

            // Initialize the parse bluemart client
            try
            {
                ParseClient.Initialize("EUDL8rKwCc1JcL8tw5KsW1QB9ePSGx2dSBTobbE5","PNOG7XhRV8tuB907fQ0S0b5ShaIzYN0wVPZ3AyoN");
            }
            catch(ParseException e) {
                Log.Warn("BlueMart",e.Message.ToString());
            }

            LoadApplication (new App ());
        }
Exemple #4
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init ();
            Xamarin.FormsMaps.Init ();
            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            MR.Gestures.iOS.Settings.LicenseKey = "6XZT-V54J-73E4-4VK8-RFAJ-ZBS8-Q8UB-Y3W7-BSGP-FETM-EYQ9-QEPP-WRTA";
            CachedImageRenderer.Init ();

            //ImageService.Initialize(
            //Necessary IOC Code To Get Device Properties
            var container = new SimpleContainer ();
            container.Register<IDevice> (t => AppleDevice.CurrentDevice);
            container.Register<IDisplay> (t => t.Resolve<IDevice> ().Display);
            if( !Resolver.IsSet )
                Resolver.SetResolver (container.GetResolver ());

            // Initialize the parse bluemart client
            try
            {
                ParseClient.Initialize("EUDL8rKwCc1JcL8tw5KsW1QB9ePSGx2dSBTobbE5","PNOG7XhRV8tuB907fQ0S0b5ShaIzYN0wVPZ3AyoN");
            }
            catch(ParseException e) {
                //Log.Warn("BlueMart",e.Message.ToString());
            }

            LoadApplication (new App ());

            return base.FinishedLaunching (app, options);
        }
        //
        // 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 app, NSDictionary options)
        {
            //initialising shared project variables
            App.screenWidth = (int)UIScreen.MainScreen.Bounds.Width;
            App.screenHeight = (int)UIScreen.MainScreen.Bounds.Height;
            App.cameraAccessGranted = true;

            //initialising the resolver for the devices camera
            //used in the CameraViewModel class for cross-platform
            //camera functionality
            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AppleDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            global::Xamarin.Forms.Forms.Init();
            global::Xamarin.FormsMaps.Init();
            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IDevice>(r => AndroidDevice.CurrentDevice);
            resolverContainer.Register<MainViewModel>(r => new MainViewModel(r.Resolve<IDevice>()));

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

			resolverContainer.Register<IDevice>(r => WindowsPhoneDevice.CurrentDevice);
			resolverContainer.Register<MainViewModel>(r => new MainViewModel(r.Resolve<IDevice>()));

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

			Resolver.SetResolver(resolverContainer.GetResolver());
		}
        private ISimpleContainer BuildContainer()
        {
            var container = new SimpleContainer();
            container.Singleton<IDocumentExecuter>(new DocumentExecuter());
            container.Singleton<IDocumentWriter>(new DocumentWriter(true));

            container.Singleton(new StarWarsData());
            container.Register<StarWarsQuery>();
            container.Register<HumanType>();
            container.Register<DroidType>();
            container.Register<CharacterInterface>();
            container.Singleton(new StarWarsSchema(type => (GraphType) container.Get(type)));

            return container;
        }
Exemple #9
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();
        }
Exemple #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            ToastNotificatorImplementation.Init();

            EventProvider.ContentResolver = ContentResolver;
            DependencyService.Register<EventProvider> ();
            DependencyService.Register<EventNotification> ();
            DependencyService.Register<Geolocator> ();

            if (!Resolver.IsSet) {
                var documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                var pathToDatabase = Path.Combine(documents, "xforms.db");

                var resolverContainer = new SimpleContainer();
                var serializer = new SystemJsonSerializer();

                resolverContainer
                    .Register<IJsonSerializer> (t => serializer)
                    .Register<IRestClient>(new JsonRestClient(serializer))
                    .Register<ISimpleCache> (
                    t => new SQLiteSimpleCache (new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid (),
                        new SQLite.Net.SQLiteConnectionString (pathToDatabase, true), t.Resolve<IJsonSerializer> ()));

                Resolver.SetResolver(resolverContainer.GetResolver());
            }

            LoadApplication (new App ());
        }
Exemple #11
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());
		}
Exemple #12
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 app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            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<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());
            LoadApplication(new App());
            return base.FinishedLaunching(app, options);
        }
Exemple #13
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 ();
        }
Exemple #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var resolverContainer = new SimpleContainer();

            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<IAdvancedTimer>(t => new AdvancedTimer.Forms.Plugin.Droid.AdvancedTimerImplementation());
                //.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());

            global::Xamarin.Forms.Forms.Init(this, bundle);
            AdvancedTimer.Forms.Plugin.Droid.AdvancedTimerImplementation.Init();
            LoadApplication(new App());
        }
        /// <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;
        }
Exemple #16
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());
		}
        //
        // 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 app, NSDictionary options)
        {
            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AppleDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            CrossPushNotification.Initialize<CrossPushNotificationListener>();

            return base.FinishedLaunching(app, options);
        }
        private void IoC()
        {
            var resolverContainer = new SimpleContainer();

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

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

            resolverContainer.Register<IGeolocator, Geolocator>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Exemple #20
0
        private void SetupIoc()
        {
            var container = new SimpleContainer();

            //Register services
            container.Register<ISettingsService, SettingsService>();
            container.Register<IHttpService>(r =>
            {
                var settings = r.Resolve<ISettingsService>();
                return new HttpService(settings.SmartAppUrl, settings.AccessToken);
            });
            container.Register<ITemperatureDevicesService>(r => new TemperatureDevicesService(r.Resolve<IHttpService>()));
            container.Register<ISwitchDevicesService>(r => new SwitchDevicesService(r.Resolve<IHttpService>()));

            //Register ViewModels
            container.Register<MainViewModel>(r => new MainViewModel(r.Resolve<ITemperatureDevicesService>()));

            Resolver.SetResolver(container.GetResolver());
        }
Exemple #21
0
        private void SetIoc()
        {
            if (Resolver.IsSet) return;

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IJsonSerializer, JsonSerializer>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //Needed for Camera
            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            global::Xamarin.Forms.Forms.Init(this, bundle);
            CrossPushNotification.Initialize<CrossPushNotificationListener>("154440120942");

            LoadApplication(new App());
        }
        //<summary>
        //Set the Inversion of Control
        //</summary>
        private static void SetIoC()
        {
            // Create the container
            var container = new SimpleContainer();

            // Dependecy container
            container.Register<IDependencyContainer>(t => container);

            // Resolve the container
            Resolver.SetResolver(container.GetResolver());
        }
Exemple #24
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<IJsonSerializer, JsonSerializer>().Register<IDependencyContainer>(resolverContainer).Register<IXFormsApp>(app);

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

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

            resolverContainer.Register<IXFormsApp> (app);

            Resolver.SetResolver (resolverContainer.GetResolver ());
        }
Exemple #26
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());
        }
Exemple #27
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());
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            #region Resolver Init

            SimpleContainer container = new SimpleContainer();
            container.Register<IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register<IDisplay>(t => t.Resolve<IDevice>().Display);
            container.Register<INetwork>(t => t.Resolve<IDevice>().Network);
            container.Register<ISQLite>(typeof(SQLiteAndroid));

            Resolver.SetResolver(container.GetResolver());
            #endregion

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

            SetStatusBarColor ();

            LoadApplication(new App());
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var web = new HybridWebViewRenderer();

            var container = new SimpleContainer();

            container.Register<IJsonSerializer, JsonSerializer>();
            container.Register<IDevice>(AppleDevice.CurrentDevice);

            Resolver.SetResolver(container.GetResolver());

            global::Xamarin.Forms.Forms.Init();

            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }
Exemple #30
0
        /// <summary>
        /// Sets the io container.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IDevice>(t => AndroidDevice.CurrentDevice)
                .Register<IAccelerometer>(t => t.Resolve<IDevice>().Accelerometer)
                .Register<IDisplay>(t => t.Resolve<IDevice>().Display)
                .Register<INetwork>(t => t.Resolve<IDevice>().Network)
                .Register<IGeolocator, Geolocator>()
                .Register<IDependencyContainer>(resolverContainer);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Exemple #31
0
        private void SetIoc()
        {
            if (!Resolver.IsSet)
            {
                var resolverContainer = new SimpleContainer();

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

                Resolver.SetResolver(resolverContainer.GetResolver());
            }
        }
Exemple #32
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            //TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

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

            // New Xlabs
            var container = new SimpleContainer();

            container.Register <IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register <IGeolocator, Geolocator>();
            Resolver.SetResolver(container.GetResolver()); // Resolving the services
            // End new Xlabs


            FormsMaps.Init(this, bundle);
            ImageCircleRenderer.Init();

            LoadApplication(new App());
        }
        //
        // 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 uiApplication, NSDictionary launchOptions)
        {
            container.Register <IQuoteLoader, QuoteLoader>();
            container.Register <ITextToSpeech, TextToSpeechService>();
            container.Create <QuoteManager>();

            ServiceLocator.Instance.Add <ITextToSpeech, TextToSpeechService>();

            global::Xamarin.Forms.Forms.Init();

            LoadApplication(new App());

            //var quoteLoader = new QuoteLoader();
            //GreatQuotesViewModel = new MainViewModel(() => quoteLoader.Save(GreatQuotesViewModel.Quotes)) {
            //    Quotes = new ObservableCollection<GreatQuoteViewModel>(quoteLoader.Load())
            //};

            //global::Xamarin.Forms.Forms.Init();
            //var app = new App(GreatQuotesViewModel);
            //LoadApplication(app);

            return(base.FinishedLaunching(uiApplication, launchOptions));
        }
        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());
        }
Exemple #35
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            var container = new SimpleContainer();

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

            try
            {
                Xamarin.Forms.DependencyService.Register <EduHttpClient>();
                DependencyService.Register <MediaPicker>();
                Resolver.SetResolver(container.GetResolver());
                //global::Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental");
            }
            catch
            {
            }
            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
        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());
        }
Exemple #37
0
        static Locator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
            var navigation        = new NavigationService();
            var resolverContainer = new SimpleContainer();

            navigation.Configure(Locator.GeneratePassCode, typeof(GenerateQRPage));
            navigation.Configure(Locator.HomePage, typeof(HomePage));
            navigation.Configure(Locator.SubMenu, typeof(SubMenu));
            navigation.Configure(Locator.CreateActivityPage, typeof(CreateActivityPage));
            SimpleIoc.Default.Register(() => navigation);
            resolverContainer.Register <IDisplay>(t => t.Resolve <IDevice>().Display);
            Resolver.SetResolver(resolverContainer.GetResolver());
            Device = Resolver.Resolve <IDevice>();
        }
Exemple #38
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            global::Xamarin.Forms.Forms.Init();
            OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init();

            var container = new SimpleContainer();

            container.Register <IDevice>(t => AppleDevice.CurrentDevice);
            Resolver.SetResolver(container.GetResolver());

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Exemple #39
0
        protected override void OnCreate(Bundle bundle)
        {
            //TabLayoutResource = Resource.Layout.Tabbar;
            //ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            var container = new SimpleContainer();

            container.Register <IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register <IDependencyContainer>(container);
            Resolver.SetResolver(container.GetResolver());

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

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(Android.Graphics.Color.White);
            }

            LoadApplication(new App());
        }
Exemple #40
0
        /// <summary>
        /// Sets Inversion of Control.
        /// </summary>
        private void SetIoC()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppWP();

            app.Init(this);

            resolverContainer.Register(t => WindowsPhoneDevice.CurrentDevice)
            .Register <IDependencyContainer>(t => resolverContainer)
            .Register <IXFormsApp>(app)
            .Register <IGeolocator, Geolocator>()
            .Register <IMediaPicker, MediaPicker>();
            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Exemple #41
0
        protected override void OnCreate(Bundle bundle)
        {
            //Window.RequestFeature(WindowFeatures.ActionBar);
            base.OnCreate(bundle);
            Forms.Init(this, bundle);

            FormsAppCompatActivity.ToolbarResource   = Resource.Layout.toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;

            #region Resolver Init
            SimpleContainer container = new SimpleContainer();
            container.Register <IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register <IDisplay>(t => t.Resolve <IDevice>().Display);
            container.Register <INetwork>(t => t.Resolve <IDevice>().Network);

            Resolver.SetResolver(container.GetResolver());
            #endregion

            CachedImageRenderer.Init();

            UserDialogs.Init(this);

            LoadApplication(new App());
        }
Exemple #42
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

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


            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Exemple #43
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 <IXFormsApp>(app);

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
        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());
        }
Exemple #45
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 app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            //INICIANDO RESOLVER PARA PEGAR DETALHES DA TELA
            var resolverContainer = new SimpleContainer();

            Resolver.ResetResolver();
            resolverContainer.Register <IDevice>(t => AppleDevice.CurrentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());

            //App.ScreenWidth = (int)UIScreen.MainScreen.Bounds.Width;
            //App.ScreenWHeight = (int)UIScreen.MainScreen.Bounds.Height;
            LoadApplication(new App(new iOSInitializer()));

            return(base.FinishedLaunching(app, options));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.SetTheme(Resource.Style.MainTheme);
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            var container = new SimpleContainer();

            container.Register(CrossConnectivity.Current);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            UserDialogs.Init(this);
            LoadApplication(new App());
        }
Exemple #47
0
 public static void InitXLabResolver()
 {
     if (!Resolver.IsSet)
     {
         SimpleContainer container = new SimpleContainer();
         container.Register <IDevice>(t => AndroidDevice.CurrentDevice);
         container.Register <IMediaPicker, MediaPicker>();
         container.Register <DTRC.Services.SystemConfig, DTRC.Droid.Services.SystemConfigDroid>();
         container.Register <DTRC.Data.FirebaseInstanceId, DTRC.Droid.Data.FirebaseInstanceId>();
         container.Register <DTRC.Services.Commands.APlayBeepCommand, DTRC.Droid.Services.Commands.PlayBeepCommand>();
         container.Register <DTRC.Services.Commands.ATakePictureCommand, DTRC.Droid.Services.Commands.TakePictureCommand>();
         container.Register <DTRC.Services.Commands.ARecordAudioCommand, DTRC.Droid.Services.Commands.RecordAudioCommand>();
         Resolver.SetResolver(container.GetResolver());
     }
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Add following lines to get extended device information
            //  (replace AndroidDevice with AppleDevice in iOS and WindowsPhoneDevice in WindowsPhone
            var resolverContainer = new SimpleContainer();

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

            App.DeviceName = Settings.Secure.GetString(Application.Context.ContentResolver, Settings.Secure.AndroidId);

            LoadApplication(new App());
        }
Exemple #49
0
        /// <summary>
        /// Sets IOC
        /// </summary>
        private async void SetIoC()
        {
            var resolverContainer = new SimpleContainer();

            //var app = new XFormsAppWP();

            resolverContainer.Register <IDevice>(t => WinRT.CurrentDevice)
            .Register <IDisplay>(t => t.Resolve <IDevice>().Display)
            .Register <IJsonSerializer, Xamarin.Forms.Labs.Services.Serialization.JsonNET.JsonSerializer>()
            .Register <IDependencyContainer>(resolverContainer)
            .Register <Application>(this);
            //.Register<ISimpleCache>(t => new SQLiteSimpleCache(new SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8(),
            //    new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()));


            Resolver.SetResolver(resolverContainer.GetResolver());
        }
Exemple #50
0
        /// <summary>
        /// Sets the IoC.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();
            var app         = new XLabs.Forms.XFormsAppiOS(this);
            var documents   = app.AppDataDirectory;
            var appSettings = new AppSettings();

            resolverContainer.Register <IDevice> (t => global::XLabs.Platform.Device.AppleDevice.CurrentDevice);
            resolverContainer.Register <IDisplay> (t => t.Resolve <IDevice> ().Display);
            resolverContainer.Register <INetwork> (t => t.Resolve <IDevice> ().Network);
            resolverContainer.Register <IApiServices> (t => new ApiServices());
            resolverContainer.Register <XLabs.Platform.Mvvm.IXFormsApp> ((IXFormsApp)app)
            .Register <IDependencyContainer> (t => resolverContainer);
            // register ISimpleCache to Func<IResolver, ISimpleCache>
            // returning a new instance of SQLiteSimpleCache
            // with one of the constructor parameters being resolved by
            // IResolver to previously registered JSON serializer
            string pathToDatabase = Path.Combine(documents, "wubipaws.db");

            resolverContainer.Register <ISimpleCache> (
                t => (XLabs.Caching.ISimpleCache) new SQLiteSimpleCache(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(),
                                                                        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve <IJsonSerializer> ()));

            resolverContainer.Register <IProgressDialog> (new ProgressDialog());

            resolverContainer.Register <IJsonSerializer> (t => new XLabs.Serialization.JsonNET.JsonSerializer());
            resolverContainer.Register <IAppSettings> (t =>
            {
                appSettings.AppBundleResourcePath = NSBundle.MainBundle.BundlePath + "/";
                appSettings.AppDataDirectory      = app.AppDataDirectory;
                appSettings.WebPortalHost         = "https://wubipaws-portal.azurewebsites.net/";
                appSettings.ApiServiceHost        = "https://wubipaws.azurewebsites.net/";

                return(appSettings);
            });

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
        /// <summary>
        /// 依存性の登録を行います。
        /// </summary>
        private static void Register()
        {
            MyContainer = new SimpleContainer();
            MyContainer.Register <FieldContext>(() => new FieldContext());
            MyContainer.Register(() => new MovableSlime());
            MyContainer.Register <UsingSlimeGenerator>(() => new UsingSlimeRandomGenerator());
            MyContainer.Register <NextSlimeGenerator>(() => new NextSlimeRandomGenerator());
            MyContainer.Register(() => new NextSlimeUpdater());
            //MyContainer.Register<CommandReceiver<NativeCommand, FieldContext>, NativeCommandReceiver>(Lifestyle.Singleton);
            //MyContainer.Register<FieldContextReceiver<string>, SimpleTextReceiver>(Lifestyle.Singleton);
            //MyContainer.Register<FieldContextSender<string>, SimpleTextSender>(Lifestyle.Singleton);
            MyContainer.Register <ITimeUpdatable>(() => new TimeElapsedTicksUpdater());
            MyContainer.Register <IBuiltRemainingTimeUpdatable>(() => new BuiltRemainingTimeStableUpdater(1, 3));
            //MyContainer.Register<IFieldContextInitializable>(() => new FieldContextInitializer(), Lifestyle.Singleton);
            MyContainer.Register <ObstructionSlimeSetter>(() => new ObstructionSlimeRandomSetter());

            DiProvider.SetContainer(MyContainer);
            //MyContainer.Verify();
        }
Exemple #52
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            // Add following lines to get extended device information
            //  (replace AndroidDevice with AndroidDevice in Android and WindowsPhoneDevice in WindowsPhone
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IDevice> (t => AppleDevice.CurrentDevice);

            Resolver.SetResolver(resolverContainer.GetResolver());

            App.DeviceName = UIDevice.CurrentDevice.Name;

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Exemple #53
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            if (!Resolver.IsSet)
            {
                var resolverContainer = new SimpleContainer();
                resolverContainer.Register <IDependencyContainer>(resolverContainer);
                Resolver.SetResolver(resolverContainer.GetResolver());

                AddIocDependencies();
            }


            LoadApplication(new BodyReportMobile.Presenter.App());
            ImageCircleRenderer.Init();

            return(base.FinishedLaunching(app, options));
        }
        protected override void OnCreate(Bundle bundle)
        {
            Insights.Initialize("Your API key", this);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();

            var container = new SimpleContainer();

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

            LoadApplication(new App());
        }
Exemple #55
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<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());
        }
Exemple #56
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 app, NSDictionary options)
        {
            var resolverContainer = new SimpleContainer();

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

            Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule());

            global::Xamarin.Forms.Forms.Init();

            FormsPlugin.Iconize.iOS.IconControls.Init();

            LoadApplication(new App());

            //LoadApplication(UXDivers.Gorilla.iOS.Player.CreateApplication(
            //    new UXDivers.Gorilla.Config("Gorilla on WelitonDesktop")));

            return(base.FinishedLaunching(app, options));
        }
Exemple #57
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());
        }
        /// <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;
        }
        /// <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, Xamarin.Forms.Labs.Services.Serialization.JsonNET.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());
        }
Exemple #60
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.tabs;
            ToolbarResource   = Resource.Layout.toolbar;

            base.OnCreate(bundle);

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

            //INICIANDO RESOLVER PARA PEGAR DETALHES DA TELA
            var resolverContainer = new SimpleContainer();

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

            UserDialogs.Init(this);
            //App.ScreenWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
            //App.ScreenWHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
            LoadApplication(new App());
        }