public async override void OnBackPressed()
        {
            _sourceListAdapter.StopTimer();

            if (_sourceListAdapter.IsDataChanged)
            {
                IEnumerable <PortableBaseSource> objectSources
                    = PortableObjectRepository <Activity> .GetObjectSources();

                await PortableSourceRepository.SaveSourceDataAsync
                (
                    objectSources,
                    AndroidCrapApplication.ApplicationLogger
                );

                await PortableObjectRepository <Activity> .RefreshObjectCacheAsync
                (
                    AndroidCrapApplication.ApplicationLogger,

                    updateCount : (objectCount) => { }
                );
            }

            base.OnBackPressed();
        }
Example #2
0
        /*public override void OnTrimMemory
         * (
         *  [GeneratedEnum] TrimMemory level
         * )
         * {
         *  base.OnTrimMemory(level);
         * }*/

        public override void OnCreate()
        {
            //ApplicationLogger.LogDebug("MEMORY 0 : {0}",
            //                           GC.GetTotalMemory(false));
            base.OnCreate();

            //ApplicationLogger.LogDebug("MEMORY 1 : {0}",
            //                           GC.GetTotalMemory(false));

            UnhandledExceptionHandler.Activate();

            CreateBitmapCache();

            RegisterActivityLifecycleCallbacks(new ActivityLifecycleCallbacks());

            PortableObjectRepository <Activity> .RegisterPlatformSpecific
            (
                getUiContext : () => { return(CurrentActivity); },

                showExceptionAndExit : (activity,
                                        exception) => ShowExceptionAndExit(activity,
                                                                           exception),
                fileObjectDescriber : new DefaultFileDescriber(),

                objectLoadingTask : AndroidObjectRepository.LoadAndroidObjectsAsync
            );

            PortableSourceRepository.RegisterPlatformSpecific
            (
                sourceReaderFactory: AndroidSourceRepository.CreateSourceReader,

                sourceWriterFactory: AndroidSourceRepository.CreateSourceWriter
            );

            //ApplicationLogger.LogDebug("MEMORY 2 : {0}",
            //                           GC.GetTotalMemory(false));
        }