Exemple #1
0
 private void btn_AddGroup_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(RichTextBoxHepler.GetText(rtb_GroupMembers)) && !string.IsNullOrEmpty(RichTextBoxHepler.GetText(rtb_Presenter)))
     {
         string presenter = RichTextBoxHepler.GetText(rtb_Presenter).Replace(":", ":").Replace("/", "/").Replace("?", "?").Replace(",", "][").Trim();
         string members   = RichTextBoxHepler.GetText(rtb_GroupMembers).Replace(":", ":").Trim();
         if (!string.IsNullOrEmpty(OriginalSearchWord) && OriginalSearchWord != tbx_TitleKeyword.Text)
         {
             members = members + "," + OriginalSearchWord;
         }
         if (presenter.LastIndexOf(',') == presenter.Length - 1)
         {
             presenter = presenter.Substring(0, presenter.Length - 2);
         }
         groups.Add(new Group
         {
             Enable    = true,
             Presenter = "[" + presenter + "]",
             Members   = members
         });
         groups = new ObservableCollection <Group>(groups.OrderBy(i => i.Presenter));
         lView_Groups.ItemsSource = groups;
         lView_Groups.Items.Refresh();
         RichTextBoxHepler.SetText(rtb_Presenter, "");
         RichTextBoxHepler.SetText(rtb_GroupMembers, "");
         tbx_TitleKeyword.Text            = "";
         tbx_AnidbID.Text                 = "";
         cbox_AddKeywordToGroup.IsChecked = false;
     }
 }
Exemple #2
0
 private void btn_UpdateGroup_Click(object sender, RoutedEventArgs e)
 {
     if (lView_Groups.SelectedItems.Count == 1 && !string.IsNullOrEmpty(RichTextBoxHepler.GetText(rtb_GroupMembers)) && !string.IsNullOrEmpty(RichTextBoxHepler.GetText(rtb_Presenter)))
     {
         ((Group)lView_Groups.SelectedItem).Members   = RichTextBoxHepler.GetText(rtb_GroupMembers);
         ((Group)lView_Groups.SelectedItem).Presenter = RichTextBoxHepler.GetText(rtb_Presenter);
         btn_UpdateGroup.IsEnabled = false;
         //lView_Groups.SelectedItem = null;
         groups = new ObservableCollection <Group>(groups.OrderBy(i => i.Presenter));
         lView_Groups.ItemsSource = groups;
         lView_Groups.Items.Refresh();
         RichTextBoxHepler.SetText(rtb_GroupMembers, "");
         RichTextBoxHepler.SetText(rtb_Presenter, "");
     }
 }