예제 #1
0
 protected XmlNodeViewModel(ElementViewModel parent, string name, string value, string namespaceName)
 {
     this.Parent = parent;
       this.Name = name;
       this.Value = value;
       this.NamespaceName = namespaceName;
 }
예제 #2
0
        private List<ElementViewModel> GetOrderedAncestorsFromElementToRoot(ElementViewModel element)
        {
            var list = new List<ElementViewModel>();
              var currentElement = element;
              while (currentElement.Parent != null)
              {
            list.Add(currentElement);
            currentElement = currentElement.Parent;
              }

              if (currentElement != null)
            list.Add(currentElement);

              return list;
        }
예제 #3
0
        public ElementViewModel(XElement element, ElementViewModel parent)
            : base(parent, element.Name.LocalName, element.Value, element.Name.NamespaceName)
        {
            this.InnerText = (element.FirstNode as XText)?.Value;
              this.InternalElement = element;
              this.ChildElements = new List<ElementViewModel>();
              this.Attributes = new List<AttributeViewModel>();
              this.IsExpanded = true;
              this.CollapseAllOtherElementsCommand = new RelayCommand<ElementViewModel>(CollapseAllOtherElementsCommand_Execute);
              this.ExpandAllChildElementsCommand = new RelayCommand<ElementViewModel>(ExpandAllChildElementsCommand_Execute);
              this.BuildXPathFromRootCommand = new RelayCommand<ElementViewModel>(BuildXPathFromRootCommand_Execute);
              this.CopyXPathFromRootCommand = new RelayCommand<ElementViewModel>(CopyXPathFromRootCommand_Execute);
              this.SetStartXPathCommand = new RelayCommand<ElementViewModel>(SetStartXPathCommand_Execute);
              this.BuildXPathFromStartCommand = new RelayCommand<ElementViewModel>(BuildXPathFromStartCommand_Execute);
              this.CopyXPathFromStartCommand = new RelayCommand<ElementViewModel>(CopyXPathFromStartCommand_Execute);

              Populate();
        }
예제 #4
0
 private void SetStartXPathCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new SetStartElementForXPathMessage(element));
 }
예제 #5
0
 private void ExpandAllChildElementsCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new ExpandAllChildElementsMessage(element));
 }
예제 #6
0
 private void CopyXPathFromStartCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new BuildXPathFromStartMessage(element, OutputTarget.Clipboard));
 }
예제 #7
0
 private void CollapseAllOtherElementsCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new CollapseAllOtherElementsMessage(element));
 }
예제 #8
0
 private void HandleSetStartElementForXPathMessage(SetStartElementForXPathMessage message)
 {
     this.StartOfXPath = message.Element;
 }
예제 #9
0
        public void CollapseAllChildElementsExcept(ElementViewModel elementToExclude)
        {
            if (this == elementToExclude)
            return;

              foreach (var child in this.ChildElements)
              {
            child.IsExpanded = false;
            child.CollapseAllChildElementsExcept(elementToExclude);
              }
        }
예제 #10
0
 public AttributeViewModel(XAttribute xmlAttribute, ElementViewModel parent)
     : base(parent, xmlAttribute.Name.LocalName, xmlAttribute.Value, xmlAttribute.Name.NamespaceName)
 {
     this.InternalAttribute = xmlAttribute;
 }
예제 #11
0
 private void ParseElement(XElement root)
 {
     this.Root = new ElementViewModel(root, null);
     //this.Root.Populate();
 }
예제 #12
0
 private void CopyXPathFromRootCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new BuildXPathFromRootMessage(element, OutputTarget.Clipboard));
 }
예제 #13
0
 private void SetStartXPathCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new SetStartElementForXPathMessage(element));
 }
예제 #14
0
 private void BuildXPathFromStartCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new BuildXPathFromStartMessage(element, OutputTarget.XPathEditor));
 }
예제 #15
0
        //private static ElementViewModel FindRoot(ElementViewModel element)
        //{
        //  var currentElement = element;
        //  while (currentElement.Parent != null)
        //  {
        //    currentElement = currentElement.Parent;
        //  }
        //  return currentElement;
        //}
        public void Populate()
        {
            foreach (var xmlAttribute in this.InternalElement.Attributes())
              {
            var attribute = new AttributeViewModel(xmlAttribute, this);
            this.Attributes.Add(attribute);
              }

              foreach (var xmlElement in this.InternalElement.Elements())
              {
            var element = new ElementViewModel(xmlElement, this);
            this.ChildElements.Add(element);
            //element.Populate();
              }
        }
예제 #16
0
 private List<ElementViewModel> GetOrderedAncestorsFromRootToElement(ElementViewModel element)
 {
     var list = GetOrderedAncestorsFromElementToRoot(element);
       list.Reverse();
       return list;
 }
예제 #17
0
 private void BuildXPathFromRootCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new BuildXPathFromRootMessage(element, OutputTarget.XPathEditor));
 }
예제 #18
0
 private void HandleDocumentRefressMessage(DocumentRefreshCompleted message)
 {
     this.StartOfXPath = null;
 }
예제 #19
0
 private void CollapseAllOtherElementsCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new CollapseAllOtherElementsMessage(element));
 }
예제 #20
0
 public AttributeViewModel(XAttribute xmlAttribute, ElementViewModel parent)
     : base(parent, xmlAttribute.Name.LocalName, xmlAttribute.Value, xmlAttribute.Name.NamespaceName)
 {
     this.InternalAttribute = xmlAttribute;
 }
예제 #21
0
 private void ExpandAllChildElementsCommand_Execute(ElementViewModel element)
 {
     this.MessengerInstance.Send(new ExpandAllChildElementsMessage(element));
 }