private void SetRank(int rank) { ArrayList rankWords = new ArrayList(4); rankWords.AddRange(new string[] { "best", "1", "2", "3" }); RemoveKeywords(rankWords); switch (rank) { case 0: KeywordList.AddRange(new string[] { "1", "best" }); break; case 1: KeywordList.Add("1"); break; case 2: KeywordList.Add("2"); break; case 3: KeywordList.Add("3"); break; } KeywordList.Sort(); }
private void SetRank(int rank) { // rebuilding the keyword list this way is necessary, otherwise, other recently selected List View items are getting promoted // maybe there is a shared pointer reference or something to the keywordlist // basically I have no idea why this line of code is necessary, but it is necessary _keywordList = new List <string>(_keywordList); List <string> rankWords = new List <string>(4); rankWords.AddRange(new string[] { "best", "1", "2", "3" }); RemoveKeywords(rankWords); switch (rank) { case 0: KeywordList.AddRange(new string[] { "1", "best" }); break; case 1: KeywordList.Add("1"); break; case 2: KeywordList.Add("2"); break; case 3: KeywordList.Add("3"); break; } KeywordList.Sort(); }
public void AddKeywords(ArrayList keywords) { foreach (string keyword in keywords) { if (!KeywordList.Contains(keyword)) { KeywordList.Add(keyword); } } KeywordList.Sort(); }