public static void ConfirmOrGeneratePhotoDirectoryAndPictures(PhotoContent dbEntry, IProgress <string> progress) { StructureAndMediaContent.CheckPhotoFileIsInMediaAndContentDirectories(dbEntry, progress).Wait(); var targetDirectory = UserSettingsSingleton.CurrentSettings().LocalSitePhotoContentDirectory(dbEntry); var sourceImage = new FileInfo(Path.Combine(targetDirectory.FullName, dbEntry.OriginalFileName)); PictureResizing.ResizeForDisplayAndSrcset(sourceImage, false, null); }
public MainWindow() { InitializeComponent(); App.Tracker.Track(this); WindowInitialPositionHelpers.EnsureWindowIsVisible(this); InfoTitle = $"Pointless Waymarks CMS - Built On {GetBuildDate(Assembly.GetEntryAssembly())} - Commit {ThisAssembly.Git.Commit} {(ThisAssembly.Git.IsDirty ? "(Has Local Changes)" : string.Empty)}"; ShowSettingsFileChooser = true; DataContext = this; StatusContext = new StatusControlContext(); GenerateIndexCommand = new Command(() => StatusContext.RunNonBlockingTask(GenerateIndex)); OpenIndexUrlCommand = new Command(() => StatusContext.RunNonBlockingTask(OpenIndexUrl)); GenerateAllHtmlCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllHtml)); ConfirmOrGenerateAllPhotosImagesFilesCommand = new Command(() => StatusContext.RunBlockingTask(ConfirmOrGenerateAllPhotosImagesFiles)); GenerateAllHtmlAndCleanAndResizePicturesCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllHtmlAndCleanAndResizePictures)); CleanAndResizePicturesCommand = new Command(() => StatusContext.RunBlockingTask(CleanAndResizePictures)); NewPhotoContentCommand = new Command(() => StatusContext.RunNonBlockingTask(NewPhotoContent)); GenerateHtmlForAllPhotoContentCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllPhotoHtml)); NewPostContentCommand = new Command(() => StatusContext.RunNonBlockingTask(NewPostContent)); GenerateHtmlForAllPostContentCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllPostHtml)); NewImageContentCommand = new Command(() => StatusContext.RunNonBlockingTask(NewImageContent)); GenerateHtmlForAllImageContentCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllImageHtml)); NewFileContentCommand = new Command(() => StatusContext.RunNonBlockingTask(NewFileContent)); GenerateHtmlForAllFileContentCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllFileHtml)); NewLinkContentCommand = new Command(() => StatusContext.RunNonBlockingTask(NewLinkContent)); GenerateAllTagHtmlCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllTagHtml)); GenerateDailyGalleryHtmlCommand = new Command(() => StatusContext.RunBlockingTask(GenerateAllDailyPhotoGalleriesHtml)); GenerateCamerRollCommand = new Command(() => StatusContext.RunBlockingTask(GenerateCameraRollHtml)); PurgeInvalidPhotoDirectoriesCommand = new Command(async() => await StructureAndMediaContent.PurgePhotoDirectoriesNotFoundInCurrentDatabase( StatusContext.ProgressTracker())); ImportJsonFromDirectoryCommand = new Command(() => StatusContext.RunBlockingTask(ImportJsonFromDirectory)); ToggleDiagnosticLoggingCommand = new Command(() => UserSettingsSingleton.LogDiagnosticEvents = !UserSettingsSingleton.LogDiagnosticEvents); ExceptionEventsReportCommand = new Command(() => StatusContext.RunNonBlockingTask(ExceptionEventsReport)); DiagnosticEventsReportCommand = new Command(() => StatusContext.RunNonBlockingTask(DiagnosticEventsReport)); AllEventsReportCommand = new Command(() => StatusContext.RunNonBlockingTask(AllEventsReport)); SettingsFileChooser = new SettingsFileChooserControlContext(StatusContext, RecentSettingsFilesNames); SettingsFileChooser.SettingsFileUpdated += SettingsFileChooserOnSettingsFileUpdatedEvent; StatusContext.RunFireAndForgetTaskWithUiToastErrorReturn(CleanUpTemporaryFiles); }