Esempio n. 1
0
        private async t.Task OnCompileSuccess(DXCompileResult result)
        {
            switch (result.Option.TargetPlatform)
            {
            case Platform.Window:
                await DXDebugger.RunWinApplication(result.Outputs[0]);

                break;

            case Platform.XForms:
                break;
            }

            DXCommands.StopDebugCommand.Execute(null, null);
        }
Esempio n. 2
0
        private void OnCompileError(DXCompileResult result)
        {
            var sb = new StringBuilder();

            foreach (object error in result.Errors)
            {
                if (error is CompilerError cErr)
                {
                    sb.AppendLine(cErr.ErrorText);
                }
                else if (error is Exception ex)
                {
                    sb.AppendLine($"Exception: {ex.Message}");
                }
            }

            MessageBox.Show("컴파일 에러: \r\n" + sb.ToString(), "DeXign", MessageBoxButton.OK, MessageBoxImage.Exclamation);

            GlobalModel.Instance.IsDebugging = false;
        }
Esempio n. 3
0
        private async t.Task Build(bool run)
        {
            var proj = this.Model.SelectedProject;

            if (proj == null)
            {
                MessageBox.Show("대상 프로젝트를 찾을 수 없습니다.", "DeXign", MessageBoxButton.OK);
                return;
            }

            this.BeginDebugging("컴파일중...");

            await t.Task.Delay(200);

            // 저장
            proj.Save();

            // 컴파일 옵션
            var dxCompileOption = new DXCompileOption()
            {
                ApplicationName   = proj.Manifest.ProjectName,
                ApplicationGuid   = proj.Manifest.Guid,
                RootNamespace     = proj.Manifest.PackageName,
                TargetPlatform    = this.Model.StoryboardPage.Model.SelectedPlatform,
                Directory         = $"{Path.GetDirectoryName(proj.FileName)}",
                RootDatastorePath = DXDatastore.GetAbsoluteDataPath(GlobalModel.Instance.SelectedProject)
            };

            PTemplatePage[] templates   = proj.Templates.ToArray();
            PContentPage[]  screens     = proj.Screens.ToArray();
            PBinderHost[]   binderHosts = screens
                                          .Select(s => s.GetRenderer())                                       // PContentPage -> IRenderer
                                          .SelectMany(r => r.FindChildrens <IRenderer>().Concat(new[] { r })) // 모든 렌더러 자식 (하위 포함)
                                          .Where(r => r.GetBinderHost().Items.Sum(b => b.Items.Count) > 0)    // 연결된 아이템들
                                          .Select(r => r.GetBinderHost() as PBinderHost)                      // BinderHost 선택
                                          .ToArray();

            BaseCompilerService service =
                DXCompiler.GetCompilerService(dxCompileOption.TargetPlatform).FirstOrDefault();

            // 컴파일 프로그레스 등록
            service.ProgressChanged += Compile_ProgressChanged;

            DXCompileResult result = await DXCompiler.Compile(
                new DXCompileParameter(
                    dxCompileOption,
                    screens,
                    templates,
                    binderHosts));

            // 컴파일 프로그레스 등록해제
            service.ProgressChanged -= Compile_ProgressChanged;

            this.EndDebugging(true);

            if (result.IsSuccess)
            {
                if (run)
                {
                    await OnCompileSuccess(result);
                }
                else
                {
                    DXCommands.StopDebugCommand.Execute(null, null);
                }
            }
            else
            {
                OnCompileError(result);
            }
        }
Esempio n. 4
0
        private async void RunDebug_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            // TODO: Compile
            var proj = this.Model.SelectedProject;

            if (proj == null)
            {
                MessageBox.Show("대상 프로젝트를 찾을 수 없습니다.", "DeXign", MessageBoxButton.OK);
                return;
            }

            GlobalModel.Instance.IsDebugging     = true;
            GlobalModel.Instance.CompileProgress = 0;

            messagePanel.Show();

            await t.Task.Delay(300);

            // 저장
            proj.Save();

            // 컴파일 옵션
            var dxCompileOption = new DXCompileOption()
            {
                ApplicationName = proj.Manifest.ProjectName,
                RootNamespace   = proj.Manifest.PackageName,
                TargetPlatform  = this.Model.StoryboardPage.Model.SelectedPlatform,
                Directory       = $"{Path.GetDirectoryName(proj.FileName)}"
            };

            PContentPage[] screens     = proj.Screens.ToArray();
            PBinderHost[]  binderHosts = screens
                                         .Select(s => s.GetRenderer())                                   // PContentPage -> IRenderer
                                         .SelectMany(r => r.FindChildrens <IRenderer>())                 // 모든 렌더러 자식 (하위 포함)
                                         .Where(r => r.ProvideValue().Items.Sum(b => b.Items.Count) > 0) // 연결된 아이템들
                                         .Select(r => r.ProvideValue() as PBinderHost)                   // BinderHost 선택
                                         .ToArray();

            BaseCompilerService service =
                DXCompiler.GetCompilerService(dxCompileOption.TargetPlatform).FirstOrDefault();

            // 컴파일 프로그레스 등록
            service.ProgressChanged += Compile_ProgressChanged;

            DXCompileResult result = await DXCompiler.Compile(
                new DXCompileParameter(dxCompileOption, screens, binderHosts));

            // 컴파일 프로그레스 등록해제
            service.ProgressChanged -= Compile_ProgressChanged;

            messagePanel.Hide();

            if (result.IsSuccess)
            {
                await OnCompileSuccess(result);
            }
            else
            {
                OnCompileError(result);
            }
        }