Пример #1
0
        public static void Init(Application androidApp,
                                IStartup startup = null,
                                Action <IServiceCollection> platformBuild = null)
        {
            var callbacks = new ActivityLifecycleCallbacks();

            androidApp.RegisterActivityLifecycleCallbacks(callbacks);
            var context = new AndroidContext(androidApp, callbacks);

            InitPlatform(
                startup,
                services =>
            {
                services.AddSingleton(context);

                services.AddSingleton <IEnvironment, EnvironmentImpl>();
                services.AddSingleton <IConnectivity, ConnectivityImpl>();
                services.AddSingleton <IPowerManager, PowerManagerImpl>();
                services.AddSingleton <IJobManager, JobManager>();
                services.AddSingleton <IRepository, FileSystemRepositoryImpl>();
                services.AddSingleton <IFileSystem, FileSystemImpl>();
                services.AddSingleton <ISerializer, JsonNetSerializer>();
                services.AddSingleton <ISettings, SettingsImpl>();
                platformBuild?.Invoke(services);
            }
                );
        }
 public ShinyTopActivity(Application app)
 {
     this.callbacks = new ActivityLifecycleCallbacks();
     app.RegisterActivityLifecycleCallbacks(this.callbacks);
 }
Пример #3
0
 public AndroidContext(Application app, ActivityLifecycleCallbacks callbacks)
 {
     this.AppContext = app;
     this.callbacks  = callbacks;
 }