Esempio n. 1
0
        public bool CleanOutputDirectory(Project project)
        {
            ProcessTaskDialog dialog = new ProcessTaskDialog(new CleanOutputDirectoryTask(project));

            dialog.ShowDialog();
            return(!dialog.TaskToExecute.IsCanceled);
        }
Esempio n. 2
0
 public LoadedAssembly LoadAssembly(string path, Extension requestingExtension, PackageDefinition packagingDefinition)
 {
     if (ValidatePackagePath(path, requestingExtension))
     {
         UnpackPackageTask unpackPackageTask = new UnpackPackageTask(path, true);
         ProcessTaskDialog dialog            = new ProcessTaskDialog(unpackPackageTask);
         dialog.ShowDialog();
         if (dialog.TaskToExecute.IsCanceled)
         {
             return(null);
         }
         PackageCacheEntry unpackedPackage  = unpackPackageTask.UnpackedPackage;
         string            assemblyPath     = Path.Combine(unpackedPackage.Folder, unpackedPackage.Manifest.DllPath);
         LoadAssemblyTask  loadAssemblyTask = new LoadAssemblyTask(assemblyPath, requestingExtension);
         dialog = new ProcessTaskDialog(loadAssemblyTask);
         dialog.ShowDialog();
         if (dialog.TaskToExecute.IsCanceled)
         {
             return(null);
         }
         loadAssemblyTask.LoadedAssembly.PackagePath = path;
         loadAssemblyTask.LoadedAssembly.InPackage   = true;
         return(loadAssemblyTask.LoadedAssembly);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 3
0
 private void btnSearch_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (String.IsNullOrWhiteSpace(tbSearchQuery.Text) == false && String.IsNullOrEmpty(tbSearchQuery.Text) == false)
     {
         SearchXmlNodeTask task   = new SearchXmlNodeTask(tbSearchQuery.Text, baseNode, new string[] { "id", "class" });
         ProcessTaskDialog dialog = new ProcessTaskDialog(task);
         dialog.ShowDialog();
         SearchResults = task.SearchResults;
         if (SearchResults.Count > 0)
         {
             if (SearchResults.Count > 1)
             {
                 btnPreviousSearchResult.Visibility = Visibility.Visible;
                 btnNextSearchResult.Visibility     = Visibility.Visible;
             }
             else
             {
                 btnPreviousSearchResult.Visibility = Visibility.Hidden;
                 btnNextSearchResult.Visibility     = Visibility.Hidden;
             }
             currentSearchResult = 0;
             lbSearchStatus.Text = string.Format("Found {0} result(s). Showing result {1}", SearchResults.Count, currentSearchResult + 1);
             UpdateCurrentSearchResult();
         }
         else
         {
             btnPreviousSearchResult.Visibility = Visibility.Hidden;
             btnNextSearchResult.Visibility     = Visibility.Hidden;
             lbSearchStatus.Text = "Search returned no results.";
         }
     }
 }
Esempio n. 4
0
        public bool UnLoadAssembly(LoadedAssembly assembly)
        {
            UnloadAssemblyTask unloadAssemblyTask = new UnloadAssemblyTask(assembly);
            ProcessTaskDialog  dialog             = new ProcessTaskDialog(unloadAssemblyTask);

            dialog.ShowDialog();
            if (dialog.TaskToExecute.IsCanceled)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
 public LoadedAssembly LoadAssembly(string path, Extension requestingExtension)
 {
     if (ValidatePath(path, requestingExtension))
     {
         LoadAssemblyTask  loadAssemblyTask = new LoadAssemblyTask(path, requestingExtension);
         ProcessTaskDialog dialog           = new ProcessTaskDialog(loadAssemblyTask);
         dialog.ShowDialog();
         if (dialog.TaskToExecute.IsCanceled)
         {
             return(null);
         }
         return(loadAssemblyTask.LoadedAssembly);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 6
0
        public ObservableCollection <DiscoveredControl> FindControls(Section section)
        {
            FindWebControlsTask task       = new FindWebControlsTask(section.Parent.GetWebPageExtensions().Document.DocumentNode);
            ProcessTaskDialog   taskDialog = new ProcessTaskDialog(task);

            taskDialog.ShowDialog();
            ObservableCollection <DiscoveredControl> results = new ObservableCollection <DiscoveredControl>();

            foreach (HtmlNode node in task.SearchResults)
            {
                DiscoveredControl discoveredControl = new DiscoveredControl();
                discoveredControl.Name                  = Utils.GetFriendlyHtmlName(node);
                discoveredControl.Identifier            = new ControlIdentifier();
                discoveredControl.Identifier.Identifier = node.XPath;
                discoveredControl.Identifier.Name       = Utils.GetFriendlyHtmlName(node);
                results.Add(discoveredControl);
            }
            return(results);
        }
Esempio n. 7
0
        public static Project LoadProject(string path)
        {
            try
            {
                Project project = JsonConvert.DeserializeObject <Project>(File.ReadAllText(path));
                // when the project has been moved
                if (project.Path != path)
                {
                    project.Path = path;
                }

                if (!Directory.Exists(project.OutputFolder))
                {
                    WarningAlert.Show("Output folder not found.\nPlease specify an output folder.");
                    System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
                    DialogResult result = dialog.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        project.OutputFolder = dialog.SelectedPath;
                        SaveProjectTask   task       = new SaveProjectTask(project);
                        ProcessTaskDialog saveDialog = new ProcessTaskDialog(task, "Saving...");
                        saveDialog.ShowDialog();
                        if (saveDialog.TaskToExecute.IsCanceled)
                        {
                            throw new Exception("Could not save the project.");
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid path.");
                    }
                }


                if (!Directory.Exists(project.OutputFolder))
                {
                    WarningAlert.Show("Project folder not found.\nPlease specify an output folder.");
                    System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
                    DialogResult result = dialog.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        project.ProjectFolder = dialog.SelectedPath;
                        SaveProjectTask   task       = new SaveProjectTask(project);
                        ProcessTaskDialog saveDialog = new ProcessTaskDialog(task, "Saving...");
                        saveDialog.ShowDialog();
                        if (saveDialog.TaskToExecute.IsCanceled)
                        {
                            throw new Exception("Could not save the project.");
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid path.");
                    }
                }
                return(JsonConvert.DeserializeObject <Project>(File.ReadAllText(path)));
            }
            catch (Exception ex)
            {
                ErrorAlert.Show("Could not load project:\n" + ex.Message);
            }
            return(null);
        }