Beispiel #1
0
        private void NodeChecked(object sender, TreeListNodeChangedEventArgs e)
        {
            if (e.ChangeType == NodeChangeType.CheckBox)
            {
                var tmp = (RegionNode)e.Node.Content;

                if (e.Node.IsChecked != null)
                {
                    AddCheckedRegions(tmp.Name, e.Node.IsChecked.Value);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Раскрываем ветку дерева при добавлении нового объекта
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TreeListView_OnNodeChanged(object sender, TreeListNodeChangedEventArgs e)
        {
            if (e.ChangeType != NodeChangeType.Add || e.Node.ParentNode == null)
            {
                return;
            }

            var parent = e.Node.ParentNode;

            if (!parent.IsExpanded)
            {
                parent.ExpandAll();
            }
        }
Beispiel #3
0
 private void OnNodeChanged(object sender, TreeListNodeChangedEventArgs e)
 {
     CurrentNode = e.Node;
 }
        private void MutantsTreeList_OnNodeChanged(object sender, TreeListNodeChangedEventArgs e)
        {
            var context     = (MutantViewerViewModel)DataContext;
            var nodeContent = (MutantDetail)e.Node.Content;

            if (e.ChangeType == NodeChangeType.Add)
            {
                Dispatcher?.BeginInvoke(new Action(() =>
                {
                    var nodeParentNode = e.Node.ParentNode;
                    if (nodeParentNode != null && !nodeParentNode.IsExpanded)
                    {
                        nodeParentNode.IsExpanded = true;
                    }

                    if (nodeParentNode != null && !nodeParentNode.IsChecked.GetValueOrDefault())
                    {
                        nodeParentNode.IsChecked = true;
                    }

                    if (context.SelectedMutants.All(x => x.Id != nodeContent.Id))
                    {
                        context.SelectedMutants.Add(nodeContent);
                    }
                }));
            }

            if (e.ChangeType == NodeChangeType.CheckBox)
            {
                if (e.Node.IsChecked.GetValueOrDefault())
                {
                    if (context.SelectedMutants.All(x => x.Id != nodeContent.Id))
                    {
                        context.SelectedMutants.Add(nodeContent);
                    }

                    foreach (var mutantDetail in context.MutantsDetails.Where(x => x.ParentId == nodeContent.Id))
                    {
                        if (context.SelectedMutants.All(x => x.Id != mutantDetail.Id))
                        {
                            context.SelectedMutants.Add(mutantDetail);
                        }

                        foreach (var detail in context.MutantsDetails.Where(x => x.ParentId == mutantDetail.Id))
                        {
                            if (context.SelectedMutants.All(x => x.Id != detail.Id))
                            {
                                context.SelectedMutants.Add(detail);
                            }
                        }
                    }
                }
                else
                {
                    foreach (var mutantDetail in context.MutantsDetails.Where(x => x.ParentId == nodeContent.Id))
                    {
                        foreach (var detail in context.MutantsDetails.Where(x => x.ParentId == mutantDetail.Id))
                        {
                            context.SelectedMutants.Remove(detail);
                        }

                        context.SelectedMutants.Remove(mutantDetail);
                    }

                    context.SelectedMutants.Remove(nodeContent);
                }
            }
        }