Пример #1
0
        internal void RemoveBaseConstruct(IBaseConstruct bc, bool cleanUpTree)
        {
            if (bc == null)
            {
                return;
            }

            if (UserObj == bc)
            {
                UserObj = null;
            }
            else if (NewGenObj == bc)
            {
                NewGenObj = null;
            }
            else if (PrevGenObj == bc)
            {
                PrevGenObj = null;
            }
            else
            {
                return;
            }

            foreach (IBaseConstruct child in bc.WalkChildren())
            {
                GetChildNode(child).RemoveBaseConstruct(child, false);
            }

            if (cleanUpTree)
            {
                ParentTree.CleanUpTree();
            }
        }
Пример #2
0
 void DragTreeViewItem_Unloaded(object sender, RoutedEventArgs e)
 {
     if (ParentTree != null)
     {
         ParentTree.ItemDetached(this);
     }
     ParentTree = null;
 }
Пример #3
0
 void DragTreeViewItem_Loaded(object sender, RoutedEventArgs e)
 {
     ParentTree = this.GetVisualAncestors().OfType <DragTreeView>().FirstOrDefault();
     if (ParentTree != null)
     {
         ParentTree.ItemAttached(this);
     }
 }
Пример #4
0
        public List <int> GetLocationInTree()
        {
            if (ParentTree == null)
            {
                return(new List <int>());
            }
            var location = ParentTree.GetLocationInTree();

            location.Add(Index);
            return(location);
        }
Пример #5
0
        private static Node_Tree CreateParentTree(ParentTree parent)
        {
            Node_Tree nodeParent = CrateNodeTree(parent.Title, parent.Id.ToString(), parent.Tag);

            foreach (var item in parent.Children)
            {
                nodeParent.nodes = nodeParent.nodes ?? new Collection <Node_Tree>();
                nodeParent.nodes.Add(CreateChildTree(item));
            }

            return(nodeParent);
        }
Пример #6
0
        //******************************************************************
        /// <summary>
        /// Raises the MeasureNode event (to resize the node to fit its
        /// displayed data) when a node's Font property changes.
        /// </summary>
        protected override void OnFontChanged(EventArgs oArgs)
        {
            try
            {
                Debug.Assert(oArgs != null);

                //**********************************************************
                // Call BeginUpdate() to disable redrawing the tree, but not
                // if redrawing was already disabled by the calling code.

                bool bCallEndUpdate = false;
                if (ParentTree != null)
                {
                    if (!ParentTree.IsUpdating)
                    {
                        ParentTree.BeginUpdate();
                        bCallEndUpdate = true;
                    }
                }

                //**********************************************************
                // Call the base method to raise the FontChanged event.

                base.OnFontChanged(oArgs);

                //**********************************************************
                // Raise the MeasureNode event to resize the node to fit its
                // displayed data.

                OnMeasureNode(new TreeViewerNodeEventArgs(this));

                //**********************************************************
                // Invalidate the control so the node will be repainted.

                Invalidate();

                //**********************************************************
                // Call EndUpdate() to redraw the tree, but not if redrawing
                // was already disabled by the calling code.

                if (ParentTree != null)
                {
                    if (bCallEndUpdate)
                    {
                        ParentTree.EndUpdate();
                    }
                }
            }
            catch (Exception oException)
            {
                LogException(oException);
            }
        }
Пример #7
0
        void ParentTree_FilterChanged(string obj)
        {
            var v = ParentTree.ShouldItemBeVisible(this);

            if (v)
            {
                part_header.Visibility = Visibility.Visible;
            }
            else
            {
                part_header.Visibility = Visibility.Collapsed;
            }
        }
Пример #8
0
 public ParentTree Add(ParentTree entity)
 {
     try
     {
         var parentTree = _unitOfWork.Repository <ParentTree>().Add(entity);
         _unitOfWork.CommitSync();
         return(parentTree);
     }
     catch (CustomException exc)
     {
         throw exc;
     }
     catch (Exception ex)
     {
         throw CustomException.Create <ParentTreeAppService>("Unexpected error fetching Add", nameof(this.Add), ex);
     }
 }
Пример #9
0
        public override TaskStatus Update()
        {
            base.Update();
            UpdateTicks();

            if (!_init)
            {
                Init();
                _init = true;
            }

            if (!_start)
            {
                Start();
                _start = true;
                _exit  = true;
            }

            var status = GetUpdate();

            LastStatus = status;


            if (status != TaskStatus.Continue)
            {
                if (_active)
                {
                    ParentTree?.RemoveTask(this);
                }
                Exit();
            }
            else if (!_active)
            {
                ParentTree?.AddTask(this);
                _active = true;
            }

            return(status);
        }
Пример #10
0
        private void TreeNode_Selected(object sender, EventArgs e)
        {
            // Setting SelectedNode and raising the SelectedNodeChanged on the
            // parent Tree control
            if (ParentTree.SelectionMode == Tree.SelectionModeType.MultipleSelection)
            {
                List <TreeNode> nodes = new List <TreeNode>(ParentTree.SelectedNodes);

                if (!nodes.Remove(this))
                {
                    nodes.Add(this);
                }

                ParentTree.SelectedNodes = nodes.ToArray();
            }
            else
            {
                TreeNode[] node = new TreeNode[1];
                node[0] = this;
                ParentTree.SelectedNodes = node;
            }
            ParentTree.RaiseSelectedNodeChanged();
        }
Пример #11
0
 public Task <ParentTree> AddAsync(ParentTree entity)
 {
     throw new NotImplementedException();
 }
Пример #12
0
        private string getMenuForCmsBrowsingHelper(int currentItemId, bool highlight, string link, bool linkNonParents)
        {
            string         divId      = PublicMenuTree.HTML_DIV_PREFIX + Id;
            PublicMenuTree parentTree = (PublicMenuTree)ParentTree;

            StringBuilder sb1 = new StringBuilder();

            if (Parent != null)
            {
                string hreflink = " href='" + link + "Id=" + Id + "'";
                if (!linkNonParents && Children.Count == 0)
                {
                    hreflink = "";
                }

                string imageId = PublicMenuTree.HTML_IMG_PREFIX + Id;

                string margin = "2";
                if (Parent.Id == -1)
                {
                    margin = "12";
                }
                sb1.AppendFormat("\n<div style=\"margin-left:{0}px;margin-top:{1}px;\">", GetIndent(), margin);

                if (Children.Count > 0)
                {
                    sb1.AppendFormat("<a href=\"#\" onclick=\"javascript:expand('{0}', '{1}', '{2}');\">", divId, imageId, parentTree.LinkPrefix);
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/plus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                    else
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/minus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                }
                else
                {
                    sb1.AppendFormat("<img src=\"{0}_system/images/layout/none.gif\">", parentTree.LinkPrefix);
                }


                if (Parent.Id == c.Tree.ROOT_ID)
                {
                    if (currentItemId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"font-weight:bold;\"><a class=\"menutreelink_a\"{0}>{1}</a></span></div>", hreflink, Text);
                    }
                    else
                    {
                        sb1.AppendFormat(" <a class=\"menutreelink\"{0}><span style=\"font-weight:bold;margin-top:50px\">{1}</span></a></div>", hreflink, Text);
                    }
                }
                else
                {
                    if (currentItemId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"font-weight:bold;\"><a class=\"menutreelink_a\"{0}>{1}</a></span></div>", hreflink, Text);
                    }
                    else
                    if (highlight)
                    {
                        sb1.AppendFormat(" <a class=\"menutreelink_a\"{0}>{1}</a></div>", hreflink, Text);
                    }
                    else
                    {
                        sb1.AppendFormat(" <a class=\"menutreelink\"{0}>{1}</a></div>", hreflink, Text);
                    }
                }
            }

            StringBuilder sb2 = new StringBuilder();

            if (Children.Count > 0)
            {
                if (currentItemId == Id)
                {
                    foreach (PublicMenuTreeItem item in Children)
                    {
                        sb2.Append(item.getMenuForCmsBrowsingHelper(currentItemId, true, link, linkNonParents));
                    }
                }
                else
                {
                    foreach (PublicMenuTreeItem item in Children)
                    {
                        sb2.Append(item.getMenuForCmsBrowsingHelper(currentItemId, false, link, linkNonParents));
                    }
                }

                if (Parent != null)
                {
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\" style=\"display:none;\">");
                    }
                    else
                    {
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\">");
                    }
                    sb2.Append("</div>");
                }
            }
            return(sb1.ToString() + sb2.ToString());
        }
Пример #13
0
        private string getMenuForCmsMenuSelectionHelper(int currentMenuId, int currentMenuParentId, bool highlight)
        {
            string         divId      = PublicMenuTree.HTML_DIV_PREFIX + Id;
            PublicMenuTree parentTree = (PublicMenuTree)ParentTree;

            string radio = "";

            if (Id == currentMenuId)
            {
                radio = "<input type='radio' style='margin-bottom:-3px;' checked='checked' name='" + RADIOBUTTON_NAME + "' value='" + Id + "'>";
            }
            else
            {
                radio = "<input type='radio' style='margin-bottom:-3px;' name='" + RADIOBUTTON_NAME + "' value='" + Id + "'>";
            }


            StringBuilder sb1 = new StringBuilder();

            if (Parent != null)
            {
                string imageId = PublicMenuTree.HTML_IMG_PREFIX + Id;

                string margin = "2";
                if (Parent.Id == -1)
                {
                    margin = "12";
                }
                sb1.AppendFormat("\n<div style=\"width:100%;margin-left:{0}px;margin-top:{1}px;\">", GetIndent(), margin);

                if (Children.Count > 0)
                {
                    sb1.AppendFormat("<a href=\"#\" onclick=\"javascript:expand('{0}', '{1}', '{2}');\">", divId, imageId, parentTree.LinkPrefix);
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/plus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                    else
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/minus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                }
                else
                {
                    sb1.AppendFormat("<img src=\"{0}_system/images/layout/none.gif\">", parentTree.LinkPrefix);
                }


                if (Parent.Id == c.Tree.ROOT_ID)
                {
                    if (currentMenuId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"color:#414141;font-weight:bold;\">{1}{0}</span></div>", Text, radio);
                    }
                    else
                    {
                        sb1.AppendFormat(" {1}<span style=\"color:#414141;font-weight:bold;margin-top:50px\">{0}</span></div>", Text, radio);
                    }
                }
                else
                {
                    if (currentMenuId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"color:#414141;font-weight:bold;\">{1}{0}</span></div>", Text, radio);
                    }
                    else
                    if (highlight)
                    {
                        sb1.AppendFormat(" {1}{0}</div>", Text, radio);
                    }
                    else
                    {
                        sb1.AppendFormat(" {1}{0}</div>", Text, radio);
                    }
                }
            }

            StringBuilder sb2 = new StringBuilder();

            if (Children.Count > 0)
            {
                bool highlightnext = false;
                if (currentMenuId == Id)
                {
                    highlightnext = true;
                }

                foreach (PublicMenuTreeItem item in Children)
                {
                    sb2.Append(item.getMenuForCmsMenuSelectionHelper(currentMenuId, currentMenuParentId, highlightnext));
                }

                if (Parent != null)
                {
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        //if (!ParentTree.ItemIsParent(Id) || currentMenuParentId != Id)  //changed this on 6/3/08
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\" style=\"display:none;\">");
                    }
                    else
                    {
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\">");
                    }
                    sb2.Append("</div>");
                }
            }
            return(sb1.ToString() + sb2.ToString());
        }
Пример #14
0
        private string getMenuForCmsParentSelectionHelper(
            int currentItemId, int previousParentId, bool highlight, bool linkNonParents, bool disableRadio, int maxDepth, int currSubtreeDepth)
        {
            string         divId      = PublicMenuTree.HTML_DIV_PREFIX + Id;
            PublicMenuTree parentTree = (PublicMenuTree)ParentTree;

            string radio = "";

            if (Id == previousParentId)
            {
                radio = "<input type='radio' style='margin-bottom:-3px;' checked='checked' name='" + RADIOBUTTON_NAME + "' value='" + Id + "'>";
            }
            else if (disableRadio || (Id == currentItemId) || ((Depth + currSubtreeDepth) > maxDepth))
            {
                disableRadio = true;
                radio        = "<input disabled='disabled' type='radio' style='margin-bottom:-3px;' name='" + RADIOBUTTON_NAME + "' value='" + Id + "'>";
            }
            else
            {
                radio = "<input type='radio' style='margin-bottom:-3px;' name='" + RADIOBUTTON_NAME + "' value='" + Id + "'>";
            }


            StringBuilder sb1 = new StringBuilder();

            if (Parent != null)
            {
                string imageId = PublicMenuTree.HTML_IMG_PREFIX + Id;

                string margin = "2";
                if (Parent.Id == -1)
                {
                    margin = "12";
                }
                sb1.AppendFormat("\n<div style=\"width:100%;margin-left:{0}px;margin-top:{1}px;\">", GetIndent(), margin);

                if (Children.Count > 0)
                {
                    sb1.AppendFormat("<a href=\"#\" onclick=\"javascript:expand('{0}', '{1}', '{2}');\">", divId, imageId, parentTree.LinkPrefix);
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/plus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                    else
                    {
                        sb1.AppendFormat("<img id=\"{0}\" src=\"{1}_system/images/layout/minus.gif\" border=\"0\"></a>", imageId, parentTree.LinkPrefix);
                    }
                }
                else
                {
                    sb1.AppendFormat("<img src=\"{0}_system/images/layout/none.gif\">", parentTree.LinkPrefix);
                }


                if (Parent.Id == c.Tree.ROOT_ID)
                {
                    if (currentItemId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"font-weight:bold;\">{1}<a class=\"menutreelink_a\">{0}</a></span></div>", Text, radio);
                    }
                    else
                    {
                        sb1.AppendFormat(" {1}<a class=\"menutreelink\"><span style=\"font-weight:bold;margin-top:50px\">{0}</span></a></div>", Text, radio);
                    }
                }
                else
                {
                    if (currentItemId == Id)
                    {
                        sb1.AppendFormat(" <span style=\"font-weight:bold;\">{1}<a class=\"menutreelink_a\">{0}</a></span></div>", Text, radio);
                    }
                    else
                    if (highlight)
                    {
                        sb1.AppendFormat(" {1}<a class=\"menutreelink_a\">{0}</a></div>", Text, radio);
                    }
                    else
                    {
                        sb1.AppendFormat(" {1}<a class=\"menutreelink\">{0}</a></div>", Text, radio);
                    }
                }
            }

            StringBuilder sb2 = new StringBuilder();

            if (Children.Count > 0)
            {
                if (currentItemId == Id)
                {
                    foreach (PublicMenuTreeItem item in Children)
                    {
                        sb2.Append(item.getMenuForCmsParentSelectionHelper(currentItemId, previousParentId, true, linkNonParents, disableRadio, maxDepth, currSubtreeDepth));
                    }
                }
                else
                {
                    foreach (PublicMenuTreeItem item in Children)
                    {
                        sb2.Append(item.getMenuForCmsParentSelectionHelper(currentItemId, previousParentId, false, linkNonParents, disableRadio, maxDepth, currSubtreeDepth));
                    }
                }

                if (Parent != null)
                {
                    if (!ParentTree.ItemIsParent(Id))
                    {
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\" style=\"display:none;\">");
                    }
                    else
                    {
                        sb2.Insert(0, "\n\t<div id=\"" + divId + "\">");
                    }
                    sb2.Append("</div>");
                }
            }
            return(sb1.ToString() + sb2.ToString());
        }
Пример #15
0
        public void SetIntelliMergeOnSelfAndAllChildren(IntelliMergeType detect)
        {
            SetIntelliMergeOnSelfAndAllChildrenInternal(detect);

            ParentTree.RaiseTreeNeedsAnalysisEvent();
        }
Пример #16
0
 public Task <ParentTree> UpdateAsync(ParentTree updated)
 {
     throw new NotImplementedException();
 }
Пример #17
0
 public ParentTree Update(ParentTree updated)
 {
     throw new NotImplementedException();
 }