📄 posticonradiobuttonlist.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;
using CommunityServer;
using CommunityServer.Components;
using CommunityServer.Controls;
namespace CommunityServer.Discussions.Controls {
/// <summary>
/// Creates a list of PostIcons from the Emoticon List.
/// </summary>
public class PostIconRadioButtonList: RadioButtonList {
string emoticonIDs = "";
bool autoCreate = true;
public PostIconRadioButtonList () { }
protected override void CreateChildControls () {
base.CreateChildControls();
// If we aren't using Emoticons, return nothing.
/* No more needed. We control this from ouside.
if (!CSContext.Current.SiteSettings.EnableEmoticons) {
return;
}*/
// If the call is a postback, don't create the items...they're most likely already there
if(!Page.IsPostBack && AutoCreate)
this.DataBind();
}
public string EmoticonIDs {
set {
emoticonIDs = value;
}
}
public bool AutoCreate {
get {
return autoCreate;
}
set {
autoCreate = value;
}
}
public override void DataBind () {
base.DataBind();
this.Items.Clear();
this.Items.Add( new ListItem( ResourceManager.GetString("None"), "" ));
ArrayList al = Smilies.GetSmilies(true);
const string imgFormat = "<img src=\"{0}{1}\" alt=\"{2}\" />";
string forumHomePath = Globals.GetSiteUrls().Emoticon;
//Smiley smiley = new Smiley();
foreach (Smiley smiley in al) {
if (smiley != null)
this.Items.Add( new ListItem( string.Format(imgFormat, forumHomePath, smiley.SmileyUrl, smiley.SmileyText + " [" + smiley.SmileyCode + "]"), smiley.SmileyId.ToString() ));
}
}
public override string SelectedValue {
get {
return base.SelectedValue;
}
set {
if (value == "0")
base.SelectedValue = "";
else
base.SelectedValue = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -