private void SearchButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(SearchTB.Text)) { UpdateDisplayData(); } else { switch (SearchByCB.SelectedIndex) { case 0: UpdateDisplayData(RICRequestProcessor.GetArticlesByTitle(SearchTB.Text)); break; case 1: UpdateDisplayData(RICRequestProcessor.GetArticlesByText(SearchTB.Text)); break; case 2: UpdateDisplayData(RICRequestProcessor.GetArticlesByTags(SearchTB.Text)); break; case 3: MessageBox.Show(Properties.Resources.UnimplementedMessage, Properties.Resources.Unimplemented); SearchByCB.SelectedIndex = 0; break; } } }
void RemoveArticleButton_Click(object sender, RoutedEventArgs e) { if (HeadlinesLV.SelectedIndex >= 0) { ProcessRequestResult(RICRequestProcessor.Remove(CurrentData[HeadlinesLV.SelectedIndex].ID).Trim()); } UpdateDisplayData(); }
void SendButton_Click(object sender, RoutedEventArgs e) { var tags = ArticleTextTB.Text.Split('\n').Last(c => !string.IsNullOrWhiteSpace(c)); if (tags.Contains(" #")) { SendButton.IsEnabled = CancelButton.IsEnabled = false; ProcessRequestResult(RICRequestProcessor.Add(new Article { Title = ArticleTitleTB.Text, Text = ArticleTextTB.Text, Tags = tags.Split(' ').Where(c => c.StartsWith("#")).Merge(), Images = ArticleImage.UriSource })); UpdateDisplayData(); } else { NotifyUser(Properties.Resources.TagsMissingError, true); } }
void UpdateDisplayData() { UpdateDisplayData(RICRequestProcessor.Take(20)); }