public bool Build(BuildOptions options, Project project, Interpic.Models.Version version) { List <AsyncTasks.AsyncTask> tasksToExecute = new List <AsyncTasks.AsyncTask>(); if (options.CleanOutputDirectory) { tasksToExecute.Add(new GenerateFolderStructureTask(options, project, version)); } if (options.BuildSettings.GetBooleanSetting("generateConfiguration")) { tasksToExecute.Add(new GenerateMKDocsConfigurationTask(options, project, version)); } int counter = 1; foreach (Page page in version.Pages) { tasksToExecute.Add(new GeneratePageTask(options, project, page, version, counter)); counter++; } ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasksToExecute); dialog.ShowDialog(); return(!dialog.AllTasksCanceled); }
public List <LoadedAssembly> LoadAssemblies(List <string> paths, Extension requestingExtension, PackageDefinition packagingDefinition) { List <LoadedAssembly> results = new List <LoadedAssembly>(); List <AsyncTask> tasks = new List <AsyncTask>(); foreach (string path in paths) { if (ValidatePackagePath(path, requestingExtension)) { UnpackPackageTask task = new UnpackPackageTask(path, true); ProcessTaskDialog processDialog = new ProcessTaskDialog(task); if (!processDialog.TaskToExecute.IsCanceled) { string assemblyPath = Path.Combine(task.UnpackedPackage.Folder, task.UnpackedPackage.Manifest.DllPath); tasks.Add(new LoadAssemblyTask(assemblyPath, requestingExtension)); } } } ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks); dialog.ShowDialog(); foreach (LoadAssemblyTask task in tasks) { results.Add(task.LoadedAssembly); } return(results); }
public static bool Pack(List <string> contents, string targetpath, PackageManifest manifest) { string tempDirectory = Path.Combine(Path.GetTempPath() + "interpic_temp_package_" + Guid.NewGuid().ToString()); try { Directory.CreateDirectory(tempDirectory); } catch (Exception ex) { ErrorAlert.Show($"Could not create temporary directory '{tempDirectory}':\n{ex.Message}"); return(false); } List <AsyncTask> tasks = new List <AsyncTask>(); tasks.Add(new CreatePackageManifestTask(Path.Combine(tempDirectory, "manifest.json"), manifest)); tasks.Add(new PreparePackageContentsTask(contents, tempDirectory)); tasks.Add(new CreatePackageTask(tempDirectory, targetpath)); tasks.Add(new CleanUpAfterPackageCreationTask(tempDirectory)); ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks, "Creating package..."); dialog.ShowDialog(); return(!dialog.AllTasksCanceled); }
private void LoadProject(string path, bool isNew = false) { List <AsyncTask> tasks = new List <AsyncTask>(); tasks.Add(new LoadGlobalSettingsTask()); tasks.Add(new LoadPackageCacheTask()); LoadProjectTask task = new LoadProjectTask(path); task.PassThrough = true; task.PassThroughSource = "Project"; task.PassThroughTarget = "Project"; tasks.Add(task); StartStudioTask startStudioTask = new StartStudioTask(); tasks.Add(startStudioTask); ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks, "Loading Interpic Studio..."); dialog.ShowDialog(); if (!dialog.AllTasksCanceled) { task.Project.IsNew = isNew; RecentProjects.AddToRecents(task.Project.Name, task.Project.Path); startStudioTask.Studio.Show(); Close(); } }
public List <bool> UnloadAssemblies(List <LoadedAssembly> assemblies) { List <bool> results = new List <bool>(); List <AsyncTask> tasks = new List <AsyncTask>(); foreach (LoadedAssembly assembly in assemblies) { tasks.Add(new UnloadAssemblyTask(assembly)); } ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks); dialog.ShowDialog(); foreach (UnloadAssemblyTask task in tasks) { results.Add(task.IsCancelable); } return(results); }
public (Section section, bool succes) RefreshSection(Section section, Page page, Models.Version version, Project project) { BrowserType type = GetBrowserType(version.Settings.GetMultipleChoiceSetting("BrowserType")); if (CheckSelenium(type)) { List <AsyncTask> tasks = new List <AsyncTask>(); NavigateToPageTask navigateTask = new NavigateToPageTask(version.Settings.GetTextSetting("BaseUrl") + page.Settings.GetTextSetting("PageUrl")); navigateTask.Selenium = Selenium[type]; navigateTask.PassThrough = true; navigateTask.PassThroughSource = "Selenium"; navigateTask.PassThroughTarget = "Selenium"; tasks.Add(navigateTask); GetElementBoundsTask getElementBoundsTask = new GetElementBoundsTask(section.SectionIdentifier.Identifier); getElementBoundsTask.PassThrough = true; getElementBoundsTask.PassThroughSource = "Selenium"; getElementBoundsTask.PassThroughTarget = "Selenium"; tasks.Add(getElementBoundsTask); ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks); try { dialog.ShowDialog(); if (!dialog.AllTasksCanceled) { section.ElementBounds = new ElementBounds(getElementBoundsTask.ElementBounds.point, getElementBoundsTask.ElementBounds.size); } } catch (Exception ex) { return(section, false); } return(section, true); } else { return(section, false); } }
public (Page page, bool succes) RefreshPage(Page page, Models.Version version, Project project) { List <AsyncTask> tasks = new List <AsyncTask>(); BrowserType type = GetBrowserType(version.Settings.GetMultipleChoiceSetting("BrowserType")); if (CheckSelenium(type)) { NavigateToPageTask navigateTask = new NavigateToPageTask(version.Settings.GetTextSetting("BaseUrl") + page.Settings.GetTextSetting("PageUrl")); navigateTask.Selenium = Selenium[type]; navigateTask.PassThrough = true; navigateTask.PassThroughSource = "Selenium"; navigateTask.PassThroughTarget = "Selenium"; tasks.Add(navigateTask); MakeScreenshotTask makeScreenshotTask = new MakeScreenshotTask(); makeScreenshotTask.PassThrough = true; makeScreenshotTask.PassThroughSource = "Selenium"; makeScreenshotTask.PassThroughTarget = "Selenium"; tasks.Add(makeScreenshotTask); ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks); try { dialog.ShowDialog(); if (!dialog.AllTasksCanceled) { page.Screenshot = makeScreenshotTask.Screenshot; } } catch (Exception ex) { return(page, false); } return(page, true); } else { return(page, false); } }
public List <LoadedAssembly> LoadAssemblies(List <string> paths, Extension requestingExtension) { List <LoadedAssembly> results = new List <LoadedAssembly>(); List <AsyncTask> tasks = new List <AsyncTask>(); foreach (string path in paths) { if (ValidatePath(path, requestingExtension)) { tasks.Add(new LoadAssemblyTask(path, requestingExtension)); } } ProcessTasksDialog dialog = new ProcessTasksDialog(ref tasks); dialog.ShowDialog(); foreach (LoadAssemblyTask task in tasks) { results.Add(task.LoadedAssembly); } return(results); }