This project has moved. For the latest updates, please go here.

Project Creation

  • Create a new Class Library project in Visual Studio
  • Add a reference to the following components
    • DroidExplorer.Core (Required)
    • DroidExplorer.Core.UI (Optional)

Plugin Creation

Here is an example of a plugin that displays a debug console window when the tool strip button is clicked

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DroidExplorer.Core.Plugins;
using DroidExplorer.UI;
using System.Windows.Forms;
using DroidExplorer.Plugins.UI;

namespace DroidExplorer.Plugins {
  public class DebugInfo : IPlugin {

    public DebugInfo ( IPluginHost pluginHost ) {
      this.PluginHost = pluginHost;
    }

    #region IPlugin Members

    /// <summary>Gets the name of the plugin</summary>
    public string Name {
      get { return "Debug Console"; }
    }

    /// <summary>Gets the plugin description</summary>
    public string Description {
      get { return "Debug Console Window"; }
    }

    /// <summary>Gets if the plugin has configuration dialog</summary>
    public bool HasConfiguration {
      get { return false; }
    }

    /// <summary>Gets the tool strip button image</summary>
    public System.Drawing.Image Image {
      get { return Properties.Resources.Debug; }
    }

    /// <summary>Gets the text used for the tool strip button</summary>
    public string Text {
      get { return "Debug Console"; }
    }

    /// <summary>Gets if a tool strip button should be created for the plugin</summary>
    public bool CreateToolButton {
      get { return true; }
    }

    /// <summary>Gets the plugin menu display style</summary>
    public System.Windows.Forms.ToolStripItemDisplayStyle DisplayStyle {
      get { return System.Windows.Forms.ToolStripItemDisplayStyle.Image; }
    }
    
    private DebugConsole _console = null;
    internal DebugConsole ConsoleWindow {
      get {
        if ( _console == null || _console.IsDisposed ) {
          _console = new DebugConsole ( );
        }
        return _console;
      }
    }

    /// <summary>Executes the plugins task</summary>
    public void Execute ( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory ) {
      ConsoleWindow.StartPosition = FormStartPosition.Manual;
      ConsoleWindow.Top = this.PluginHost.Bottom;
      ConsoleWindow.Left = this.PluginHost.Left;
      ConsoleWindow.Width = this.PluginHost.Width;
      ConsoleWindow.Height = Screen.FromControl ( this.PluginHost.GetHostControl ( ) ).Bounds.Bottom - this.PluginHost.Bottom;
      if ( !this.ConsoleWindow.Visible ) {
        ConsoleWindow.Show ( this.PluginHost.GetHostWindow ( ) );
      }
    }

    /// <summary>Executes the plugins task</summary>
    public void Execute ( IPluginHost pluginHost ) {
      Execute ( pluginHost, new DroidExplorer.Core.IO.LinuxDirectoryInfo ( "/" ) );
    }

    /// <summary>Gets the PluginHost object</summary>
    public IPluginHost PluginHost {
      get;
      set;
    }

    public void ShowConfiguration ( ) {

    }

    #endregion
  }
}

Last edited Sep 9, 2009 at 1:12 PM by camalot, version 1