Interaction logic for PocWindow.xaml
Inheritance: System.Windows.Window
コード例 #1
0
        public override void RunFinished() {
            try {
                base.RunFinished();

                // show the dialog
                var form = new PocWindow();
                var windowResult = form.ShowDialog();

                if(windowResult.HasValue && windowResult.Value) {

                    Solution4 solution = GetSolution();

                    if (solution != null) {
                        string projectFolder = RemovePlaceholderProjectCreatedByVs(ProjectName);
                        var properties = new Hashtable();
                        if (!string.IsNullOrWhiteSpace(solution.FileName)) {
                            properties.Add("SolutionFile", new FileInfo(solution.FileName).FullName);
                            properties.Add("SolutionRoot", new FileInfo(solution.FileName).DirectoryName);
                        }
                        string newFolder = new DirectoryInfo(projectFolder).Parent.FullName;
                        Directory.Delete(projectFolder, true);
                        PowerShellInvoker.Instance.RunPwCreateProjectScript(ProjectName, newFolder, form.TemplateName, form.TemplatePathOrUrl, form.TemplateBranch, properties);
                        AddProjectsUnderPathToSolution(solution, newFolder, "*.*proj");
                    }
                    else {
                        // TODO: Improve
                        throw new ApplicationException("Solution is null");
                    }
                }
            }
            catch (Exception ex) {
                // TODO: Improve this
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        public override void RunFinished()
        {
            try {
                base.RunFinished();

                // show the dialog
                var form         = new PocWindow();
                var windowResult = form.ShowDialog();

                if (windowResult.HasValue && windowResult.Value)
                {
                    Solution4 solution = GetSolution();

                    if (solution != null)
                    {
                        string projectFolder = RemovePlaceholderProjectCreatedByVs(ProjectName);
                        var    properties    = new Hashtable();
                        if (!string.IsNullOrWhiteSpace(solution.FileName))
                        {
                            properties.Add("SolutionFile", new FileInfo(solution.FileName).FullName);
                            properties.Add("SolutionRoot", new FileInfo(solution.FileName).DirectoryName);
                        }
                        string newFolder = new DirectoryInfo(projectFolder).Parent.FullName;
                        Directory.Delete(projectFolder, true);
                        PowerShellInvoker.Instance.RunPwCreateProjectScript(ProjectName, newFolder, form.TemplateName, form.TemplatePathOrUrl, form.TemplateBranch, properties);
                        AddProjectsUnderPathToSolution(solution, newFolder, "*.*proj");
                    }
                    else
                    {
                        // TODO: Improve
                        throw new ApplicationException("Solution is null");
                    }
                }
            }
            catch (Exception ex) {
                // TODO: Improve this
                MessageBox.Show(ex.ToString());
            }
        }