📄 htmlhelp2options.cs
字号:
/* ***********************************************************
*
* Help 2.0 Environment for SharpDevelop
* Base Help 2.0 Services (Options Panel)
* Copyright (c) 2005, Mathias Simmack. All rights reserved.
*
* ********************************************************* */
namespace HtmlHelp2Service
{
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.Core.Services;
using ICSharpCode.SharpDevelop.Gui.Dialogs;
using MSHelpServices;
public class HtmlHelp2OptionsPanel : AbstractOptionPanel
{
static string help2EnvironmentFile = "help2environment.xml";
bool Help2EnvIsReady = false;
ComboBox help2Collections = null;
string selectedHelp2Collection = "Fidalgo";
public override void LoadPanelContents()
{
string formPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
SetupFromXml(Path.Combine(formPath, @"HtmlHelp2Options.xfrm"));
this.InitializeComponents();
}
public override bool StorePanelContents()
{
this.SaveHelp2Config();
HtmlHelp2Environment h2env = (HtmlHelp2Environment)ServiceManager.Services.GetService(typeof(HtmlHelp2Environment));
if(h2env != null && h2env.Help2EnvironmentIsReady) h2env.ReloadNamespace();
return true;
}
private void InitializeComponents()
{
HtmlHelp2Environment h2env = (HtmlHelp2Environment)ServiceManager.Services.GetService(typeof(HtmlHelp2Environment));
Help2EnvIsReady = (h2env != null && h2env.Help2EnvironmentIsReady);
try
{
help2Collections = (ComboBox)ControlDictionary["help2Collections"];
help2Collections.Enabled = Help2EnvIsReady;
help2Collections.SelectedIndexChanged += new EventHandler(this.NamespaceNameChanged);
selectedHelp2Collection = h2env.CurrentSelectedNamespace;
Help2RegistryWalker.BuildNamespacesList(help2Collections, selectedHelp2Collection);
}
catch {}
}
private void NamespaceNameChanged(object sender, EventArgs e)
{
if(help2Collections.SelectedItem != null) {
try
{
selectedHelp2Collection = Help2RegistryWalker.GetNamespaceName(help2Collections.SelectedItem.ToString());
}
catch {}
}
}
private void SaveHelp2Config()
{
try
{
PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
XmlDocument xmldoc = new XmlDocument();
XmlNode node = null;
XmlCDataSection cdata = null;
xmldoc.LoadXml("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><help2environment/>");
node = xmldoc.CreateElement("collection");
cdata = xmldoc.CreateCDataSection(selectedHelp2Collection);
node.AppendChild(cdata);
xmldoc.DocumentElement.AppendChild(node);
xmldoc.Save(propertyService.ConfigDirectory + help2EnvironmentFile);
}
catch {}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -