/// <summary> /// Called by <see cref="FeedSource"/> if a category is moved from outside the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnMovedCategory(object sender, FeedSource.CategoryChangedEventArgs e) { FeedSourceEntry entry = sourceManager.SourceOf((FeedSource)sender); InvokeOnGui(delegate { TreeFeedsNodeBase parent, tn = TreeHelper.FindCategoryNode(guiMain.GetSubscriptionRootNode(entry), e.CategoryName); int index = e.NewCategoryName.LastIndexOf(FeedSource.CategorySeparator); if (index == -1) { parent = guiMain.GetSubscriptionRootNode(entry); } else { parent = TreeHelper.FindCategoryNode(guiMain.GetSubscriptionRootNode(entry), e.NewCategoryName.Substring(0, index)); } if (tn != null && parent != null) { guiMain.MoveNode(tn, parent, false); SubscriptionModified(entry, NewsFeedProperty.FeedCategoryAdded); } }); }
/// <summary> /// Called during the drawing operation of a UIElement for a specific phase /// of the operation. This will only be called for the phases returned /// from the GetPhasesToFilter method. /// </summary> /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param> /// <param name="drawParams">Exposes properties required for drawing an element (e.g. Element, Graphics, InvalidRect etc.)</param> /// <returns> /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped. /// </returns> bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { UltraTreeNode treeNode = drawParams.Element.GetContext(typeof(UltraTreeNode), true) as UltraTreeNode; if (treeNode != null) { var scale = (float)drawParams.ControlElement.Control.DeviceDpi / 96; var sz300 = (int)(300 * scale); TreeFeedsNodeBase feedsNode = treeNode as TreeFeedsNodeBase; if (drawPhase == DrawPhase.AfterDrawElement && feedsNode != null && feedsNode.Control != null) { int unread = feedsNode.UnreadCount; if (unread > 0) { // this image width is a workaround to extend the nods's clickable // area to include the unread count visual representation... int clickableAreaExtenderImageWidth = feedsNode.Control.RightImagesSize.Width; string st = String.Format("({0})", unread); Rectangle ur = drawParams.Element.RectInsideBorders; using (Brush unreadColorBrush = new SolidBrush(FontColorHelper.UnreadCounterColor)) { drawParams.Graphics.DrawString(st, FontColorHelper.UnreadCounterFont, unreadColorBrush, ur.X + ur.Width - clickableAreaExtenderImageWidth, ur.Y, StringFormat.GenericDefault); } return(true); } return(false); } if (treeNode.Level == 0) { RectangleF initialRect = drawParams.Element.RectInsideBorders; RectangleF r = new RectangleF(initialRect.Left, initialRect.Top, 0, 0); // this SHOULD be the horizontal scrolling area, but how do we get this (?): r.Width = treeNode.Control.DisplayRectangle.Width + sz300; r.Height = treeNode.ItemHeightResolved; TreeFeedsNodeGroupHeaderPainter.PaintOutlook2003Header(drawParams.Graphics, r); return(true); } } // To return FALSE from this method indicates that the element should draw itself as normal. // To return TRUE from this method indicates that the element should not draw itself. // Return true to prevent further drawing by the element return(false); }
/// <summary> /// Called by FeedSource if feed is renamed from outside the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnRenamedFeed(object sender, FeedSource.FeedRenamedEventArgs e) { FeedSourceEntry entry = sourceManager.SourceOf((FeedSource)sender); InvokeOnGui(delegate { TreeFeedsNodeBase tn = TreeHelper.FindNode(guiMain.GetSubscriptionRootNode(entry), e.FeedUrl); if (tn != null) { guiMain.RenameTreeNode(tn, e.NewName); SubscriptionModified(entry, NewsFeedProperty.FeedTitle); } }); }
/// <summary> /// Called by FeedSource if a category is deleted from outside the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDeletedCategory(object sender, FeedSource.CategoryEventArgs e) { FeedSourceEntry entry = sourceManager.SourceOf((FeedSource)sender); InvokeOnGui(delegate { TreeFeedsNodeBase tn = TreeHelper.FindChildNode(guiMain.GetRoot(RootFolderType.MyFeeds), e.CategoryName, FeedNodeType.Category); if (tn != null) { guiMain.DeleteCategory(tn); SubscriptionModified(entry, NewsFeedProperty.FeedCategoryRemoved); } }); }
/// <summary> /// Called by FeedSource if a category is renamed from outside the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnRenamedCategory(object sender, FeedSource.CategoryChangedEventArgs e) { FeedSourceEntry entry = sourceManager.SourceOf((FeedSource)sender); InvokeOnGui(delegate { TreeFeedsNodeBase tn = TreeHelper.FindChildNode(guiMain.GetSubscriptionRootNode(entry), e.CategoryName, FeedNodeType.Category); if (tn != null) { guiMain.RenameTreeNode(tn, e.NewCategoryName); SubscriptionModified(entry, NewsFeedProperty.FeedCategoryAdded); } }); }
/// <summary> /// Called by FeedSource if feed moved from outside the application /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="NewsComponents.FeedSource.FeedMovedEventArgs"/> instance containing the event data.</param> private void OnMovedFeed(object sender, FeedSource.FeedMovedEventArgs e) { FeedSourceEntry entry = sourceManager.SourceOf((FeedSource)sender); InvokeOnGui(delegate { TreeFeedsNodeBase start = guiMain.GetSubscriptionRootNode(entry); TreeFeedsNodeBase tn = TreeHelper.FindNode(start, e.FeedUrl); TreeFeedsNodeBase parent = TreeHelper.FindCategoryNode(start, e.NewCategory); if (tn != null && parent != null) { guiMain.MoveNode(tn, parent, false); SubscriptionModified(entry, NewsFeedProperty.FeedAdded); } }); }
/// <summary> /// Called to show the small toast alert window on new items received. /// </summary> /// <param name="node">Feed node where items received</param> /// <param name="dispItemCount">unread items count to display</param> /// <param name="items">list of the newest NewsItem's received. We assume, /// they are sorted with the newest items first!</param> /// <remarks> /// The parameter <c>dispItemCount</c> controls, if and how many item links /// are displayed in the window. This means; if 0 (zero) or lower than zero, nothing /// happens (no window). If one or more is specified, it displayes up to three items /// in the window. This way you can control, if there was allready e.g. 3 new items on the /// feed, and just only one new was received, that the window display only a link /// to that one newest item by specify 1 (one) as the parameter. /// </remarks> public void Alert(TreeFeedsNodeBase node, int dispItemCount, IList <INewsItem> items) { if (node == null || dispItemCount < 0 || items == null || items.Count == 0) { return; } int unreadCount = items.Aggregate(0, (i, item) => { if (item.BeenRead) { return(i); } return(i + 1); }); var firstItem = items[0]; if (_alertWindow != null && unreadCount > dispItemCount && !_alertWindow.IsOpen(NewsItemAlertWindowKey)) { UltraDesktopAlertShowWindowInfo windowInfo = new UltraDesktopAlertShowWindowInfo(); windowInfo.Key = NewsItemAlertWindowKey; windowInfo.PinButtonVisible = true; windowInfo.Image = node.ImageResolved; windowInfo.Data = firstItem; windowInfo.Caption = "<font face=\"Tahoma\">{0} ({1})</font>" .FormatWith(node.Text, unreadCount - dispItemCount); windowInfo.Text = String.Format("<hr NoShade=\"true\" size=\"1px\"/><font face=\"Tahoma\"><span style=\"font-style:italic_x003B_\">{0}</span></font>", StringHelper.ShortenByEllipsis(firstItem.Title, maxItemTextWith)); windowInfo.FooterText = "<font face=\"Tahoma\">{0}</font>" .FormatWith(SR.MenuShowFeedPropertiesCaption); if (_preferences.AllowAppEventSounds) { windowInfo.Sound = Resource.ApplicationSound.GetSoundStream(Resource.ApplicationSound.NewItemsReceived); } _alertWindow.Show(windowInfo); } }
public //ExportFeedsDialog(TreeFeedsNodeBase exportRootNode, Font treeFont, ImageList treeImages) ExportFeedsDialog(IDictionary <FeedSourceEntry, TreeFeedsNodeBase> sourcesNnodes, FeedSourceEntry selectedSource, Font treeFont, ImageList treeImages) : this() { this.sourcesNnodes = sourcesNnodes; selectedSource = selectedSource ?? sourcesNnodes.Keys.First(); TreeFeedsNodeBase exportRootNode = sourcesNnodes[selectedSource]; this.treeExportFeedsSelection.Font = treeFont; this.treeExportFeedsSelection.ImageList = treeImages; TreeHelper.CopyNodes(exportRootNode, this.treeExportFeedsSelection, true); if (this.treeExportFeedsSelection.Nodes.Count > 0) { this.treeExportFeedsSelection.Nodes[0].Expand(); } foreach (FeedSourceEntry fsid in sourcesNnodes.Keys) { this.cboFeedSources.Items.Add(fsid.Name); } this.cboFeedSources.Text = selectedSource.Name; }
public HistoryEntry(TreeFeedsNodeBase feedsNode, INewsItem item) { this.Node = feedsNode; this.Item = item; }