Ejemplo n.º 1
0
 private void MetroWindow_Unloaded(object sender, RoutedEventArgs e)
 {
     if (client != null)
     {
         client.Dispose();
         client = null;
     }
 }
Ejemplo n.º 2
0
 private FalkirkWebClient GetWebClient()
 {
     if (client == null)
     {
         client = new FalkirkWebClient();
         client.DownloadStringCompleted += Client_DownloadStringCompleted;
     }
     return(client);
 }
Ejemplo 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);
            }
        }
Ejemplo 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);
            }
        }