private void CollectionFromItemsString(string type) { if (type == "Authors") { // 1. Clear the collections AuthorsCollection.Clear(); // 2. Check if items string is blank if (String.IsNullOrWhiteSpace(Authors)) { return; } // 3. Add each item from item string into collection foreach (string author in Authors.Split(new string[] { ", " }, StringSplitOptions.None)) { AuthorsCollection.Add(author); } } else if (type == "Keywords") { KeywordsCollection.Clear(); if (String.IsNullOrWhiteSpace(Keywords)) { return; } foreach (string keyword in Keywords.Split(new string[] { ", " }, StringSplitOptions.None)) { KeywordsCollection.Add(keyword); } } }
public void Clear() { ID = null; Title = null; Authors = null; Keywords = null; Year = null; FileName = null; PersonalComment = null; SIC = 0; AuthorsCollection.Clear(); KeywordsCollection.Clear(); }
private async void GetAuthors() { AuthorsCollection.Clear(); await Task.Run(() => { this.SelectedRepositories.ForEach(selectedRepository => { using (var session = DbService.Instance.SessionFactory.OpenSession()) { if (string.IsNullOrEmpty(selectedRepository)) { var authors = session.QueryOver <Commit>() .SelectList(list => list.SelectGroup(commit => commit.Author)) .List <string>(); authors.ForEach(author => AuthorsCollection.Add(author)); } else { Branch branch = null; Repository repository = null; var authors = session.QueryOver <Commit>() .SelectList(list => list.SelectGroup(commit => commit.Author)) .JoinAlias(commit => commit.Branches, () => branch, JoinType.InnerJoin) .JoinAlias(() => branch.Repository, () => repository, JoinType.InnerJoin) .Where(() => repository.Name == selectedRepository).List <string>(); Application.Current.Dispatcher.BeginInvoke(new Action(() => { authors.ForEach(author => AuthorsCollection.Add(author)); })); } } }); }); }