Customizing the Welcome Page in Xamarin Studio or MonoDevelop

Fancy original page Minimal custom page
Screenshot of Xamarin Studio 5.0 welcome page Screenshot of custom Xamarin Studio welcome page

Download: CustomWelcomePageProvider.cs

using System;

/// <summary>
/// The Mono.Addins namespace, from the "Mono.Addins" package
/// </summary>
using Mono.Addins;

/// <summary>
/// The Gtk namespace, from the "gtk-sharp" package
/// </summary>
using Gtk;

/// <summary>
/// The MonoDevelop.Ide.WelcomePage namespace, from MonoDevelop.Ide.dll
/// </summary>
/// <remarks>
/// Mac:
/// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Ide.dll
///
/// Windows:
/// C:\Program Files (x86)\Xamarin Studio\bin\MonoDevelop.Ide.dll
/// </remarks>
using MonoDevelop.Ide.WelcomePage;

/// <summary>
/// The MonoDevelop.Core namespace, from MonoDevelop.Core.dll
/// </summary>
/// <remarks>
/// Mac:
/// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Core.dll
///
/// Windows:
/// C:\Program Files (x86)\Xamarin Studio\bin\MonoDevelop.Core.dll
/// </remarks>
using MonoDevelop.Core;


/// <summary>
/// Mark this assembly as containing addin extensions
/// </summary>
[assembly:Addin]


/// <summary>
/// Specify a dependency on the "MonoDevelop.Ide" `AddinRoot`
/// </summary>
/// <remarks>
/// The MonoDevelop.Ide `AddinRoot` is defined here:
/// https://github.com/mono/monodevelop/blob/d54151b1/main/src/core/MonoDevelop.Ide/AddinInfo.cs#L5-L6
///
/// This dependency _must_ be declared to allow use of the
/// `IWelcomePageProvider` extension point, which is defined here:
/// https://github.com/mono/monodevelop/blob/0f741592/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomePageProvider.cs#L31
/// </remarks>
[assembly:AddinDependency("MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)]

namespace MonoDevelop.CustomWelcomePage
{
    /// <summary>
    /// Specify that `CustomWelcomePageProvider` should be included when
    /// Xamarin Studio gets the list of available extension nodes via
    /// `AddinManager`.
    /// </summary>
    /// <remarks>
    /// The `InsertBefore` attribute is required to get the custom
    /// welcome page to appear in Xamarin Studio. If this attribute is
    /// left out, the `IWelcomePageProvider` provided by the Xamarin.Ide
    /// addin will take precedence.
    ///
    /// `XamarinWelcomePageProvider` is defined in:
    ///
    /// Mac:
    /// /Applications/Xamarin Studio.app/Contents/MacOS/lib/monodevelop/AddIns/Xamarin.Ide/Xamarin.Ide.dll
    ///
    /// Windows:
    /// C:\Program Files (x86)\Xamarin Studio\bin\Xamarin.Ide.dll
    /// </remarks>
    [Extension(InsertBefore = "Xamarin.Ide.WelcomePage.XamarinWelcomePageProvider")]

    /// <summary>
    /// The addin class that provides the custom welcome page widget.
    /// </summary>
    public class CustomWelcomePageProvider : IWelcomePageProvider
    {
        /// <summary>
        /// Creates the widget.
        /// </summary>
        /// <remarks>
        /// This example uses `WelcomePageRecentProjectsList()`
        /// to show the recent projects list.
        /// </remarks>
        public Widget CreateWidget()
        {
            var widget = new EventBox();
            var alignment = new Alignment(0, 0, 1, 1);
            var row = new WelcomePageRow(
                          new WelcomePageRecentProjectsList(
                              GettextCatalog.GetString("Solutions"),
                              10)
                      );
            alignment.Add(row);
            widget.Add(alignment);

            widget.ShowAll();

            return widget;
        }
    }
}

Compile and Install

  1. Add CustomWelcomePageProvider.cs to a C# library project, add the necessary references, and compile it.

  2. Copy the resulting .dll file to the Xamarin Studio Addins directory, optionally within its own subdirectory.

    Mac ~/Library/Application Support/XamarinStudio-5.0/LocalInstall/Addins
    Windows %LOCALAPPDATA%\XamarinStudio-5.0\LocalInstall\Addins
  3. Launch Xamarin Studio.

Links

Mono.Addins HelloWorld sample

Simple example of the Mono.Addins APIs. You can experiment with this to understand how ExtensionAttribute.InsertBefore and AddinManager.Initialize() work.

Mono.Addins documentation

Documentation for Mono.Addins. Keep in mind that Mono.Addins is a general extension library for .NET programs. It is not specific to Xamarin Studio / MonoDevelop.

Creating a Simple MonoDevelop Add-in

Step-by-step guide. Unlike the CustomWelcomePageProvider example, it uses XML to define the extension point.

Found a mistake?

Submit a comment or correction

License

MIT License. See the LICENSE file.

Updates

02 Dec 2018 Add MIT License because placing in the public domain is not supported in all jurisdictions.
03 Jul 2014 Rewording
29 Jun 2014 License
21 Jun 2014 Posted