Ejemplo n.º 1
0
        private void LoadWDSFCouples()
        {
            if (!System.IO.File.Exists(AppSettings.Default.CoupleFile))
            {
                System.Windows.MessageBox.Show(String.Format("File {0} not found, can not load the WDSF couples from a local file. Please download the WDSF couples via File menue", AppSettings.Default.CoupleFile), "No WDSF Couples", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                context.LoadWDSFCouples(AppSettings.Default.CoupleFile);
                // Check that our data is not older then one week, if so display a message box
                var now = DateTime.Now.AddDays(-7);
                if (context.DownloadDate < now)
                {
                    System.Windows.MessageBox.Show("WDSF Couples file is older then one week. Please download a new version via File menue", "Update Data", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            // Let's show some statistics
            Statistics.Content = String.Format("Downloaded: {0}, {1} couples in the local database", context.DownloadDate.ToShortDateString(), context.WDSF_Couples.Count());
        }