public override async void DidEnterBackground(UIApplication application)
        {
            CancellationTokenSource cts = new CancellationTokenSource();

            var taskId = UIApplication.SharedApplication.BeginBackgroundTask(() => cts.Cancel());

            try {
                await Task.Run(() => {
                    quoteLoader.Save(Quotes);
                }, cts.Token);
            }
            catch (Exception ex) {
                Debug.WriteLine(ex.Message);
            }
            finally {
                UIApplication.SharedApplication.EndBackgroundTask(taskId);
            }
        }
Esempio n. 2
0
 public static void Save()
 {
     quoteLoader.Save(Quotes);
 }