示例#1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.xmlattrMap.Clear();
            this.dataSetSettings.TableSettings.Clear();
            XmlNode xmlnode = (XmlNode)this.treenodesMap[e.Node];

            if (xmlnode != null)
            {
                // load setting items for this setting container
                foreach (XmlNode xmlchild in xmlnode.ChildNodes)
                {
                    if (xmlchild.Name == "add") // setting item
                    {
                        XmlAttribute attrName   = (XmlAttribute)xmlchild.Attributes.GetNamedItem("stname");
                        XmlAttribute attrValue  = (XmlAttribute)xmlchild.Attributes.GetNamedItem("stvalue");
                        XmlAttribute attrType   = (XmlAttribute)xmlchild.Attributes.GetNamedItem("sttype");
                        XmlAttribute attrSelit  = (XmlAttribute)xmlchild.Attributes.GetNamedItem("selitems");
                        XmlAttribute attrMinval = (XmlAttribute)xmlchild.Attributes.GetNamedItem("minval");
                        XmlAttribute attrMaxval = (XmlAttribute)xmlchild.Attributes.GetNamedItem("maxval");
                        if (attrName != null)
                        {
                            if (attrType == null)
                            {
                                attrType       = this.xmlDocument.CreateAttribute("sttype");
                                attrType.Value = "text";
                                xmlchild.Attributes.Append(attrType);
                            }
                            if (attrValue == null)
                            {
                                attrValue       = this.xmlDocument.CreateAttribute("stvalue");
                                attrValue.Value = "";
                                xmlchild.Attributes.Append(attrValue);
                            }
                            string selItems = attrSelit != null ? attrSelit.Value : null;
                            string minVal   = attrMinval != null ? attrMinval.Value : null;
                            string maxVal   = attrMaxval != null ? attrMaxval.Value : null;

                            DataSetSettings.TableSettingsRow row = this.dataSetSettings.TableSettings.NewTableSettingsRow();
                            row.Name     = attrName.Value;
                            row.Value    = (xmlnode.Name == "database" ? DecryptData(attrValue.Value) : attrValue.Value);
                            row.Type     = attrType.Value;
                            row.Selitems = selItems;
                            row.MinValue = minVal;
                            row.MaxValue = maxVal;
                            this.dataSetSettings.TableSettings.AddTableSettingsRow(row);
                            this.xmlattrMap.Add(row, attrValue);
                        }
                    }
                }
            }
        }
示例#2
0
        private void GetCurrentGridRow(object sender)
        {
            DataRowView rowView = (DataRowView)((BindingSource)sender).Current;

            this.rowCurrent = rowView != null ? (DataSetSettings.TableSettingsRow)rowView.Row : null;
        }