private void SetupGui() { ExtensionHost.ControlManager.InvokeOnMainThread(new Action(() => { MuiProcessor = new MuiProcessor(ExtensionHost, Path.Combine(Path.GetDirectoryName(typeof(CodeEditorExtension).Assembly.Location), "Mui")); AddToMuiIdentifiers(SetupSettingsControls()); AddToMuiIdentifiers(SetupToolbar()); AddStatusBarItems(); ExtensionHost.UILanguageChanged += ExtensionHost_UILanguageChanged; ExtensionHost_UILanguageChanged(null, null); })); _appearanceMapPath = Path.Combine(ExtensionHost.SettingsManager.GetSettingsDirectory(this), "appearance.xml"); _defaultAppearanceMap = AppearanceMap.LoadFromFile(Path.Combine( Path.GetDirectoryName(typeof(CodeEditorExtension).Assembly.Location), "CodeEditor", "default_appearance.xml")); try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); } catch { _appearanceMap = new AppearanceMap(); _defaultAppearanceMap.CopyTo(_appearanceMap); } StyleMap = new Gui.Styles.StyleMap(_appearanceMap, _defaultAppearanceMap); }
public override void Initialize(InitializationContext context) { _extensionHost = (LiteExtensionHost)context.Host; _extensionHost.TemplateService.AddFileSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "File")); _extensionHost.TemplateService.AddProjectSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Project")); _extensionHost.TemplateService.AddIconSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Icons")); var generalSettingsEditorControl = new GeneralSettingsEditor(_settings = LiteDevelopSettings.Instance) { Dock = DockStyle.Fill }; var internationalSettingsEditorControl = new InternationalSettingsEditor(_settings) { Dock = DockStyle.Fill }; var appearanceEditorControl = new AppearanceEditor() { Dock = DockStyle.Fill }; var generalSettingsNode = new SettingsNode("General", generalSettingsEditorControl); var internationalSettingsNode = new SettingsNode("International", internationalSettingsEditorControl); var appearanceNode = new SettingsNode("Appearance", appearanceEditorControl); _settingsNode = new SettingsNode("LiteDevelop", generalSettingsEditorControl); _settingsNode.Nodes.AddRange(new TreeNode[] { generalSettingsNode, appearanceNode, internationalSettingsNode, }); _componentMuiIdentifiers = new Dictionary <object, string>() { { generalSettingsNode, "LiteDevelopExtension.GeneralSettings" }, { appearanceNode, "LiteDevelopExtension.Appearance" }, { internationalSettingsNode, "LiteDevelopExtension.InternationalSettings" }, }; _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged; extensionHost_UILanguageChanged(null, null); _appearanceMapPath = Path.Combine(Constants.AppDataDirectory, "appearance.xml"); _defaultAppearanceMap = AppearanceMap.LoadFromFile(Path.Combine( Path.GetDirectoryName(typeof(LiteDevelopExtension).Assembly.Location), "default_appearance.xml")); try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); } catch { _appearanceMap = _defaultAppearanceMap; } }