private void tbx_TitleKeyword_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { AnidbResult ar = GroupHandler.SearchAniDB(anititles, tbx_TitleKeyword.Text.Trim()); if (ar != null) { tbx_AnidbID.Text = ar.aid; RichTextBoxHepler.SetText(rtb_GroupMembers, ar.keywords); //if (string.IsNullOrEmpty(RichTextBoxHepler.GetText(rtb_Presenter))) //{ RichTextBoxHepler.SetText(rtb_Presenter, ar.presenter); //} } else { RichTextBoxHepler.SetText(rtb_Presenter, ""); } }
private void lView_TargetList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lView_TargetList.SelectedItems.Count > 0) { btn_Remove_Item.IsEnabled = true; if (lView_TargetList.SelectedItems.Count == 1) { tbx_TitleKeyword.Text = string.IsNullOrEmpty(((ItemToRename)lView_TargetList.SelectedItems[0]).AlterKey) ? GroupHandler.GetTitleKeyword(((ItemToRename)lView_TargetList.SelectedItems[0]).Before) : ((ItemToRename)lView_TargetList.SelectedItems[0]).AlterKey; OriginalSearchWord = tbx_TitleKeyword.Text; AnidbResult ar = GroupHandler.SearchAniDB(anititles, tbx_TitleKeyword.Text); if (ar != null) { tbx_AnidbID.Text = ar.aid; RichTextBoxHepler.SetText(rtb_Presenter, ar.presenter); RichTextBoxHepler.SetText(rtb_GroupMembers, ar.keywords); } else { Group presetgroup = groups.Where(x => x.Members.ToLowerInvariant().Contains(tbx_TitleKeyword.Text.ToLowerInvariant())).FirstOrDefault(); if (presetgroup != null) { RichTextBoxHepler.SetText(rtb_Presenter, presetgroup.Presenter); RichTextBoxHepler.SetText(rtb_GroupMembers, presetgroup.Members); lView_Groups.SelectedItem = presetgroup; lView_Groups.Items.Refresh(); lView_Groups.ScrollIntoView(presetgroup); } else { RichTextBoxHepler.SetText(rtb_Presenter, ""); RichTextBoxHepler.SetText(rtb_GroupMembers, ""); } } //lView_Groups.SelectedItem = null; } } else { btn_Remove_Item.IsEnabled = false; } }
private AnidbResult SearchMatchFromBothSources(string keyword) { AnidbResult ar = new AnidbResult(); if (!string.IsNullOrEmpty(keyword)) { if (keyword.Trim().ToLowerInvariant().StartsWith("anidb-") && keyword.Trim().Length > 6) { ar = GroupHandler.SearchGroups(groups, keyword.Trim(), true); } else { ar = GroupHandler.SearchGroups(groups, keyword.Trim(), false); } if (ar != null) { return(ar); } else { if (keyword.Trim().ToLowerInvariant().StartsWith("anidb-") && keyword.Trim().Length > 6) { ar = GroupHandler.SearchAniDB(anititles, keyword.Trim(), true); } else { ar = GroupHandler.SearchAniDB(anititles, keyword.Trim(), false); } if (ar != null) { return(ar); } } } return(null); }