Esempio n. 1
0
        private void RefreshWeatherHistoryButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //create table
                StringTable table = new StringTable();
                table.ColumnNames.Add("Observed On");
                table.ColumnNames.Add("Location");
                table.ColumnNames.Add("Temperature");
                table.ColumnNames.Add("Forecast");

                //add rows
                var history = WeatherHistoryDAC.FetchAll();
                foreach (var entry in history)
                {
                    table.Add(table.Count, new StringRow()
                    {
                        { "Observed On", entry.FetchedOn.ToString() },
                        { "Location", entry.Latitude + ", " + entry.Longitude },
                        { "Temperature", entry.Temperature == double.MaxValue ? string.Empty : entry.Temperature.ToString() },
                        { "Forecast", entry.Forecast.ToString() }
                    });
                }

                DataGridHelper.Bind(ref WeatherHistoryGrid, table);

                //show summary
                WeatherSummaryTextBox.Text = string.Format("{0} Records", history.Count);
            }
            catch (Exception exception)
            {
                WeatherSummaryTextBox.Text = "Unable to Load Weather-History: " + exception.Message;
            }
        }
Esempio n. 2
0
        private void RefreshLocationHistoryButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //create table
                StringTable table = new StringTable();
                table.ColumnNames.Add("VisitedOn");
                table.ColumnNames.Add("Location");
                table.ColumnNames.Add("Known Location");

                //add rows
                foreach (var entry in LocationHelper.History)
                {
                    table.Add(table.Count, new StringRow()
                    {
                        { "VisitedOn", entry.VisitedOn.ToString() },
                        { "Location", entry.Latitude + ", " + entry.Longitude },
                        { "Known Location", entry.KnownKey.ToString() }
                    });
                }

                DataGridHelper.Bind(ref LocationHistoryGrid, table);

                //show summary
                LocationSummaryTextBox.Text = string.Format("{0} Records", LocationHelper.History.Count);
            }
            catch (Exception exception)
            {
                LocationSummaryTextBox.Text = "Unable to Load Location-History: " + exception.Message;
            }
        }
Esempio n. 3
0
        private void RefreshNewsHistoryButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //create table
                StringTable table = new StringTable();
                table.ColumnNames.Add("Provider");
                table.ColumnNames.Add("Title");
                table.ColumnNames.Add("Url");
                table.ColumnNames.Add("Email");
                table.ColumnNames.Add("Email Sent");

                //add rows
                var allNews = NewsDAC.FetchAll();
                foreach (var entry in allNews)
                {
                    table.Add(table.Count, new StringRow()
                    {
                        { "Provider", entry.Provider },
                        { "Title", entry.Title },
                        { "Url", entry.Url },
                        { "Email", entry.EmailId },
                        { "Email Sent", entry.EmailSent.ToString() }
                    });
                }

                DataGridHelper.Bind(ref NewsHistoryGrid, table);

                //show summary
                NewsSummaryTextBox.Text = string.Format("{0} Records", allNews.Count);
            }
            catch (Exception exception)
            {
                NewsSummaryTextBox.Text = "Unable to Load News-History: " + exception.Message;
            }
        }