MetroSidebar is an application platform for creating tiles using .NET WPF C#/VB. If you are a .NET developer, you are also a MetroSidebar developer!
Beyond the standard .NET features you are accustomed to, MetroSidebar gives you a set special APIs.
MetroSidebar also takes care of all the “desktop” stuff you don’t want to think about, like installers, so you can focus purely on tile development.
In an effort to kick-start your MetroSidebar tile development, and to promote good MetroSidebar programming standards, we’ve prepared a tile sample. You can download the MetroSidebar Tile Samples from GitHub You can use it as a starting point to understand the structure of a MetroSidebar tile.
Technically speaking, a MetroSidebar tile is simply a collection of files (ini/dll/images) contained within a directory. In order for MetroSidebar to understand how to interact with this folder it looks for a file in the root directory called tile.ini. This is a simple ini file that tells MetroSidebar everything it needs to know about your tile.
tile.ini from MetroSidebar HelloWorld:
[MetroSidebar]
Name=Hello World
Publisher=MetroSidebar
Version=1.0.0
As you can see each MetroSidebar tile requires:
tile.dll Is the application developed using .NET WPF C#/VB which contains everything
Now that you have a sense for the contents of the MetroSidebar Tile, start having some fun and making some changes! Simply edit any file, save it.
Let's open HelloWorld.sln project with Microsoft Visual Studio.
The MetroSidebar tile has two interface elements that users may interact with;
As you may notice MetroSidebar tile uses the reference MetroSidebarTile from MetroSidebarTile.dll
MetroSidebarTile.dll is important because:
SettingsManager _settingsManager = new SettingsManager();
_settingsManager.ID = this;
SettingsManager.SettingData _mySetting = new SettingsManager.SettingData() { keyword = "mysetting", value = myvalue };
List
SettingsCollection.Add(_mySetting);
_settingsManager.SaveSettings(SettingsCollection);
SettingsManager _settingsManager = new SettingsManager();
_settingsManager.ID = this;
string _mySetting = _settingsManager.GetSetting("mysetting");
SettingsManager _settingsManager = new SettingsManager();
_settingsManager.ID = this;
string _mySettingDirectory = _settingsManager.SettingsFolder;
SettingsManager _settingsManager = new SettingsManager();
_settingsManager.ID = this;
string _myRootDirectory = _settingsManager.Path;
tile.cs contains the basic information for your tile.
namespace HelloWorld
{
public class Tile : MetroSidebarTile.Tile
{
public UserControl MainControl()
{
return new MainControl();
}
public Window SettingsWindow()
{
return null;
}
public int Height()
{
return 120;
}
public int LargeHeight()
{
return 264;
}
public bool Separator()
{
return true;
}
public string Background()
{
return @"#d34500";
}
}
}
You'll note the SettingsWindow() in this example is null, this means the tile has no settings window.
If Height() has the same value as LargeHeight() then the tile is not resizable.
Now that you understand the tile.ini and developed your tile, let's add the MetroSidebar Tile and see what happens.
Voila! The MetroSidebar tile was added! You should see your tile on MetroSidebar. and you're now a MetroSidebar developer.