public Dictionary <string, string> GetFormKeywords() { KeywordSettings tags = Settings.Instance.Keywords; Dictionary <string, string> keywords = new Dictionary <string, string> { { tags.ServiceTime, GetTime(dateTimePickerCurrent) }, { tags.ServiceNextTime, GetTime(dateTimePickerNext) }, { tags.ServiceNextDate, GetDateLong(dateTimePickerNext) }, { tags.Pastor, $"{TitleCase(textBoxVoorgangerNuTitel.Text)} {textBoxVoorgangerNuNaam.Text}" }, { tags.PastorPlace, textBoxVoorgangerNuPlaats.Text }, { tags.PastorNext, $"{textBoxVoorgangerNextTitel.Text} {textBoxVoorgangerNextNaam.Text}" }, { tags.PastorNextPlace, textBoxVoorgangerNextPlaats.Text }, { tags.Organist, textBoxOrganist.Text }, { tags.Theme, textBoxThema.Text }, { tags.Collection1, textBoxCollecte1.Text }, { tags.Collection2, textBoxCollecte2.Text }, { tags.Collection3, textBoxCollecte3.Text } }; return(keywords); }
/// <summary> /// Create the three presentations with information from the user interface /// </summary> public void CreatePresentations(object sender, EventArgs e) { // Check if fields are filled in and if the output folder is right if (!CheckValidInputs()) { return; } if (!Directory.Exists(Settings.Instance.PathOutputFolder)) { Dialogs.GenericWarning("De outputfolder bestaat niet, " + "selecteer een bestaande folder in de instellingen"); return; } // Get the filled in information from the window KeywordSettings tags = Settings.Instance.Keywords; Dictionary <string, string> keywords = GetFormKeywords(); List <ServiceElement> elements = GetServiceElements(); string filenamepart = GetFilenamePart(dateTimePickerCurrent); // Create the presentation before the service PowerPoint beforeService = CreatePowerpoint(Settings.Instance.PathTemplateBefore, Settings.Instance.PathOutputFolder + $"/voor {filenamepart}.pptx"); if (beforeService == null) { return; } if (string.IsNullOrWhiteSpace(keywords[tags.Theme])) { beforeService.RemoveThemeRuns(); } beforeService.ReplaceKeywords(keywords); beforeService.ReplaceImage(textBoxQRPath.Text); beforeService.ReplaceMultilineKeywords( from ServiceElement element in elements where element.IsSong select element, from ServiceElement element in elements where element.IsReading select element ); beforeService.SaveClose(); // Create the presentation during the service PowerPoint duringService = CreatePowerpoint(Settings.Instance.PathTemplateDuring, Settings.Instance.PathOutputFolder + $"/tijdens {filenamepart}.pptx"); if (duringService == null) { return; } duringService.ReplaceKeywords(keywords); duringService.ReplaceImage(textBoxQRPath.Text); foreach (ServiceElement element in elements) { duringService.DuplicateAndReplace(new Dictionary <string, string> { { tags.ServiceElementTitle, element.Title }, { tags.ServiceElementSubtitle, element.Subtitle } }, element.ShowQR); } duringService.SaveClose(); // Create the presentation after the service PowerPoint afterService = CreatePowerpoint(Settings.Instance.PathTemplateAfter, Settings.Instance.PathOutputFolder + $"/na {filenamepart}.pptx"); if (afterService == null) { return; } afterService.ReplaceKeywords(keywords); afterService.ReplaceImage(textBoxQRPath.Text); afterService.SaveClose(); // Done, message the user Dialogs.GenericInformation("Voltooid", $"De presentaties zijn gemaakt " + $"en staan in de folder '{Settings.Instance.PathOutputFolder}'."); Settings.Instance.NextService = dateTimePickerNext.Value; }