Esempio n. 1
0
 private void MetroWindow_Unloaded(object sender, RoutedEventArgs e)
 {
     if (client != null)
     {
         client.Dispose();
         client = null;
     }
 }
Esempio n. 2
0
 private FalkirkWebClient GetWebClient()
 {
     if (client == null)
     {
         client = new FalkirkWebClient();
         client.DownloadStringCompleted += Client_DownloadStringCompleted;
     }
     return(client);
 }
Esempio n. 3
0
        private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            client.Dispose();
            client = null;

            if (!e.Cancelled && e.Error == null)
            {
                UpdateBins(e.Result);
                StartRefreshTimer(false);
                UpdateNagTimer();
            }
            else
            {
                UpdateUi(DisplayStatus.NetworkError);
                StartRefreshTimer(true);
            }
        }
Esempio n. 4
0
        private void FetchBinData()
        {
            var uprn = Properties.Settings.Default.Uprn;

            if (string.IsNullOrEmpty(uprn))
            {
                UpdateUi(DisplayStatus.NoLocation);
            }
            else
            {
                UpdateUi(DisplayStatus.Busy);
                binStatus.Clear();
                refreshTimer.Stop();
                var start = DateTime.Now.Date;
                var end   = start.AddDays(90);
                client = new FalkirkWebClient();
                client.DownloadStringCompleted += Client_DownloadStringCompleted;
                client.FetchCalendarDataAsync(uprn, start, end);
            }
        }