Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public static void Save()
 {
     quoteLoader.Save(Quotes);
 }