예제 #1
0
        public CimPropertyForm(CimProperty displayProperty)
        {
            InitializeComponent();

            //------------------------------------------------------
            List<ListViewItem> list;

            DisplayProperty = displayProperty;
            this.Text = "CimProperty - " + DisplayProperty.Name.ToString();

            #region Display Signature
            this.AddLabel(LabelType.Type);
            LastLabel.Text = DisplayProperty.Type.ToString();

            this.AddLabel(LabelType.Name);
            LastLabel.Text = DisplayProperty.ClassOrigin.ToString() + "." + DisplayProperty.Name.ToString();

            if ((DisplayProperty.Value != string.Empty) &&
                 (DisplayProperty.Value != null))
            {
                // We should probably throw this in it's own label to
                // syntax highlight it.
                LastLabel.Text += " = " + DisplayProperty.Value;
            }

            LastLabel.Text += ";";
            #endregion

            #region Display Description
            this.uxLbl_Description.Text = "Description:";

            if (DisplayProperty.Qualifiers["Description"] != null)
            {
                string desc = DisplayProperty.Qualifiers["Description"].Values[0];
                this.uxTxtBx_Description.Lines = desc.Split('\n');
                this.uxTxtBx_Description.Select(0, 0);
            }
            #endregion

            #region Display Attributes
            list = new List<ListViewItem>();
            list.Add(ListViewUtils.AttrToListViewItem("IsPropagated", DisplayProperty.IsPropagated.ToString()));
            #endregion

            #region Display Qualifiers
            list = ListViewUtils.ToList(DisplayProperty.Qualifiers);
            #endregion

            uxLstView_Items.Items.AddRange(list.ToArray());

            colName.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            colType.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

            this.AlignSignatureLabels(null, null);
        }
예제 #2
0
        public static TreeNode CimToNode(CimProperty property)
        {
            /* <!ELEMENT PROPERTY (QUALIFIER*,VALUE?)>
             * <!ATTLIST PROPERTY
             *      %CIMName;
             *      %CIMType; #REQUIRED
             *      %ClassOrigin;
             *      %Propagated;
             *      xml:lang NMTOKEN #IMPLIED>
             * */

            if (property == null)
                return null;//why is this happening?

            //property.Name = string.Empty;
            TreeNode root = new TreeNode(property.Name.ToString());
            root.Nodes.Add(new TreeNode("Type - " + property.Type.ToString()));
            if (property.ClassOrigin != null)
                root.Nodes.Add(new TreeNode("ClassOrigin - " + property.ClassOrigin.ToString()));
            root.Nodes.Add(new TreeNode("Propagated - " + property.IsPropagated.ToString()));

            TreeNode qualifiers = new TreeNode("Qualifiers");
            return root;
        }
예제 #3
0
        private void uxbtnCreate_Click(object sender, EventArgs e)
        {
            //throw new Exception("Not implemented yet");
            Instance = new CimInstance(DisplayClass.ClassName);

            int numProps = DisplayClass.Properties.GetKeyProperties().Count;
            for (int i = 0; i < numProps; ++i)
            {
                CimProperty prop = new CimProperty(lblNames[i].Text, CimTypeUtils.StrToCimType(lblTypes[i].Text));
                prop.Value = txtValues[i].Text;
                prop.Qualifiers.Add(GetKeyQualifier());
                Instance.Properties.Add(prop);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }