private void SetDataContent(InnerStructItem item)
        {
            if (item == null)
            {
                return;
            }

            ItemAttrPanel.Visibility  = System.Windows.Visibility.Visible;
            ItemAttrPanel.DataContext = item;

            if (item.ItemReadOnly)
            {
                this.ItemName.IsEnabled    = false;
                this.ItemCode.IsEnabled    = false;
                this.ItemDefault.IsEnabled = false;
                this.ItemRepeat.IsEnabled  = false;
            }
            else
            {
                this.ItemName.IsEnabled    = true;
                this.ItemCode.IsEnabled    = true;
                this.ItemDefault.IsEnabled = true;
                this.ItemRepeat.IsEnabled  = true;
            }
        }
Example #2
0
        public static void ReadFile(FileInfo fileInfo)
        {
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(fileInfo.FullName);

                string          fileName = fileInfo.Name.Remove(fileInfo.Name.LastIndexOf("."));
                InnerStructInfo enumInfo = new InnerStructInfo();
                enumInfo.Name = fileName;
                InnerStructManager.Instance.AddEnum(enumInfo);

                XmlNode root = xmlDoc.SelectSingleNode(InnerStructConfig.DOC_ROOT_STR);
                foreach (XmlElement childElement in root.ChildNodes.OfType <XmlElement>())
                {
                    if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_COLUMN)
                    {
                        InnerStructItem item = ReadColumn(childElement);
                        if (item != null)
                        {
                            enumInfo.AddItem(item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
        private void Button_NewItem(object sender, RoutedEventArgs e)
        {
            InnerStructItem item = _CurInfo.CreateItem();

            _ItemList.HideNoRecord();
            TabContent.HideTabContent();

            SetDataContent(item);
        }
        public InnerStructItem CreateItem(string name)
        {
            InnerStructItem item = new InnerStructItem();
            item.Name = name;
            item.ItemType2.Add(new TableBaseItem());
            _InnerStructItemCollection.AddNewItem(item);

            return item;
        }
Example #5
0
        public InnerStructItem CreateItem(string name)
        {
            InnerStructItem item = new InnerStructItem();

            item.Name = name;
            item.ItemType2.Add(new TableBaseItem());
            _InnerStructItemCollection.AddNewItem(item);

            return(item);
        }
Example #6
0
        public static InnerStructItem ReadColumn(XmlElement columnEle)
        {
            InnerStructItem item = new InnerStructItem();

            foreach (XmlElement childElement in columnEle.ChildNodes.OfType <XmlElement>())
            {
                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_NAME)
                {
                    item.Name = childElement.InnerText;
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_CODE)
                {
                    item.ItemCode = childElement.InnerText;
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_TYPE1)
                {
                    item.ItemType1 = childElement.InnerText;
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_TYPE2)
                {
                    foreach (XmlElement type2Ele in childElement.ChildNodes.OfType <XmlElement>())
                    {
                        item.ItemType2.AddNewItem(new TableBaseItem()
                        {
                            Name = type2Ele.InnerText
                        });
                    }
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_DEFAULT)
                {
                    item.ItemDefault = childElement.InnerText;
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_REPEAT)
                {
                    item.ItemRepeat = int.Parse(childElement.InnerText);
                }
            }

            if (string.IsNullOrEmpty(item.Name))
            {
                return(null);
            }

            return(item);
        }
        public void ConItem_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ItemAttrPanel.Visibility = System.Windows.Visibility.Visible;

            if (e.AddedItems.Count > 0)
            {
                _CurItem = e.AddedItems[0] as InnerStructItem;
                ItemAttrPanel.DataContext = _CurItem;
            }

            TabContent.HideTabContent();

            //InitItemType1();
        }
        private void SetDataContent(InnerStructItem item)
        {
            if (item == null)
                return;

            ItemAttrPanel.Visibility = System.Windows.Visibility.Visible;
            ItemAttrPanel.DataContext = item;

            if (item.ItemReadOnly)
            {
                this.ItemName.IsEnabled = false;
                this.ItemCode.IsEnabled = false;
                this.ItemDefault.IsEnabled = false;
                this.ItemRepeat.IsEnabled = false;
            }
            else
            {
                this.ItemName.IsEnabled = true;
                this.ItemCode.IsEnabled = true;
                this.ItemDefault.IsEnabled = true;
                this.ItemRepeat.IsEnabled = true;
            }
        }
        public static InnerStructItem ReadColumn(XmlElement columnEle)
        {
            InnerStructItem item = new InnerStructItem();
            foreach (XmlElement childElement in columnEle.ChildNodes.OfType<XmlElement>())
            {
                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_NAME)
                {
                    item.Name = childElement.InnerText;
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_CODE)
                    item.ItemCode = childElement.InnerText;

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_TYPE1)
                    item.ItemType1 = childElement.InnerText;

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_TYPE2)
                {
                    foreach (XmlElement type2Ele in childElement.ChildNodes.OfType<XmlElement>())
                    {
                        item.ItemType2.AddNewItem(new TableBaseItem() { Name = type2Ele.InnerText });
                    }
                }

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_DEFAULT)
                    item.ItemDefault = childElement.InnerText;

                if (childElement.Name == InnerStructConfig.INNERSTRUCT_ELEMENT_REPEAT)
                    item.ItemRepeat = int.Parse(childElement.InnerText);
            }

            if (string.IsNullOrEmpty(item.Name))
                return null;

            return item;
        }
Example #10
0
 public void AddItem(InnerStructItem item)
 {
     _InnerStructItemCollection.AddNewItem(item);
 }
        public void ConItem_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ItemAttrPanel.Visibility = System.Windows.Visibility.Visible;

            if (e.AddedItems.Count > 0)
            {
                _CurItem = e.AddedItems[0] as InnerStructItem;
                ItemAttrPanel.DataContext = _CurItem;
            }

            TabContent.HideTabContent();

            //InitItemType1();
        }
 public void AddItem(InnerStructItem item)
 {
     _InnerStructItemCollection.AddNewItem(item);
 }