private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e)
        {
            DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)this.EntityToken;

            FileUtils.Delete(castedEntityToken.FullTreePath);

            this.RefreshRootEntityToken();
        }
Example #2
0
        private void IsMarkupValid(object sender, System.Workflow.Activities.ConditionalEventArgs e)
        {
            DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)this.EntityToken;

            string content = this.GetBinding <string>("TreeDefinitionMarkup");

            this.UpdateBinding("Errors", "");

            XDocument document = null;

            try
            {
                document = XDocument.Parse(content);
            }
            catch (Exception ex)
            {
                this.UpdateBinding("Errors", ex.Message);
                e.Result = false;
                return;
            }


            Tree tree = TreeFacade.LoadTreeFromDom(castedEntityToken.Filename, document);

            ValidationError validationError = tree.BuildResult.ValidationErrors.FirstOrDefault();

            if (validationError != null)
            {
                StringBuilder sb = new StringBuilder();
                if (string.IsNullOrEmpty(validationError.XPath) == false)
                {
                    sb.Append(validationError.Message);
                    sb.Append(" at XPath: ");
                    sb.Append(validationError.XPath);
                }
                else
                {
                    sb.Append(validationError.Message);
                }

                this.UpdateBinding("Errors", sb.ToString());
            }

            e.Result = tree.BuildResult.ValidationErrors.Count() == 0;
        }