public SignatureTreeViewModel(TreeViewModelBase parent, SignatureTreeItem value)
            : base(parent)
        {
            if (value == null) throw new ArgumentNullException(nameof(value));

            _children = new ObservableCollectionEx<TreeViewModelBase>();
            _readonlyChildren = new ReadOnlyObservableCollection<TreeViewModelBase>(_children);

            this.Value = value;
        }
        public SignatureTreeViewItem(SignatureTreeItem value)
            : base()
        {
            if (value == null) throw new ArgumentNullException("value");

            base.ItemsSource = _listViewItemCollection;
            base.Header = _header;
            base.IsExpanded = true;

            base.RequestBringIntoView += (object sender, RequestBringIntoViewEventArgs e) =>
            {
                e.Handled = true;
            };

            this.Value = value;
        }
Ejemplo n.º 3
0
        private SignatureTreeItem GetSignatureTreeViewItem(string leaderSignature)
        {
            var signatureTreeItems = new List<SignatureTreeItem>();
            var workSignatureTreeItems = new List<SignatureTreeItem>();

            var checkedSignatures = new HashSet<string>();
            var workCheckedSignatures = new HashSet<string>();

            {
                LinkItem leaderLinkItem;
                if (!_cache_LinkItems.TryGetValue(leaderSignature, out leaderLinkItem)) return null;

                signatureTreeItems.Add(new SignatureTreeItem(leaderLinkItem));
                checkedSignatures.Add(leaderSignature);
            }

            {
                int index = 0;

                for (;;)
                {
                    for (; index < signatureTreeItems.Count && index < 32 * 1024; index++)
                    {
                        var sortedList = signatureTreeItems[index].LinkItem.TrustSignatures.ToList();
                        sortedList.Sort();

                        foreach (var trustSignature in sortedList)
                        {
                            if (checkedSignatures.Contains(trustSignature)) continue;

                            LinkItem tempLinkItem;
                            if (!_cache_LinkItems.TryGetValue(trustSignature, out tempLinkItem)) continue;

                            var tempTreeItem = new SignatureTreeItem(tempLinkItem);
                            signatureTreeItems[index].Children.Add(tempTreeItem);

                            workSignatureTreeItems.Add(tempTreeItem);
                            workCheckedSignatures.Add(trustSignature);
                        }
                    }

                    if (workSignatureTreeItems.Count == 0) break;

                    signatureTreeItems.AddRange(workSignatureTreeItems);
                    workSignatureTreeItems.Clear();

                    checkedSignatures.UnionWith(workCheckedSignatures);
                    workCheckedSignatures.Clear();
                }
            }

            return signatureTreeItems[0];
        }