/// <summary> /// Handles the Click event of the btnDownloadPackage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void btnDownloadPackage_Click(object sender, RoutedEventArgs e) { // launch our background export var exportSettings = new ExportSettings { ModifiedSince = (DateTime)txtImportCutOff.Text.AsDateTime(), ExportContributions = cbContributions.IsChecked.Value, ExportIndividuals = cbIndividuals.IsChecked.Value, ExportNotes = cbNotes.IsChecked.Value, ExportCompanies = cbCompanies.IsChecked.Value, ExportContributionImages = cbExportContribImages.IsChecked.Value, ExportAttendance = cbAttendance.IsChecked.Value }; // configure group types to export if (cbGroups.IsChecked.Value == true) { foreach (var selectedItem in GroupTypesCheckboxItems.Where(i => i.Checked)) { exportSettings.ExportGroupTypes.Add(selectedItem.Id); } } F1Api.DumpResponseToXmlFile = cbDumpResponseToXmlFile.IsChecked ?? false; exportWorker.RunWorkerAsync(exportSettings); }
/// <summary> /// Handles the Loaded event of the Window control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void Window_Loaded(object sender, RoutedEventArgs e) { lblApiUsage.Text = $"API Usage: {F1Api.ApiCounter}"; // add group types ExportGroupTypes = exporter.GetGroupTypes(); foreach (var groupType in ExportGroupTypes) { GroupTypesCheckboxItems.Add(new CheckListItem { Id = groupType.Id, Text = groupType.Name, Checked = true }); } cblGroupTypes.ItemsSource = GroupTypesCheckboxItems; txtImportCutOff.Text = DateTime.Now.ToShortDateString(); }
/// <summary> /// Handles the Click event of the btnDownloadPackage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void btnDownloadPackage_Click(object sender, RoutedEventArgs e) { // clear result from previous export txtExportMessage.Text = string.Empty; txtMessages.Text = string.Empty; txtMessages.Visibility = Visibility.Collapsed; txtError.Visibility = Visibility.Collapsed; _errorHasOccurred = false; // launch our background export var exportSettings = new ExportSettings { ModifiedSince = ( DateTime )txtImportCutOff.Text.AsDateTime(), ExportContributions = cbContributions.IsChecked.Value, ExportIndividuals = cbIndividuals.IsChecked.Value, ExportNotes = cbNotes.IsChecked.Value, ExportCompanies = cbBusinesses.IsChecked.Value, ExportContributionImages = cbExportContribImages.IsChecked.Value, ExportAttendance = cbAttendance.IsChecked.Value }; // configure group types to export if (cbGroups.IsChecked.Value == true) { foreach (var selectedItem in GroupTypesCheckboxItems.Where(i => i.Checked)) { exportSettings.ExportGroupTypes.Add(selectedItem.Id); } } F1Api.DumpResponseToXmlFile = cbDumpResponseToXmlFile.IsChecked ?? false; btnDownloadPackage.IsEnabled = false; exportWorker.RunWorkerAsync(exportSettings); }