private void ctxmnuRefreshChannel_Click(object sender, RoutedEventArgs e) { TLocalChannel CurrentChannel = tvChannels.SelectedItem as TLocalChannel; CurrentChannel.DownloadCompleted += new EventHandler <ItemsDownloadedEventArgs>(Channel_DownloadCompleted); CurrentChannel.DownloadItems(); }
private void Channel_LoadCompleted(object sender, EventArgs e) { TLocalChannel CurrentLocalChannel = sender as TLocalChannel; CurrentLocalChannel.LoadCompleted -= new EventHandler(Channel_LoadCompleted); this.Dispatch(() => { _RefreshItems(CurrentLocalChannel); }); }
private void _RefreshItems(TLocalChannel localChannel) { lvItems.ItemsSource = localChannel.Channel.Items.OrderByDescending(x => x.PubDate).ToList(); lvItems.Items.Refresh(); lvItems.UpdateLayout(); lvItems.ResizeLastColumn(); SetStatusRight("News updated."); }
private void Channel_DownloadCompleted(object sender, ItemsDownloadedEventArgs e) { TLocalChannel CurrentChannel = sender as TLocalChannel; CurrentChannel.DownloadCompleted -= new EventHandler <ItemsDownloadedEventArgs>(Channel_DownloadCompleted); this.Dispatch(() => { DebugDisplay.Text = _DebugDisplay(e.ResponseHeaders); _RefreshItems(CurrentChannel); }); }
private void lvItems_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 1) { SetStatusRight("Loading RSS item ..."); TItem CurrentItem = lvItems.SelectedItem as TItem; CurrentItem.IsRead = true; lvItems.Items.Refresh(); frmBrowser.Source = CurrentItem.Link.Value; TLocalChannel CurrentChannel = tvChannels.SelectedItem as TLocalChannel; CurrentChannel.Save(); } }
private void ctxmnuEncoding_Click(object sender, RoutedEventArgs e) { if (sender is MenuItem) { MenuItem CurrentMenuItem = sender as MenuItem; TLocalChannel CurrentChannel = tvChannels.SelectedItem as TLocalChannel; CurrentChannel.Channel.ChannelEncoding = Encoding.GetEncoding(CurrentMenuItem.Header.ToString()); CurrentChannel.Channel.LastBuildDate = DateTime.MinValue; CurrentChannel.Channel.Items.Clear(); CurrentChannel.Save(); CurrentChannel.Load(); lvItems.Items.Refresh(); CurrentChannel.DownloadCompleted += new EventHandler <ItemsDownloadedEventArgs>(Channel_DownloadCompleted); CurrentChannel.DownloadItems(); } }
private void tvChannels_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (e.NewValue is TLocalChannel) { TLocalChannel CurrentLocalChannel = e.NewValue as TLocalChannel; if (CurrentLocalChannel.Channel.Items == null || CurrentLocalChannel.Channel.Items.Count() == 0) { SetStatusRight("Loading news ..."); LoadChannel(CurrentLocalChannel); } else { _RefreshItems(CurrentLocalChannel); } } //e.Handled = true; }
private void ctxmnuEncoding_SubmenuOpened(object sender, RoutedEventArgs e) { TLocalChannel CurrentChannel = tvChannels.SelectedItem as TLocalChannel; if (CurrentChannel != null) { MenuItem CurrentMenuItem = sender as MenuItem; if (CurrentChannel.Channel.ChannelEncoding != null) { string EncodingName = CurrentChannel.Channel.ChannelEncoding.WebName.ToLower(); foreach (MenuItem MenuItemItem in CurrentMenuItem.Items) { if (MenuItemItem.Header.ToString().ToLower() == EncodingName) { MenuItemItem.IsChecked = true; } else { MenuItemItem.IsChecked = false; } } } } }
private void LoadChannel(TLocalChannel channel) { Trace.WriteLine(string.Format("Loading local channel \"{0}\" from disk [{1}]", channel.Name, channel.StorageFullName)); channel.LoadCompleted += new EventHandler(Channel_LoadCompleted); channel.LoadAsync(); }