// return arraylist of Elements from JSON delivered by ClayUI Web Service
        public List<Element> GetElements()
        {
            List<Element> elements = new List<Element>();

            try
            {
                JArray array = JArray.Parse(GetWebServiceData(this._uri));

                // loop through array, pull JSON objects out and push the values into App Part objects
                for (int i = 0; i < array.Count; i++)
                {
                    JObject jObject = JObject.Parse(array[i].ToString());
                    Element element = new Element(int.Parse(jObject["ElementID"].ToString().Replace("\"", "")),
                        int.Parse(jObject["AppPartID"].ToString().Replace("\"", "")),
                        jObject["ElementName"].ToString().Replace("\"", ""),
                        int.Parse(jObject["ElementType"].ToString().Replace("\"", "")),
                        jObject["Label"].ToString().Replace("\"", ""),
                        int.Parse(jObject["ListOrder"].ToString().Replace("\"", "")),
                        int.Parse(jObject["Version"].ToString().Replace("\"", "")));

                    // add to arraylist
                    elements.Add(element);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return elements;
        }
Exemplo n.º 2
0
 /**
  * Method to create text box
  **/
 private TextBox CreateTextBoxUIElement(Element element, int viewID)
 {
     TextBox textBox = new TextBox();
     textBox.Name = viewID.ToString();
     return textBox;
 }
Exemplo n.º 3
0
 /**
  * Method to add an element
  **/
 public void AddElement(Element element)
 {
     this._elements.Add(element);
 }
Exemplo n.º 4
0
        /**
         * Method to create a radio button group with radio buttons.  We'll use the FlowLayout Panel to group the radio buttons
         **/
        private FlowLayoutPanel CreateRadioGroupUIElement(Element element, int viewID)
        {
            FlowLayoutPanel panel = new FlowLayoutPanel();

            // fetch element options for each radio button
            if (element.HasOptions == false)
            {
                element.FetchElementOptions();
            }

            // apply element options
            foreach (string option in element.ElementOptions)
            {
                RadioButton rb = new RadioButton();
                rb.Text = option.ToString();
                panel.Controls.Add(rb);
            }
            return panel;
        }
Exemplo n.º 5
0
 /**
  * Method to create a label without an ID
  **/
 private Label CreateLabelUIElement(Element element)
 {
     Label label = new Label();
     label.Text = element.ElementLabel;
     return label;
 }
Exemplo n.º 6
0
 /**
  * Method to create label with ID
  **/
 private Label CreateLabelUIElement(Element element, int viewID)
 {
     Label label = new Label();
     label.Name = viewID.ToString();
     label.Text = element.ElementLabel;
     return label;
 }
Exemplo n.º 7
0
        /**
         * Method to create a combo box element
         **/
        private ComboBox CreateComboBoxUIElement(Element element, int viewID)
        {
            ComboBox comboBox = new ComboBox();
            comboBox.Name = viewID.ToString();

            // fetch element options
            if (element.HasOptions == false)
            {
                element.FetchElementOptions();
            }

            foreach (string option in element.ElementOptions)
            {
                comboBox.Items.Add(option);
            }
            return comboBox;
        }
Exemplo n.º 8
0
 /**
  * Method to create checkbox
  **/
 private CheckBox CreateCheckBoxUIElement(Element element, int viewID)
 {
     CheckBox checkBox = new CheckBox();
     checkBox.Name = viewID.ToString();
     checkBox.Text = element.ElementLabel;
     return checkBox;
 }