コード例 #1
0
        /// <summary>
        /// Применение изменений
        /// </summary>
        private bool ApplyChanges()
        {
            string Path     = TextBoxProjectLocation.Text;
            string projName = TextBoxProjectName.Text;
            string solName  = TextBoxSolutionName.Text;

            if ((solution != null) && (ComboBoxSolutionTypeSelection.SelectedItem == ComboBoxItemAddToSolution))
            {
                string msg = Project.CanCreateProject(Path, parent.Path);
                if (msg != null)
                {
                    System.Windows.MessageBox.Show(msg, "Error");
                    return(false);
                }
                Project proj = Project.CreateNewProject(projName, parent);
                parent.AddElement(proj);
                solution.Save();
                SchematixCore.Core.UpdateExplorerPanel();
            }
            if (ComboBoxSolutionTypeSelection.SelectedItem == ComboBoxItemNewSolution)
            {
                string msg = Solution.CanCreateSolution(Path, solName);
                if (msg != null)
                {
                    System.Windows.MessageBox.Show(msg, "Error");
                    return(false);
                }
                solution = Solution.CreateNewSolution(solName, Path);
                Project proj = Project.CreateNewProject(projName, solution.RootFolder);
                solution.AddElement(proj);
                solution.Save();
                SchematixCore.Core.UpdateExplorerPanel();
            }
            return(true);
        }