private void SetIoc() { //var resolverContainer = new SimpleContainer(); var resolverContainer = new XLabs.Ioc.SimpleContainer(); resolverContainer .Register <XLabs.Platform.Device.IDevice> (t => AndroidDevice.CurrentDevice) .Register <XLabs.Platform.Device.IDisplay> (t => t.Resolve <XLabs.Platform.Device.IDevice> ().Display) //.Register<IMediaPicker>(t => new BearBones.Platform.Services.Media.MediaPicker()) .Register <XLabs.Ioc.IDependencyContainer> (t => resolverContainer); XLabs.Ioc.Resolver.SetResolver(resolverContainer.GetResolver()); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { var container = new XLabs.Ioc.SimpleContainer(); container.Register <IDevice> (t => AppleDevice.CurrentDevice); container.Register <IGeolocator, Geolocator>(); Resolver.SetResolver(container.GetResolver()); global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // init json stream loader JsonLoader.Loader = new StreamLoader(); // init xlabs for geolocator var container = new XLabs.Ioc.SimpleContainer(); // Create SimpleCOntainer container.Register <IDevice>(t => AppleDevice.CurrentDevice); // Register Device container.Register <IGeolocator, Geolocator>(); // Register Geolocator Resolver.SetResolver(container.GetResolver()); // Resolving the services // init xamarin forms and maps global::Xamarin.Forms.Forms.Init(); Xamarin.FormsMaps.Init(); 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) { // New Xlabs var container = new XLabs.Ioc.SimpleContainer(); container.Register<IDevice>(t => AppleDevice.CurrentDevice); container.Register<IGeolocator, Geolocator>(); Resolver.SetResolver(container.GetResolver()); // End new Xlabs new Telerik.XamarinForms.ChartRenderer.iOS.PieChartRenderer(); new Telerik.XamarinForms.ChartRenderer.iOS.CartesianChartRenderer(); new Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer(); new Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewRenderer(); new Telerik.XamarinForms.PrimitivesRenderer.iOS.SideDrawerRenderer(); global::Xamarin.Forms.Forms.Init(); Telerik.XamarinForms.Common.iOS.TelerikForms.Init(); Rg.Plugins.Popup.IOS.Popup.Init(); // Init Popup LoadApplication(new App()); return base.FinishedLaunching(app, options); }
private void SetIoc() { //var resolverContainer = new SimpleContainer(); var resolverContainer = new XLabs.Ioc.SimpleContainer(); resolverContainer.Register <XLabs.Platform.Device.IDevice> (t => AppleDevice.CurrentDevice) .Register <XLabs.Platform.Device.IDisplay> (t => t.Resolve <XLabs.Platform.Device.IDevice> ().Display) .Register <XLabs.Ioc.IDependencyContainer> (t => resolverContainer); XLabs.Ioc.Resolver.SetResolver(resolverContainer.GetResolver()); /* * resolverContainer.Register<IDevice> (t => AppleDevice.CurrentDevice) * .Register<IDisplay> (t => t.Resolve<IDevice> ().Display) * .Register<IDependencyContainer> (t => resolverContainer); */ /* * resolverContainer * .Register<IJsonSerializer, XLabs.Serialization.JsonNET.JsonSerializer>() * .Register<IDependencyContainer>(t => resolverContainer); */ //Resolver.SetResolver(resolverContainer.GetResolver()); }
public static void InitApp(MobileAppEnum appType) { // init XLabs var container = new XLabs.Ioc.SimpleContainer(); container.Register <XLabs.Platform.Device.IDevice>(t => XLabs.Platform.Device.AppleDevice.CurrentDevice); container.Register <XLabs.Platform.Services.Media.IMediaPicker, XLabs.Platform.Services.Media.MediaPicker>(); XLabs.Ioc.Resolver.SetResolver(container.GetResolver()); // forms Init Forms.Init(); Xamarin.FormsMaps.Init(); Refractored.XamForms.PullToRefresh.iOS.PullToRefreshLayoutRenderer.Init(); RoundedBoxView.Forms.Plugin.iOSUnified.RoundedBoxViewRenderer.Init(); // OS version string osVersion; try { osVersion = UIDevice.CurrentDevice.SystemVersion; } catch (Exception) { osVersion = "? exception"; } // what's the device screen height? double deviceScreenHeightInInches; double deviceScreenWidthInInches; try { var device = Resolver.Resolve <IDevice>(); deviceScreenHeightInInches = device.ScreenHeightInches(); deviceScreenWidthInInches = device.ScreenWidthInches(); } catch (Exception) { deviceScreenHeightInInches = 5; deviceScreenWidthInInches = 2; } // is simulator? try { Config.IsSimulator = ObjCRuntime.Runtime.Arch == Arch.SIMULATOR; } catch (Exception) { Config.IsSimulator = false; } // is it a Tablet? bool isTablet = false; Console.WriteLine("AppInitCode - Device.Idiom=" + Device.Idiom.ToString()); Console.WriteLine("AppInitCode - deviceScreenHeightInInches=" + deviceScreenHeightInInches.ToString() + ", deviceScreenWidthInInches=" + deviceScreenWidthInInches.ToString()); if (Device.Idiom == TargetIdiom.Tablet) { isTablet = true; } else if (Device.Idiom == TargetIdiom.Phone) { isTablet = false; } else { isTablet = deviceScreenHeightInInches > 7 || deviceScreenWidthInInches > 7; } // init configuration Config.Init(appType, isTablet, deviceScreenHeightInInches, osVersion); // init services Awpbs.Mobile.App.Files = new Awpbs.Mobile.iOS.Files_iOS(); Awpbs.Mobile.App.KeyChain = new KeyChain_UnsecuredFile(Awpbs.Mobile.App.Files); Awpbs.Mobile.App.ScorePronouncer = new Awpbs.Mobile.iOS.ScorePronouncer_iOS(); Awpbs.Mobile.App.FacebookService = new Awpbs.Mobile.iOS.FacebookService_iOS(); Awpbs.Mobile.App.LocationService = new Awpbs.Mobile.iOS.LocationService_iOS(); Awpbs.Mobile.App.MobileNotificationsService = new Awpbs.Mobile.iOS.MobileNotificationsService_iOS(); // branch init //NSUrl url = null; //if ((options != null) && options.ContainsKey(UIApplication.LaunchOptionsUrlKey)) //{ // url = (NSUrl)options.ValueForKey(UIApplication.LaunchOptionsUrlKey); // Console.WriteLine("AppDelegate.FinishedLaunching"); //} //BranchXamarinSDK.BranchIOS.Init("key_live_iebJ0jOkqjzp4Co7nYiEAhlbEDolNjJe", url); //Branch branch = Branch.GetInstance(); //branch.InitSessionAsync(this); }