rainmeter-studio/RainmeterStudio/MainClass.cs

50 lines
2.0 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using RainmeterStudio.Business;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.Core.Model;
using RainmeterStudio.Core.Storage;
2014-09-12 10:19:01 +00:00
using RainmeterStudio.Editor.ProjectEditor;
using RainmeterStudio.UI;
using RainmeterStudio.UI.Controller;
namespace RainmeterStudio
{
static class MainClass
{
[STAThread]
public static void Main()
{
// Display splash
SplashScreen splash = new SplashScreen("Resources/splash.png");
splash.Show(true);
// Initialize project manager
ProjectStorage projectStorage = new ProjectStorage();
ProjectManager projectManager = new ProjectManager(projectStorage);
// Initialize document manager
DocumentManager documentManager = new DocumentManager();
// Initialize plugin manager
PluginManager pluginManager = new PluginManager();
pluginManager.AddRegisterExportTypeHandler(typeof(IDocumentStorage), obj => documentManager.RegisterStorage((IDocumentStorage)obj));
pluginManager.AddRegisterExportTypeHandler(typeof(IDocumentTemplate), obj => documentManager.RegisterTemplate((IDocumentTemplate)obj));
pluginManager.AddRegisterExportTypeHandler(typeof(IDocumentEditorFactory), obj => documentManager.RegisterEditorFactory((IDocumentEditorFactory)obj));
pluginManager.AddRegisterExportTypeHandler(typeof(IProjectTemplate), obj => projectManager.RegisterProjectTemplate((IProjectTemplate)obj));
pluginManager.Initialize();
// Create & run app
var uiManager = new UIManager(projectManager, documentManager);
uiManager.Run();
// Run finished, persist settings
SettingsProvider.SaveSettings();
}
}
}