icsharpcodepage.cs
来自「SharpDevelop2.0.0 c#开发免费工具」· CS 代码 · 共 682 行 · 第 1/2 页
CS
682 行
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision: 1010 $</version>
// </file>
using System;
using System.IO;
using System.Collections;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.StartPage
{
public enum ColorScheme
{
blue,
red,
green,
brown,
orange
}
public class MenuItem
{
public string Caption, URL;
public MenuItem(string strCaption, string strUrl)
{
Caption = strCaption;
URL = strUrl;
}
}
public class ICSharpCodePage
{
ColorScheme _ColorScheme;
string startPageLocation;
string m_strMainColColor, m_strSubColColor;
int m_nLeftTopImageWidth, m_nRightTopImageWidth;
bool m_bShowMilestoneContentImage;
private int nTotalColumns = 0;
string m_strTitle, m_strMetaDescription, m_strMetaKeywords, m_strMetaAuthor, m_strMetaCopyright;
string m_strStaticStyleSheet, m_strRightBoxHtml;
bool m_bShowLeftMenu, m_bShowRightBox, m_bShowContentBar;
string m_strContentBarText, m_strTopMenuSelectedItem, m_strLeftMenuSelectedItem;
string m_strVersionText, m_strVersionStatus;
public string PrimaryColor
{
get { return m_strMainColColor; }
}
public string SecondaryColor
{
get { return m_strSubColColor; }
}
public string Title
{
get { return m_strTitle; }
set { m_strTitle = value; }
}
public bool ShowMilestoneContentImage
{
get { return m_bShowMilestoneContentImage; }
set { m_bShowMilestoneContentImage = value; }
}
public string MetaDescription
{
get { return m_strMetaDescription; }
set { m_strMetaDescription = value; }
}
public string MetaKeywords
{
get { return m_strMetaKeywords; }
set { m_strMetaKeywords = value; }
}
public string MetaAuthor
{
get { return m_strMetaAuthor; }
set { m_strMetaAuthor = value; }
}
public string MetaCopyright
{
get { return m_strMetaCopyright; }
set { m_strMetaCopyright = value; }
}
public string StaticStyleSheet
{
get { return m_strStaticStyleSheet; }
set { m_strStaticStyleSheet = value; }
}
public string ContentBarText
{
get { return m_strContentBarText; }
set { m_strContentBarText = value; }
}
public bool ShowLeftMenu
{
get { return m_bShowLeftMenu; }
set { m_bShowLeftMenu = value; }
}
public bool ShowRightBox
{
get { return m_bShowRightBox; }
set { m_bShowRightBox = value; }
}
public bool ShowContentBar
{
get { return m_bShowContentBar; }
set { m_bShowContentBar = value; }
}
private ArrayList TopMenu;
private ArrayList LeftMenu;
public virtual void PopulateTopMenu()
{
TopMenu.Add(new MenuItem(StringParser.Parse("${res:StartPage.StartMenu.Name}"), "startpage://Start"));
TopMenu.Add(new MenuItem(StringParser.Parse("${res:StartPage.ChangeLogMenu.Name}"), "startpage://ChangeLog"));
TopMenu.Add(new MenuItem(StringParser.Parse("${res:StartPage.AuthorsMenu.Name}"), "startpage://Authors"));
TopMenu.Add(new MenuItem(StringParser.Parse("${res:StartPage.HelpWantedMenu.Name}"), "startpage://HelpWanted"));
}
public virtual void PopulateLeftMenu()
{
// LeftMenu.Add(new MenuItem("Start", "/OpenSource/SD/AnnouncementList.asp"));
// LeftMenu.Add(new MenuItem("ChangeLog", "/OpenSource/SD/WhatsNew.asp"));
// LeftMenu.Add(new MenuItem("Authors", "/OpenSource/SD/NewsHistory.asp"));
// LeftMenu.Add(new MenuItem("Readme", "/OpenSource/SD/NewsHistory.asp"));
// LeftMenu.Add(new MenuItem("Help Wanted", "/pub/relations/"));
}
public string TopMenuSelectedItem
{
get { return m_strTopMenuSelectedItem; }
set { m_strTopMenuSelectedItem = value; }
}
public string LeftMenuSelectedItem
{
get { return m_strLeftMenuSelectedItem; }
set { m_strLeftMenuSelectedItem = value; }
}
public string VersionText
{
get { return m_strVersionText; }
set { m_strVersionText = value; }
}
public string VersionStatus
{
get { return m_strVersionStatus; }
set { m_strVersionStatus = value; }
}
public string RightBoxHtml
{
get { return m_strRightBoxHtml; }
set { m_strRightBoxHtml = value; }
}
public virtual void RenderRightBoxHtml(StringBuilder builder)
{
builder.Append(m_strRightBoxHtml);
}
public ICSharpCodePage()
{
ColorScheme = ICSharpCode.StartPage.ColorScheme.blue;
TopMenu = new ArrayList();
PopulateTopMenu();
TopMenuSelectedItem = "Home";
LeftMenu = new ArrayList();
PopulateLeftMenu();
LeftMenuSelectedItem = "";
Version v = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
VersionText = "milestone " + v.Major + "." + v.Minor;
VersionStatus = "Beta";
RightBoxHtml = "";
StaticStyleSheet = startPageLocation + "/Layout/default.css";
MetaAuthor = "Christoph Wille - christophw@alphasierrapapa.com";
MetaCopyright = "(c) 2001-2006 AlphaSierraPapa";
ShowLeftMenu = false;
ShowRightBox = false;
ShowContentBar = true;
}
public ColorScheme ColorScheme
{
get { return _ColorScheme; }
set
{
_ColorScheme = value;
m_bShowMilestoneContentImage = false;
switch (_ColorScheme)
{
case ColorScheme.blue:
m_nLeftTopImageWidth = 292;//412;
m_nRightTopImageWidth = 363;
m_strSubColColor = "#C2E0FB";
m_strMainColColor = "#A8C6E3";
m_bShowMilestoneContentImage = true;
break;
case ColorScheme.red:
m_nLeftTopImageWidth = 214;//334;
m_nRightTopImageWidth = 438;
m_strSubColColor = "#a7a9ac";
m_strMainColColor = "#d7797d";
break;
case ColorScheme.brown:
m_nLeftTopImageWidth = 294;//415;
m_nRightTopImageWidth = 359;
m_strSubColColor = "#EEE9E2";
m_strMainColColor = "#D5D0C9";
break;
case ColorScheme.green:
m_nLeftTopImageWidth = 259;//450;
m_nRightTopImageWidth = 325;
m_strSubColColor = "#E7EDBB";
m_strMainColColor = "#CED4A2";
break;
case ColorScheme.orange:
m_nLeftTopImageWidth = 191;//311;
m_nRightTopImageWidth = 460;
m_strSubColColor = "#F4D97B";
m_strMainColColor = "#E7CD6F";
break;
}
}
}
public virtual void RenderHeaderSection(StringBuilder builder)
{
//if (RightToLeftConverter.IsRightToLeft) {
// builder.Append("<html dir=\"rtl\"><head><title>");
//} else {
builder.Append("<html><head><title>");
//}
builder.Append(Title);
builder.Append("</title>\r\n");
builder.Append("<link rel='stylesheet' type='text/css' href='");
builder.Append(PropertyService.DataDirectory + Path.DirectorySeparatorChar +
"resources" + Path.DirectorySeparatorChar +
"startpage" + Path.DirectorySeparatorChar +
"Layout" + Path.DirectorySeparatorChar +
"default.css");
builder.Append("'>\r\n");
builder.Append("<META HTTP-EQUIV=\"content-type: text/html; charset= ISO-8859-1\">\r\n");
builder.Append("<META NAME=\"robots\" CONTENT=\"FOLLOW,INDEX\">\r\n");
builder.Append("<meta name=\"Author\" content=\"");
builder.Append(MetaAuthor);
builder.Append("\">\r\n<META NAME=\"copyright\" CONTENT=\"");
builder.Append(MetaCopyright);
builder.Append("\">\r\n<meta http-equiv=\"Description\" name=\"Description\" content=\"");
builder.Append(MetaDescription);
builder.Append("\">\r\n<meta http-equiv=\"Keywords\" name=\"Keywords\" content=\"");
builder.Append(MetaKeywords);
builder.Append("\">\r\n<link rel=\"stylesheet\" href=\"");
builder.Append(StaticStyleSheet);
builder.Append("\">\r\n</head>\r\n<body bgcolor=\"#ffffff\">\r\n");
}
public virtual void RenderPageEndSection(StringBuilder builder)
{
builder.Append("</body>\r\n</html>\r\n");
}
public virtual void RenderPageTopSection(StringBuilder builder)
{
builder.Append("<div class=\"balken\" style=\"position:absolute;left:0px;top:0px\">");
builder.Append("<table border=0 cellspacing=0 cellpadding=0><TR>\r\n");
builder.Append("<td height=72 background=\""+ startPageLocation +"/Layout/");
builder.Append(Enum.GetName(typeof(ColorScheme), _ColorScheme));
builder.Append("/balken_links.gif\"><img src=\"" + startPageLocation + "/Layout/Common/blind.gif\" width=");
builder.Append(m_nLeftTopImageWidth.ToString());
builder.Append(" height=1></td>\r\n");
builder.Append("<td width=\"100%\" background=\""+ startPageLocation + "/Layout/");
builder.Append(Enum.GetName(typeof(ColorScheme), _ColorScheme));
builder.Append("/balken_mitte.gif\"> </td>\r\n");
builder.Append("<td background=\""+ startPageLocation + "/Layout/");
builder.Append(Enum.GetName(typeof(ColorScheme), _ColorScheme));
builder.Append("/balken_rechts.gif\"><img src=\""+ startPageLocation + "/Layout/Common/blind.gif\" width=");
builder.Append(m_nRightTopImageWidth.ToString());
builder.Append(" height=1></td>\r\n</TR></table>\r\n");
builder.Append("<table border=0 cellspacing=0 cellpadding=0><tr>");
builder.Append("<td width=\"100%\" height=24 align=left bgcolor=\"#DCDDDE\">");
builder.Append("<table border=0 cellspacing=0 cellpadding=0 width=\"100%\"><tr>\r\n");
builder.Append("<td><img src=\""+ startPageLocation + "/Layout/Common/blind.gif\" width=15 height=1></td>\r\n");
int nTopMenuElements = TopMenu.Count;
foreach (MenuItem de in TopMenu)
{
--nTopMenuElements;
builder.Append("<td class=\"navi");
if (0 == String.Compare(de.Caption, m_strTopMenuSelectedItem, true))
{
builder.Append("Activ\">");
builder.Append(de.Caption);
builder.Append("</td>\r\n");
}
else
{
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?