Ejemplo n.º 1
0
        public override CompiledTemplate DefineRegion(string enclosingTemplateName, IToken regionT, string template, IToken templateToken)
        {
            CompiledTemplate result = base.DefineRegion(enclosingTemplateName, regionT, template, templateToken);
            TemplateInformation info = new TemplateInformation(enclosingTemplateName, regionT, templateToken, result);
            _templateInformation.Add(info);
            _compiledTemplateInformation.Add(result, info);

            return result;
        }
Ejemplo n.º 2
0
        public override CompiledTemplate DefineTemplate(string templateName, IToken nameT, List<FormalArgument> args, string template, IToken templateToken)
        {
            CompiledTemplate result = base.DefineTemplate(templateName, nameT, args, template, templateToken);
            TemplateInformation info = new TemplateInformation(nameT, templateToken, result);
            _templateInformation.Add(info);
            _compiledTemplateInformation.Add(result, info);

            return result;
        }
Ejemplo n.º 3
0
        private void TemplateComboBoxSelectedValueChanged(object sender, EventArgs e)
        {
            if (SelectedTemplate != null)
            {
                if (MessageBox.Show(this,
                                    "You've already selected a template. If you switch all input will be lost. Do you want to continue?",
                                    "Switch template", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                {
                    return;
                }
            }

            SelectedTemplate = TemplateComboBox.SelectedValue as TemplateInformation;
        }
        public TemplateInformationViewModel(AnkiU.AnkiCore.Models models, bool forDeck = true)
        {
            isForDeck     = forDeck;
            Models        = models;
            CurrentModel  = models.GetCurrent(isForDeck);
            TemplatesJson = CurrentModel.GetNamedArray("tmpls");
            List <TemplateInformation> temp = new List <TemplateInformation>();

            foreach (var template in TemplatesJson)
            {
                string name           = template.GetObject().GetNamedString("name");
                uint   ord            = (uint)template.GetObject().GetNamedNumber("ord");
                TemplateInformation m = new TemplateInformation(name, ord);
                temp.Add(m);
            }
            temp.Sort((x, y) => { return(x.Ord.CompareTo(y.Ord)); });
            this.Templates = new ObservableCollection <TemplateInformation>(temp);
        }
        FilePath CreateTemplateJsonFile(
            FilePath baseDirectory,
            TemplateInformation viewModel,
            PolicyBag policies)
        {
            var templateJsonFileCreator = new TemplateJsonFileCreator();

            templateJsonFileCreator.CreateInDirectory(baseDirectory, viewModel);

            FileFormatter.FormatFile(policies, templateJsonFileCreator.TemplateJsonFilePath);

            IdeApp.Workbench.OpenDocument(
                templateJsonFileCreator.TemplateJsonFilePath,
                null,
                true);

            return(templateJsonFileCreator.TemplateJsonFilePath);
        }
        protected override void Run()
        {
            Solution solution = GetSelectedSolution();

            if (solution == null)
            {
                return;
            }

            try {
                var viewModel = new TemplateInformation(solution);
                using (var dialog = new TemplateInformationDialog(viewModel)) {
                    if (dialog.ShowWithParent())
                    {
                        FilePath templateJsonFile = CreateTemplateJsonFile(solution, viewModel);
                        TemplatingServices.EventsService.OnTemplateFileCreated(solution);
                        RegisterTemplateFolder(templateJsonFile);
                    }
                }
            } catch (Exception ex) {
                LoggingService.LogError("Error creating template.json", ex);
                MessageService.ShowError("Unable to create template.json file.", ex.Message);
            }
        }
        public static DocuSignEnvelopeCM_v2 ParseAPIresponsesIntoCM(out DocuSignEnvelopeCM_v2 envelope, TemplateInformation templates, Recipients recipients)
        {
            envelope = new DocuSignEnvelopeCM_v2();
            envelope.CurrentRoutingOrderId = recipients.CurrentRoutingOrder;


            if (templates.Templates != null)
            {
                foreach (var ds_template in templates.Templates)
                {
                    DocuSignTemplate template = new DocuSignTemplate();
                    template.DocumentId = ds_template.DocumentId;
                    template.Name       = ds_template.Name;
                    template.TemplateId = ds_template.TemplateId;
                    envelope.Templates.Add(template);
                }
            }

            //Recipients

            if (recipients.Signers != null)
            {
                foreach (var dsrecipient in recipients.Signers)
                {
                    DocuSignRecipientStatus recipient = new DocuSignRecipientStatus();
                    recipient.Email          = dsrecipient.Email;
                    recipient.Name           = dsrecipient.Name;
                    recipient.RecipientId    = dsrecipient.RecipientId;
                    recipient.RoutingOrderId = dsrecipient.RoutingOrder;
                    recipient.Status         = dsrecipient.Status;
                    recipient.Type           = "Signer";
                    envelope.Recipients.Add(recipient);

                    //Tabs
                    if (dsrecipient.Tabs != null)
                    {
                        var tabsDTO = DocuSignTab.ExtractTabs(JObject.Parse(dsrecipient.Tabs.ToJson()), "");

                        foreach (var tabDTO in tabsDTO)
                        {
                            DocuSignTabStatus tab = new DocuSignTabStatus();
                            tab.DocumentId = tabDTO.DocumentId.ToString();
                            tab.Name       = tabDTO.Name;
                            tab.TabType    = tabDTO.Type;
                            tab.Value      = tabDTO.Value;
                            tab.TabLabel   = tabDTO.TabLabel;

                            if (tabDTO is DocuSignMultipleOptionsTabDTO)
                            {
                                var multiTabDTO = (DocuSignMultipleOptionsTabDTO)tabDTO;
                                foreach (var childDTO in multiTabDTO.Items)
                                {
                                    var childTab = new DocuSignTabStatus();
                                    childTab.Selected = childDTO.Selected.ToString();
                                    childTab.Value    = childDTO.Value;
                                    childTab.TabLabel = childDTO.Text;
                                    tab.Items.Add(childTab);
                                }
                            }
                            recipient.Tabs.Add(tab);
                        }
                    }
                }
            }
            return(envelope);
        }
 protected FilePath CreateTemplateJsonFile(DotNetProject project, TemplateInformation viewModel)
 {
     return(CreateTemplateJsonFile(project.BaseDirectory, viewModel, project.Policies));
 }
 protected FilePath CreateTemplateJsonFile(Solution solution, TemplateInformation viewModel)
 {
     return(CreateTemplateJsonFile(solution.BaseDirectory, viewModel, solution.Policies));
 }