Esempio n. 1
0
        /// <inheritdoc />
        public async Task ExportAsync()
        {
            var openDialogOptions = new OpenDialogOptions
            {
                Title      = Translator.Translate("Please choose the Export location"),
                Properties = new[] { OpenDialogProperty.openDirectory }
            };
            var exportPath =
                (await ElectronHelper.ShowOpenDialogAsync(ElectronHelper.GetBrowserWindow(), openDialogOptions)).FirstOrDefault();

            if (!string.IsNullOrWhiteSpace(exportPath))
            {
                ExportStatus = ExportStatus.Exporting;

                // this is really not nice, but otherwise,
                // the UI won't be refreshed and no status message is displayed.
                ElectronHelper.ReloadBrowserWindow();

                CurrentProject.ExportImages(exportPath, i => ElectronHelper.SetProgressBar(i));

                ExportStatus = ExportStatus.ExportSuccessful;
                ElectronHelper.SetProgressBar(-1); // remove progress bar

                // this is really not nice, but otherwise,
                // the UI won't be refreshed and no status message is displayed.
                ElectronHelper.ReloadBrowserWindow();
            }
        }