private static void SetUpServiceProvider(IPlatformHelper platformHelper) { if (platformHelper == null) { throw new ArgumentNullException(nameof(platformHelper)); } var logFileLocation = Path.Combine(platformHelper.LogFolderPath, string.Format("_EFCoreCPTest_{0}.log", platformHelper.PlatformName)); var loggerFactory = new LoggerFactory(); loggerFactory.AddDebug(LogLevel.Trace); loggerFactory.AddFile(logFileLocation, append: false); var logger = loggerFactory.CreateLogger("EFCoreCPTest"); logger.LogTrace("AppCommon.SetUpServiceProvider() called and default logger created"); logger.LogTrace("Creating the ServiceCollection instance"); var serviceCollection = new ServiceCollection() .AddSingleton <ILoggerFactory>(loggerFactory) .AddSingleton(logger) .AddSingleton(platformHelper) .AddLogging(); logger.LogTrace("Building the ServiceProvider instance"); ServiceProvider = serviceCollection.BuildServiceProvider(); logger.LogTrace("AppCommon.SetUpServiceProvider() returning"); }
private ImageEditor() { IPlatformHelper platform = DependencyService.Get <IPlatformHelper>(); if (!(platform?.IsInitialized ?? false)) { throw new Exception("BitooBitImageEditor must be initialized on the platform"); } }
/// <summary> /// Creates an instance of Engine for the current platform /// </summary> /// <returns></returns> public static Engine CreateEngine() { // Chooses one of the standard platform helpers. IPlatformHelper platform = null; #if WINDOWS_PHONE platform = new WinPhonePlatformHelper(); #elif __ANDROID__ platform = new AndroidPlatformHelper(null); #elif __IOS__ platform = new iOSPlatformHelper(); #else platform = new DefaultPlatformHelper() #endif // Creates a new Engine for the platform. return(new Engine(platform)); }
internal GWS( Cartridge cart, Character player, IPlatformHelper platformHelper, LuaDataFactory dataFactory) { this._dataFactory = dataFactory; this._cartridgeEntity = cart; this._cartridge = (LuaDataContainer)cart.DataContainer; this._player = (LuaDataContainer)player.DataContainer; this._platformHelper = platformHelper; ZonePoint pos = player.ObjectLocation; this._latitude = pos.Latitude; this._longitude = pos.Longitude; this._altitude = pos.Latitude; }
public static void Init() { #if __IOS__ || __ANDROID__ PlatformHelper = new PlatformHelper(); #endif }
/// <summary> /// Set the platform helper to use. /// </summary> /// <param name="helper">The helper</param> public static void SetHelper(IPlatformHelper helper) { _helper = helper; }
public static void SetUpMain(IPlatformHelper platformHelper) { SetUpServiceProvider(platformHelper); platformHelper.InstallDatabaseResources(); }