示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.tabs;
            ToolbarResource   = Resource.Layout.toolbar;

            var resolverContainer = new SimpleContainer();

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

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

            base.OnCreate(bundle);

            Xamarin.Forms.DependencyService.Register <Custom.AjusteImagem>();
            Xamarin.Forms.DependencyService.Register <Custom.Arquivo>();

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

            ImageCircleRenderer.Init();
            App._LarguraDP = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);

            //FormsPlugin.Iconize.Droid.IconControls.Init(Resource.Id.toolbar, Resource.Id.sliding_tabs);

            LoadApplication(new App(new AndroidInitializer()));
        }
示例#2
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();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            //Se comenta taskscheduler 20200213
            //TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

            //Se configura HockeyApp
            var manager = BITHockeyManager.SharedHockeyManager;

            manager.Configure("ded4af869e434fc3a04cdf3269d86680");
            manager.StartManager();

            DevExpress.Mobile.Forms.Init();

            var 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);
            container.Register <IMediaPicker>(t => t.Resolve <IMediaPicker>());
            Resolver.SetResolver(container.GetResolver());

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
示例#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 ());
        }
示例#4
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());
        }
示例#5
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Popup.Init();

            ImageCircleRenderer.Init();
            Devicehelper.iOSDevice = UIDevice.CurrentDevice;
            AnimationViewRenderer.Init();
            CarouselViewRenderer.Init();
            var manager = BITHockeyManager.SharedHockeyManager;

            manager.Configure(appID);
            manager.StartManager();
            manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
            manager.Authenticator.AuthenticateInstallation();

            var 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());
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            UIRefreshControl.Appearance.TintColor = UIColor.Black;
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            return(base.FinishedLaunching(app, options));
        }
示例#6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);
            Forms.SetTitleBarVisibility(AndroidTitleBarVisibility.Never);//убираем ActionBar

            /*
             *          var resolverContainer = new XLabs.Ioc.SimpleContainer();
             *
             *          resolverContainer.Register(t => AndroidDevice.CurrentDevice)
             *              .Register(t => t.Resolve<IDevice>())
             *              .Register<XLabs.Ioc.IDependencyContainer>(t => resolverContainer)
             *              .Register<IMediaPicker, MediaPicker>()
             *              .Register<IJsonSerializer, IJsonSerializer>();
             */
            var 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.ResetResolver(container.GetResolver());
            // Resolver.SetResolver();
            DependencyService.Register <ToastNotificatorImplementation>();
            ToastNotificatorImplementation.Init(this);
            Xamarin.FormsMaps.Init(this, bundle);
            var width   = Resources.DisplayMetrics.WidthPixels;
            var height  = Resources.DisplayMetrics.HeightPixels;
            var density = Resources.DisplayMetrics.Density;

            // App.ScreenWidth = (width - 0.5f) / density;
            //  App.ScreenHeight = (height - 0.5f) / density;
            LoadApplication(new App());
        }
示例#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 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);
        }
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IMediaPicker>(new MediaPicker());
            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#9
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());

            Xamarin.Forms.DependencyService.Register <Custom.AjusteImagem>();
            Xamarin.Forms.DependencyService.Register <Custom.Arquivo>();

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

            global::Xamarin.Forms.Forms.Init();
            Xamarin.FormsMaps.Init();
            ImageCircleRenderer.Init();
            App._LarguraDP = (int)UIScreen.MainScreen.Bounds.Width;

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

            LoadApplication(new App(new iOSInitializer()));

            return(base.FinishedLaunching(app, options));
        }
        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());
        }
示例#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());
		}
示例#12
0
        /// <summary>
        /// Sets Inversion of Control.
        /// </summary>
        private void SetIoC()
        {
            var resolverContainer = new SimpleContainer();

            var app = new XFormsAppWin();

            app.Init(this);

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

            resolverContainer
            .Register <IDevice>(t => WindowsDevice.CurrentDevice)
            .Register <IDisplay>(t => new Display())
            //.Register<IFontManager>(t => new FontManager(t.Resolve<IDisplay>()))
            //.Register<IEmailService, EmailService>()
            //.Register<IMediaPicker, MediaPicker>()
            .Register <IJsonSerializer, JsonSerializer>()
            .Register <ITextToSpeechService, TextToSpeechService>()
            .Register <IDependencyContainer>(t => resolverContainer)
            .Register <XFormsAppWin>(app)
            .Register <IXFormsApp>(app)
            .Register <ISecureStorage, SecureStorage>()
            //.Register<ICacheProvider>(
            //    t => new SQLiteSimpleCache(new SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8(),
            //        new SQLite.Net.SQLiteConnectionString(pathToDatabase, true), t.Resolve<IJsonSerializer>()))
            ;

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#13
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 ());
        }
示例#14
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));
        }
示例#15
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());
		}
示例#16
0
        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());
        }
        //
        // 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);
        }
        /// <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;
        }
示例#19
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 ();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            // this line is essential to wiring up the toolbar styles defined in ~/Resources/layout/toolbar.axml
            FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar;

            base.OnCreate(savedInstanceState);

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

                UserDialogs.Init(this);
                AddIocDependencies();
            }

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
            //ActionBar.SetIcon(new ColorDrawable(Android.Graphics.Color.Transparent));

            V7Toolbar toolbar = this.FindViewById <V7Toolbar>(Resource.Id.testToolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
            }
        }
        private void SetIoC()
        {
            // Create the container
            var container = new SimpleContainer();

            var app = new XFormsAppWP();

            app.Init(this);
            DependencyService.Register <SecureStorage>();
            DependencyService.Register <Geolocator>();
            //DependencyService.Register<IRestClient>();
            //DependencyService.Register<JsonRestClient>();
            //DependencyService.Register<RestCoreClient>();
            DependencyService.Register <IWinAppMethods>();
            container.Register <IDevice>(t => WindowsPhoneDevice.CurrentDevice)
            .Register <ISecureStorage>(t => new SecureStorage())
            .Register <IGeolocator>(t => new Geolocator())
            .Register <IDependencyContainer>(container)
            .Register <IXFormsApp>(app);

            // Get the version number
            //Definitions.VersionNumber = Package.Current.Id.Version.ToString();


            // Resolve the container
            Resolver.SetResolver(container.GetResolver());

            // After downgrade to 8.0, scale was no longer available in xlabs implementation.
            Definitions.Scale        = Application.Current.Host.Content.ScaleFactor / 100d;
            Definitions.ScreenWidth  = Application.Current.Host.Content.ActualWidth;
            Definitions.ScreenHeight = Application.Current.Host.Content.ActualHeight;
            var integ = 1;
        }
示例#22
0
 /*
  * SessionLive - Initialize the Content view when a session is being resume.
  * @param databaseAccess - The database.
  */
 public SessionLive(Database_Controller databaseAccess)
 {
     InitializeComponent();
     RefreshTime();
     database               = databaseAccess;
     current                = database.GetliveSession();
     selected_project       = database.GetOneProject(current.project);
     selected_task          = database.GetOneTask(current.taskId);
     this.Task_Name.Text    = selected_task.name;
     this.Project_Name.Text = selected_project.name;
     interrupt              = database.GetliveInterrupt();
     if (!Resolver.IsSet)
     {
         var container = new SimpleContainer();
         container.Register <IAccelerometer, Accelerometer>();
         Resolver.SetResolver(container.GetResolver());
     }
     GlobalUtilities.accelerometer          = Resolver.Resolve <IAccelerometer>();
     GlobalUtilities.accelerometer.Interval = AccelerometerInterval.Normal;
     if (interrupt is null)
     {
         Start.Text  = "Pause";
         getlocation = true;
         askLocation();
         accelometeractive = true;
         GlobalUtilities.accelerometer.ReadingAvailable += Accelerometer_ReadingAvailable;
     }
     else
     {
         Start.Text  = "Resume";
         getlocation = false;
         askLocation();
     }
 }
示例#23
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();
        }
        /// <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());
        }
示例#25
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());
        }
示例#26
0
文件: AppDelegate.cs 项目: wsabor/AX
        //
        // 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)
            .Register <IGeolocator>(t => new Geolocator());

            Resolver.SetResolver(resolverContainer.GetResolver());

            Xamarin.Forms.DependencyService.Register <Custom.AjusteImagem>();
            Xamarin.Forms.DependencyService.Register <Custom.Arquivo>();

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

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

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

            LoadApplication(new App());

            CrossPushNotification.Initialize <CrossPushNotificationListener>();

            UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;

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

            return(base.FinishedLaunching(app, options));
        }
示例#27
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());
        }
示例#28
0
        public App()
        {
            InitializeComponent();

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <ILocationService, LocationService>();
            resolverContainer.Register <IImageSearchService, ImageSearchService>();
            resolverContainer.Register <ICarRestService, CarRestService>();
            resolverContainer.Register <SearchPageViewModel>(r => new SearchPageViewModel(r.Resolve <IImageSearchService>(), r.Resolve <ICarRestService>()));

            Resolver.SetResolver(resolverContainer.GetResolver());


            LoadStyles();
            var navPage = new NavigationPage(new CarSearchPage()
            {
                Title = "Auto Pocket"
            })
            {
                BarTextColor = AppColors.AccentTextColor, BarBackgroundColor = AppColors.AccentColor
            };

            //navPage.Tint =
            MainPage = navPage;
        }
示例#29
0
        /// <summary>
        /// Sets the Ioc.
        /// </summary>
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IJsonSerializer, JsonSerializer>();
            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#30
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());
        }
示例#31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FormsAppCompatActivity.ToolbarResource   = Resource.Layout.Toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabbar;

            // iconify init
            Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.MaterialModule());
            FormsPlugin.Iconize.Droid.IconControls.Init();

            // xlabs init
            var 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());

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

            // xamarin plugins init
            ImageCircleRenderer.Init();

            // init gcm client
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            //Call to Register the device for Push Notifications
            GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);

            LoadApplication(new App());
        }
示例#32
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);
        }
        private void SetupIocContainer()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IHud>(t => t.Resolve <IHud>());

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#34
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IGeolocator, Geolocator>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#35
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IGeolocator, Geolocator>();
            resolverContainer.Register(t => AndroidDevice.CurrentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());
        }
        private void IoC()
        {
            var resolverContainer = new SimpleContainer();

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

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#37
0
 private void InitializeDevice()
 {
     if (!Resolver.IsSet)
     {
         var resolver = new SimpleContainer().Register <IDevice>(device => AndroidDevice.CurrentDevice);
         Resolver.SetResolver(resolver.GetResolver());
     }
 }
示例#38
0
        private IDevice ResolveDevice(IDevice currentDevice)
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IDevice>(t => currentDevice);
            Resolver.SetResolver(resolverContainer.GetResolver());
            return(Resolver.Resolve <IDevice>());
        }
        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 <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 => AndroidDevice.CurrentDevice);
            resolverContainer.Register<MainViewModel>(r => new MainViewModel(r.Resolve<IDevice>()));

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

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

			Resolver.SetResolver(resolverContainer.GetResolver());
		}
示例#43
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

            resolverContainer.Register <IDevice>(r => AndroidDevice.CurrentDevice);
            resolverContainer.RegisterSingle <IPayPalApiClient, PayPalApiClient>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#44
0
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer();

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

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#45
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = new CultureInfo("da-DK");

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = false;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            var app = new XFormsAppWP();

            app.Init(this);

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

            var container = new SimpleContainer();

            container.Register(t => WindowsPhoneDevice.CurrentDevice)
            .Register(t => t.Resolve <IDevice>().Display)
            .Register <IByteSerializer, JsonSerializer>()
            .Register <IDependencyContainer>(t => container)
            .Register <IXFormsApp>(app);
            container.Register <ISimpleCache>(resolver => new SQLiteSimpleCache(
                                                  new SQLitePlatformWP8(),
                                                  new SQLiteConnectionString(pathToDatabase, true),
                                                  resolver.Resolve <IByteSerializer>()));
            Resolver.SetResolver(container.GetResolver());
        }
示例#46
0
        private void SetIoc()
        {
            if (Resolver.IsSet) return;

            var resolverContainer = new SimpleContainer();

            resolverContainer.Register<IJsonSerializer, JsonSerializer>();

            Resolver.SetResolver(resolverContainer.GetResolver());
        }
示例#47
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());
        }
        //<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());
        }
        private void SetIoc()
        {
            var resolverContainer = new SimpleContainer ();

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

            resolverContainer.Register<IXFormsApp> (app);

            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());
		}
示例#51
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());
        }
示例#52
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());
        }
示例#53
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());
        }
		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());
		}
		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());
			}
		}
        //
        // 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 SetIoc()
        {
            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, Services.Serialization.SystemJsonSerializer>()
                .Register<ITextToSpeechService, TextToSpeechService>()
                .Register<IEmailService, EmailService>()
                .Register<IMediaPicker, MediaPicker>()
                .Register<ISecureStorage, SecureStorage>()
                .Register<IPickerEventHandlerSetter>(t => new PickerEventHandlerSetteriOS())
                .Register<IDependencyContainer>(t => resolverContainer);

            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());
        }
示例#59
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());
        }
        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());
        }