private void _okButton_Click(object sender, RoutedEventArgs e) { lock (Settings.Instance.Global_TrustSignatures.ThisLock) { Settings.Instance.Global_TrustSignatures.Clear(); Settings.Instance.Global_TrustSignatures.AddRange(_downloadSignatureCollection); } var uploadLinkItems = new List <LinkItem>(); { var tempLinkItems = new List <LinkItem>(); foreach (var item in _uploadLinkCollection) { var linkItem = new LinkItem(); linkItem.Signature = item.Signature; linkItem.TrustSignatures.AddRange(item.TrustSignatures); linkItem.DeleteSignatures.AddRange(item.DeleteSignatures); tempLinkItems.Add(linkItem); } lock (Settings.Instance.Global_LinkItems.ThisLock) { foreach (var item in Settings.Instance.Global_LinkItems.ToArray()) { if (!tempLinkItems.Contains(item)) { Settings.Instance.Global_LinkItems.Remove(item); } } foreach (var item in tempLinkItems) { if (!Settings.Instance.Global_LinkItems.Contains(item)) { Settings.Instance.Global_LinkItems.Add(item); uploadLinkItems.Add(item); } } } } foreach (var item in uploadLinkItems) { var digitalSignature = Settings.Instance.Global_DigitalSignatures.FirstOrDefault(n => n.ToString() == item.Signature); if (digitalSignature == null) { return; } var link = new Link(item.TrustSignatures, item.DeleteSignatures); _amoebaManager.Upload(link, digitalSignature); } this.DialogResult = true; }
private IEnumerable <LinkItem> GetLinkItems(IEnumerable <string> trustSignatures) { var linkItems = new List <LinkItem>(); foreach (var trustSignature in trustSignatures) { LinkItem linkItem = null; { var link = _amoebaManager.GetLink(trustSignature); if (link != null) { Settings.Instance.Cache_Links[trustSignature] = link; } else { Settings.Instance.Cache_Links.TryGetValue(trustSignature, out link); } if (link != null) { linkItem = new LinkItem(); linkItem.Signature = trustSignature; linkItem.TrustSignatures.AddRange(link.TrustSignatures); linkItem.DeleteSignatures.AddRange(link.DeleteSignatures); } } if (linkItem == null) { linkItem = new LinkItem(); linkItem.Signature = trustSignature; } linkItems.Add(linkItem); } return(linkItems); }
public SignatureTreeItem(LinkItem linkItem) { this.LinkItem = linkItem; }
private void _okButton_Click(object sender, RoutedEventArgs e) { { List <LinkItem> downloadCollection = new List <LinkItem>(); List <LinkItem> uploadCollection = new List <LinkItem>(); foreach (var item in _downloadCollection) { var LinkItem = new LinkItem(); LinkItem.Signature = item.Signature; LinkItem.TrustSignatures.AddRange(item.TrustSignatures); LinkItem.TrustSignatures.Sort(); downloadCollection.Add(LinkItem); } foreach (var item in _uploadCollection) { var LinkItem = new LinkItem(); LinkItem.Signature = item.Signature; LinkItem.TrustSignatures.AddRange(item.TrustSignatures); LinkItem.TrustSignatures.Sort(); uploadCollection.Add(LinkItem); } foreach (var item in Settings.Instance.LinkOptionsWindow_DownloadLinkItems.ToArray()) { if (!downloadCollection.Contains(item)) { Settings.Instance.LinkOptionsWindow_DownloadLinkItems.Remove(item); } } foreach (var item in downloadCollection) { if (!Settings.Instance.LinkOptionsWindow_DownloadLinkItems.Contains(item)) { Settings.Instance.LinkOptionsWindow_DownloadLinkItems.Add(item); } } foreach (var item in Settings.Instance.LinkOptionsWindow_UploadLinkItems.ToArray()) { if (!uploadCollection.Contains(item)) { Settings.Instance.LinkOptionsWindow_UploadLinkItems.Remove(item); } } foreach (var item in uploadCollection) { if (!Settings.Instance.LinkOptionsWindow_UploadLinkItems.Contains(item)) { Settings.Instance.LinkOptionsWindow_UploadLinkItems.Add(item); { var digitalSignature = Settings.Instance.Global_DigitalSignatureCollection.FirstOrDefault(n => n.ToString() == item.Signature); if (digitalSignature == null) { return; } var link = new Link(); link.TrustSignatures.AddRange(item.TrustSignatures); _amoebaManager.Upload(link, digitalSignature); } } } } this.DialogResult = true; }