It has been a long time since a worked on Finch, but today I have added all of the promised features. It all seems to work, but obviously, it needs some testing. Finch is now feature complete for the 1.0 release.
New features are:
- Category support (even in .Text, where other tools based upon the MetaBlogAPI crash when updating a post in .Text, I decided to create a specific .Text work-around, because I use it myself)
- Shortcuts in the editor (you get a menu with frequently used phrases and utilities like “Make bold“ and “Insert date“). This is based upon an XML file that you can edit to fit your most frequent phrases.
- Several small bug fixes around delete/undelete
- An Exit option in the menu that will really end the process and not just hide it
- The entry screen for the service Url is a bit more helpful
Some time ago, I published a catalog web part that reads its content from a normal .ASCX file. One of the comments on this posting suggested a better use of generics in the code and I learned a bit more about how the web part creation in the WebPartManager control works, so I cleaned up the code and it got easier to understand along the way. For more explanation, check the original post. Here is the new and improved code:
public class FileCatalogPart : CatalogPart
{
public FileCatalogPart()
{
}
private string _templateLocation;
public string TemplateLocation
{
get
{
return _templateLocation;
}
set
{
_templateLocation = value;
}
}
Dictionary<WebPartDescription, WebPart> webparts = new Dictionary<WebPartDescription, WebPart>();
public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
{
webparts.Clear();
if (TemplateLocation != null)
{
Control container = Page.LoadControl(TemplateLocation);
if (container != null)
{
// You cannot directy iterate over the Controls collection, an excption
// is thrown that the collection was changed while iterating
ArrayList iterate = new ArrayList(container.Controls);
foreach (Control child in iterate)
{
WebPart wp = null;
if (child is WebPart)
{
wp = (WebPart)child;
}
else
{
if (!( child is LiteralControl))
{
wp = this.WebPartManager.CreateWebPart(child);
}
}
if (wp != null)
{
WebPartDescription desc = new WebPartDescription(wp);
webparts[desc] = wp;
}
}
}
}
return new WebPartDescriptionCollection(webparts.Keys);
}
public override WebPart GetWebPart(WebPartDescription description)
{
return (WebPart)webparts[description];
}
}