Ejemplo n.º 1
0
        /// <inheritdoc />
        public async Task SaveProjectAsync()
        {
            if (string.IsNullOrWhiteSpace(CurrentProject.ProjectPath))
            {
                var saveDialogOptions = new SaveDialogOptions
                {
                    Title   = Translator.Translate("Please choose where to save your Project File"),
                    Filters = new[]
                    {
                        new FileFilter
                        {
                            Extensions = new[] { "json" }, Name = Translator.Translate("Project File")
                        }
                    }
                };
                var saveFilePath = await ElectronHelper.ShowSaveDialogAsync(ElectronHelper.GetBrowserWindow(), saveDialogOptions);

                if (string.IsNullOrWhiteSpace(saveFilePath))
                {
                    return;
                }

                CurrentProject.ProjectPath = saveFilePath;
            }

            await CurrentProject.SaveAsync();
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public async Task LoadImagesAsync()
        {
            var openDialogOptions = new OpenDialogOptions
            {
                Title      = Translator.Translate("Please choose your Images"),
                Properties = new[] { OpenDialogProperty.openFile, OpenDialogProperty.multiSelections },
                Filters    = new[]
                {
                    new FileFilter
                    {
                        Extensions = new[] { "jpg", "png", "gif" }, Name = Translator.Translate("Images")
                    }
                }
            };
            var imageFilePaths = await ElectronHelper.ShowOpenDialogAsync(ElectronHelper.GetBrowserWindow(), openDialogOptions);

            if (imageFilePaths != null && imageFilePaths.Any())
            {
                await CurrentProject.AddImagesAsync(imageFilePaths);
            }
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        public async Task LoadProjectAsync()
        {
            var openDialogOptions = new OpenDialogOptions
            {
                Title      = Translator.Translate("Please choose your Project File"),
                Properties = new[] { OpenDialogProperty.openFile },
                Filters    = new[]
                {
                    new FileFilter
                    {
                        Extensions = new[] { "json" }, Name = Translator.Translate("Project File")
                    }
                }
            };

            var projectFilePath = (await ElectronHelper.ShowOpenDialogAsync(ElectronHelper.GetBrowserWindow(), openDialogOptions))
                                  .FirstOrDefault();

            if (!string.IsNullOrWhiteSpace(projectFilePath))
            {
                await CurrentProject.LoadAsync(projectFilePath);
            }
        }