Ejemplo n.º 1
0
        private void CreateSampleWorker(object[] args)
        {
            SampleUtilities.RegisterFormWidget("DatePickerWidget", typeof(DatePickerField), "Samples");
            SampleUtilities.RegisterTheme(SamplesThemeName, SamplesThemePath);
            SampleUtilities.RegisterTemplate(new Guid(SamplesTemplateId), SamplesTemplateName, SamplesTemplateName, SamplesTemplatePath, SamplesThemeName);

            var result = SampleUtilities.CreatePage(new Guid(DatePickerFormWidgetPageId), DatePickerFormWidgetPageName, true);

            if (result)
            {
                SampleUtilities.SetTemplateToPage(new Guid(DatePickerFormWidgetPageId), new Guid(SamplesTemplateId));

                var controls = new Dictionary <Control, string>();

                DatePickerField dateField = new DatePickerField();
                dateField.Title = "Date:";

                controls.Add(dateField, "Body");

                FormSubmitButton submitButton = new FormSubmitButton();
                submitButton.Text = "Submit";

                controls.Add(submitButton, "Body");

                SampleUtilities.CreateForm(new Guid(DatePickerFormId), "SampleForm", "Sample Form", "Form submitted successfully. Thank you!", controls);

                FormsControl form = new FormsControl();
                form.FormId = new Guid(DatePickerFormId);

                SampleUtilities.AddControlToPage(new Guid(DatePickerFormWidgetPageId), form, "Content", "Forms Control");
            }
        }