private static IAction RegisterBlogExtensionAction(IBlogExtension extension) { BlogExtensionAction extAction = new BlogExtensionAction(extension); Core.ActionManager.RegisterContextMenuAction(extAction, "BlogExtensions", ListAnchor.Last, extension.DisplayName, null, "RSSItem", null); return(extAction); }
/// <summary> /// Composes the blog posting and submits via the given extension. /// If the extension does not support editing UI, own UI is shown. /// </summary> /// <param name="extension">IBlogExtension-implementing object to which the blog item will be submitted for publishing.</param> /// <param name="item">An item that provides the base text for composing the blog post.</param> /// <param name="feed">A feed from which the <paramref name="item"/> originates.</param> public static void Compose(IBlogExtension extension, IResource item, IResource feed) { BlogExtensionComposer composer = new BlogExtensionComposer(extension, item, feed); // Display editing UI if the extension does not provide its own if (!extension.HasEditingGUI) { composer.Show(); // This will handle submit, when done } else // Extension has its own UI, submit immediately { composer.Submit(false); // False — do not take values from UI } }
/// <summary> /// Walk all the assemblies in the specified directory looking /// for classes that implements Syndication.Extensibility.IBlogExtension. /// </summary> /// <param name="path">path to search for service assemblies</param> /// <returns>ArrayList containing suitable processors found</returns> /// <permission cref="ReflectionPermission">Used to find extensions</permission> public static IList <IBlogExtension> SearchForIBlogExtensions(string path) { AppDomain loaderDomain = null; try { Type managerType = typeof(ServiceManager); string fullPath = RssBanditApplication.GetPlugInPath(); loaderDomain = CreateLoaderDomain(RssBanditApplication.GetPlugInRelativePath()); ServiceManager srvFinder = (ServiceManager)loaderDomain.CreateInstanceAndUnwrap( Assembly.GetAssembly(managerType).FullName, managerType.FullName); IEnumerable <Type> extensions = srvFinder.SearchForIBlogExtensionTypes(fullPath); List <IBlogExtension> extensionInstances = new List <IBlogExtension>(); foreach (Type foundType in extensions) { if (foundType.Equals(typeof(IBlogExtension))) { continue; } try { IBlogExtension extension = (IBlogExtension)Activator.CreateInstance(foundType); extensionInstances.Add(extension); } catch (Exception ex) { _log.Error("Plugin of type '" + foundType.FullName + "' could not be activated.", ex); } } return(extensionInstances); } finally { if (loaderDomain != null) { AppDomain.Unload(loaderDomain); } } }
/// <summary> /// Initializes the object. /// </summary> /// <param name="extension">IBlogExtension-implementing object to which the blog item will be submitted for publishing.</param> /// <param name="item">An item that provides the base text for composing the blog post.</param> /// <param name="feed">A feed from which the <paramref name="item"/> originates.</param> protected BlogExtensionComposer(IBlogExtension extension, IResource item, IResource feed) { // Store the parameters _extension = extension; _item = item; _feed = feed; // Prepare for loading the icons Assembly assembly = Assembly.GetExecutingAssembly(); // // Required for Windows Form Designer support // InitializeComponentSelf(); // Assign a context provider to the toolbar _toolbar.ContextProvider = this; // Add the Submit icon string sGroup = "File"; _toolbar.ActionManager.RegisterActionGroup(sGroup, ListAnchor.First); _toolbar.ActionManager.RegisterAction( new MethodInvokerAction(new ActionExecuteDelegate(OnSubmitAction), new ActionUpdateDelegate(OnUpdateSubmitAction)), sGroup, ListAnchor.Last, JetBrains.Omea.RSSPlugin.RSSPlugin.LoadIconFromAssembly("BlogExtensionComposer.Submit.ico"), "&Submit", "Submit (Ctrl+Enter)", null, null); // Load the window icon. Icon = JetBrains.Omea.RSSPlugin.RSSPlugin.LoadIconFromAssembly("BlogExtensionComposer.Window.ico"); // Populate the editing fields with initial values _txtTitle.Text = _item.GetPropText(Core.Props.Subject); _htmled.Html = "<html>\n<body>\n" + _item.GetPropText(Core.Props.LongBody) + "\n</body>\n</html>\n"; }
public BlogExtensionAction(IBlogExtension extension) { _extension = extension; }
public BlogExtensionData(string fileName, IBlogExtension blogExtension, IAction extAction) { _fileName = fileName; _blogExtension = blogExtension; _action = extAction; }