本文整理汇总了C#中System.Web.UI.WebControls.Panel.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.Add方法的具体用法?C# Panel.Add怎么用?C# Panel.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Panel
的用法示例。
在下文中一共展示了Panel.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayFile
/// <summary>
/// Displays one or two versions of a file in a diff-like view.
/// </summary>
/// <param name="fid"> File id </param>
/// <param name="userName"> User name </param>
/// <param name="vid1"> Version id on the left. If 0, the base version. </param>
/// <param name="vid2"> Version id on the right. If 0, the latest change. </param>
/// <param name="ignoreWhiteSpace"> Whether the diff algorithm should ignore white space. </param>
private void DisplayFile(int fid, string userName, int vid1, int vid2, bool ignoreWhiteSpace)
{
var fileQuery = from fl in DataContext.ChangeFiles where fl.Id == fid select fl;
if (fileQuery.Count() != 1)
{
ErrorOut("No such file!");
return;
}
HintsData.InDiffView = true;
ChangeFile file = fileQuery.Single();
AbstractedFileVersion[] versions = GetVersionsWithTextAbstract(fid);
if (versions.Length == 0)
{
ErrorOut("No versions submitted for this file.");
return;
}
if (vid1 == 0)
{
// By default, shows the diff between the last reviewed version of a file and the
// latest version of that file.
var latestReview = GetLatestUserReviewForChangeList(userName, file.ChangeListId);
if (latestReview != null)
{
foreach (var version in versions)
{
if (latestReview.TimeStamp.CompareTo(version.TimeStamp) > 0)
vid1 = version.Id;
}
// If the user has reviewed the latest change, they're probably taking another
// look, so show them the diff between the latest and latest-1 versions.
if (vid1 == versions[versions.Length - 1].Id && versions.Length > 1)
vid1 = versions[versions.Length - 2].Id;
}
// If no version picked above (because user has not reviewed the changelist)
// then just show the user the diff of the entire file change history.
if (vid1 == 0)
vid1 = versions[0].Id;
}
if (vid2 == 0)
vid2 = versions[versions.Length - 1].Id;
DisplayPageHeader(file.ServerFileName);
// Enclosing div (used to get shrink-to-contents behaviour for inner div).
var fileVersionsDivOuter = new Panel() { CssClass = "CssOuterDiv" };
ActivePage.Controls.Add(fileVersionsDivOuter);
var fileVersionsDiv = new Panel() { CssClass = "CssFileVersions" };
fileVersionsDivOuter.Add(fileVersionsDiv);
var fileVersionsFieldSet = new OptionSection(false) { Header = "File Versions" }
.AddTo(fileVersionsDiv);
string name = file.ServerFileName;
int lastForwardSlash = name.LastIndexOf('/');
if (lastForwardSlash >= 0)
name = name.Substring(lastForwardSlash + 1);
RadioButtonList leftList = new RadioButtonList();
fileVersionsFieldSet.Body.Add(leftList);
leftList.ID = "LeftFileVersion";
leftList.Items.AddRange(
(from ver in versions
select new ListItem(ComputeMoniker(name, ver), ver.Id.ToString()) { Selected = ver.Id == vid1 }).ToArray());
RadioButtonList rightList = new RadioButtonList();
fileVersionsFieldSet.Body.Add(rightList);
rightList.ID = "RightFileVersion";
rightList.Items.AddRange(
(from ver in versions
select new ListItem(ComputeMoniker(name, ver), ver.Id.ToString()) { Selected = ver.Id == vid2 }).ToArray());
if (versions.Length > 1)
HintsData.HaveMultipleVersions = true;
var selectVersionsPanel = new Panel() { CssClass = "ButtonPanel" }
.AddTo(fileVersionsFieldSet.Body);
var selectVersions = new Button()
{
Text = "Select",
ID = "selectversionsbutton",
CssClass = "button"
}.AddTo(selectVersionsPanel);
selectVersions.Click += new EventHandler(selectVersions_Clicked);
//.........这里部分代码省略.........
示例2: DisplaySettings
/// <summary>
/// Displays and allows changing user preferences.
/// </summary>
/// <param name="sourceUrl"> The URL from which the request came. </param>
private void DisplaySettings(string sourceUrl)
{
DisplayPageHeader("Personalize Malevich to your taste!");
Panel page = new Panel() { CssClass = "CssSettingsPage" };
ActivePage.AddBreak();
ActivePage.Controls.Add(page);
UserContext uc = CurrentUserContext;
var settings = new Panel() { CssClass = "Accordion Settings" };
page.Add(settings);
// Fonts
string fonts = System.Configuration.ConfigurationSettings.AppSettings["fonts"];
if (fonts != null)
{
var section = new OptionSection()
{
Header = "File Viewer Font",
Description = "Choose the font to use when viewing files or diffs."
}
.AddTo(settings);
RadioButtonList textFonts = new RadioButtonList() { ID = "TextFont" }
.AddTo(section.Body);
string[] fontValues = fonts.Split(';');
foreach (string font in fontValues)
{
Match m = FontParser.Match(font);
if (!m.Success)
continue;
string fontName = m.Groups["fontname"].Value;
ListItem item = new ListItem();
item.Text = fontName;
item.Value = fontName;
if (uc.TextFont != null && uc.TextFont.EqualsIgnoreCase(fontName))
item.Selected = true;
textFonts.Items.Add(item);
}
}
{ // Font size
var section = new OptionSection()
{
Header = "File Viewer Font Size",
Description = "Choose a font for viewing files and diffs."
}
.AddTo(settings);
RadioButtonList textSize = new RadioButtonList() { ID = "TextSize" }
.AddTo(section.Body);
int defaultTextSize = 0;
if (uc.TextSize != null)
defaultTextSize = uc.TextSize.Value;
string[] textSizes = { "small", "medium", "large" };
for (int i = 0; i < textSizes.Length; ++i)
{
ListItem item = new ListItem();
item.Text = textSizes[i];
item.Value = textSizes[i];
if (i == defaultTextSize)
item.Selected = true;
textSize.Items.Add(item);
}
}
{ // Max chars per line
var section = new OptionSection()
{
Header = "File Viewer Line Length",
Description = "Choose number of characters per line in the file viewer and differ."
}
.AddTo(settings);
"Enter a value between 80 and 160, or clear the value to revert to the project default<p/>"
.AsLiteral()
.AddTo(section.Body);
TextBox tb = new TextBox()
{
ID = "MaxLineLength",
Text = (uc.MaxLineLength != null ? uc.MaxLineLength.Value.ToString() : "")
};
section.Body.Add(tb);
}
// Spaces in a tab
string tabOverrideAllowed = System.Configuration.ConfigurationSettings.AppSettings["allowTabOverride"];
if ("true".Equals(tabOverrideAllowed))
//.........这里部分代码省略.........