Exemple #1
0
 public void Add(LibDetail detail)
 {
     if (Details == null)
     {
         Details = new List<LibDetail>();
     }
     Details.Add(detail);
 }
Exemple #2
0
        public void Show(LibDetail detail)
        {
            _LibDetail = detail;

            CbType.SelectedItem = new Items { K = detail.Type.ToString() };
            TbName.Text = _LibDetail.Text;
            TbData.Text = _LibDetail.Data;
            TbMemo.Text = _LibDetail.Memo;
        }
Exemple #3
0
        public void SaveDetail(LibDetail detail)
        {
            if (CharUtil.IsValidateHash(detail.Id))
            {
                _DataModel.SaveVcs(detail);

                _Selected.Text = Att.SP_TPL_LS + detail.Text + Att.SP_TPL_RS;
                TreeNode root = TvLibView.SelectedNode;
            }
            else
            {
                Lib header = _Selected.Tag as Lib;
                detail.Header = header.Id;
                detail.Id = HashUtil.UtcTimeInEnc(false);
                header.Add(detail);
                _DataModel.SaveVcs(header);

                TreeNode node = new TreeNode();
                node.Name = detail.Id;
                node.Tag = detail;
                node.Text = Att.SP_TPL_LS + detail.Text + Att.SP_TPL_RS;
                node.ToolTipText = detail.Memo;
                _Selected.Nodes.Add(node);

                TvLibView.SelectedNode = null;
            }
            _DataModel.LibModified = -1;
        }
Exemple #4
0
        private void ShowDetail(LibDetail detail)
        {
            if (_UcEditer.Name != "LibDetail")
            {
                GbGroup.Controls.Clear();

                _UcDetail.Location = new System.Drawing.Point(6, 20);
                _UcDetail.Size = new System.Drawing.Size(231, 183);
                _UcDetail.TabIndex = 0;
                GbGroup.Controls.Add(_UcDetail);
                GbGroup.Text = "属性";

                _UcEditer = _UcDetail;
            }
            _UcDetail.Show(detail);
        }
Exemple #5
0
        public override bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Lib" || !reader.IsStartElement())
            {
                return false;
            }

            if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
            {
                Order = reader.ReadElementContentAsInt();
            }
            if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
            {
                Id = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Name" || reader.ReadToNextSibling("Name"))
            {
                Name = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Text" || reader.ReadToNextSibling("Text"))
            {
                Text = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Target" || reader.ReadToNextSibling("Target"))
            {
                Target = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Script" || reader.ReadToNextSibling("Script"))
            {
                Script = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
            {
                Memo = reader.ReadElementContentAsString();
            }

            Details = new List<LibDetail>();
            if (reader.Name == "Items" || reader.ReadToNextSibling("Items"))
            {
                reader.ReadStartElement();

                LibDetail detail;
                while (reader.Name == "Item" || reader.ReadToNextSibling("Item"))
                {
                    detail = new LibDetail();
                    detail.FromXml(reader);
                    detail.Header = Id;
                    detail.UserCode = UserCode;
                    detail.Order = Details.Count;
                    Details.Add(detail);
                }

                reader.ReadEndElement();
            }
            if (reader.Name == "Lib" && reader.NodeType == XmlNodeType.EndElement)
            {
                reader.ReadEndElement();
            }
            return true;
        }
Exemple #6
0
 public void Remove(LibDetail detail)
 {
     if (Details == null)
     {
         return;
     }
     Details.Remove(detail);
 }