Exemplo n.º 1
0
        public void Build(ExecutionCompletedHandler handler = null)
        {
            Status = ApplicationStatus.Building;
            if (AppEnvironment.Settings.TestMode)
            {
                SolutionObj = new DummySolution(WorkSpace, Solution);
            }
            else
            {
                SolutionObj = new Solution(WorkSpace, Solution);
            }

            SolutionObj.ExecutionCompleted += handler;
            SolutionObj.ExecutionCompleted += (s, e) => {
                var buildResults = BuildResults.FromOutput(SolutionObj.Output);
                StatusMessage = buildResults.ToString();
                if (buildResults.Success)
                {
                    Status = ApplicationStatus.BuildCompleted;
                }
                else
                {
                    Status = ApplicationStatus.BuildFailed;
                }
            };

            var binaries = WorkSpace + Path.GetDirectoryName(Solution) + BinaryDirectory;

            OutputDirectory = GetNextOutputDirectory();
            SolutionObj.BuildAsync(binaries, OutputDirectory);
            SetActiveApplication(_parent);

            Status = ApplicationStatus.Building;
        }