示例#1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            BackgroundTaskDeferral _deferral = taskInstance.GetDeferral();

            try
            {
                WhirlPoolAPIClient.LoadConfig();

                await WhirlPoolAPIClient.GetDataAsync(WhirlPoolAPIClient.EWhirlPoolData.wpAll);
            }
            catch (Exception x)
            {
                WhirlPoolAPIClient.ShowErrorToast("MainBackground", x);
            }
            _deferral.Complete();
        }
示例#2
0
        public async void DoRefresh()
        {
            synchronizationContext.Post(new SendOrPostCallback(o =>
            {
                pbNetwork.Visibility      = Visibility.Visible;
                pbNetwork.IsIndeterminate = true;
                bnRefresh.IsEnabled       = false;
            }), null);

            try
            {
                await WhirlPoolAPIClient.GetDataAsync();
            }
            finally
            {
                synchronizationContext.Post(new SendOrPostCallback(o =>
                {
                    pbNetwork.Visibility      = Visibility.Collapsed;
                    pbNetwork.IsIndeterminate = false;
                    bnRefresh.IsEnabled       = true;
                }), null);
            }
        }