コード例 #1
0
        public static string GetDisplayName(Object o)
        {
            if (o == null)
            {
                return(null);
            }
            if (o is Task task)
            {
                return(ProjectDOM.GetDisplayName(task.Source));
            }
            if (o is SettingsView settings)
            {
                return(ProjectDOM.GetDisplayName(settings.Source));
            }

            throw new NotSupportedException();
        }
コード例 #2
0
        public static Project TryCreateFromCommandLine(AppView app)
        {
            var docPath = _AppConstants.StartupOpenDocumentPath;

            if (!docPath.HasValue)
            {
                return(null);
            }

            var prj = ProjectDOM.LoadProjectFrom(docPath.Value);

            var prjv = Project.Create(app, prj, docPath.Value);

            // var outDir = args.FirstOrDefault(item => item.StartsWith("-OutDir:"));
            // if (outDir != null) outDir = outDir.Substring(8).Trim('"');
            // prjv.TargetDirectory = outDir;

            return(prjv);
        }
コード例 #3
0
            public static Project CreateNew(AppView app, PathString docPath)
            {
                if (docPath == null)
                {
                    return(null);
                }

                if (!System.IO.Path.IsPathRooted(docPath))
                {
                    return(null);
                }

                var doc = ProjectDOM.CreateNewProject();

                var ppp = new Project(app, doc, docPath);

                ppp._ReloadPlugins();

                return(ppp);
            }
コード例 #4
0
        public static Project OpenFile(AppView app, PathString filePath)
        {
            if (app == null)
            {
                return(null);
            }
            if (!filePath.FileExists)
            {
                return(null);
            }

            try
            {
                var prj = ProjectDOM.LoadProjectFrom(filePath);

                return(Project.Create(app, prj, filePath));
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                return(null);
            }
        }