📄 emailnotificationdropdownlist.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Discussions.Components;
namespace CommunityServer.Discussions.Controls {
/// <summary>
/// This server control displays a list of Date formatting options.
/// </summary>
public class EmailNotificationDropDownList : DropDownList {
CSContext csContext = CSContext.Current;
Label label = new Label();
/// <remarks>
/// Public constructor, internally populates the list of date formats.
/// </remarks>
public EmailNotificationDropDownList() {
// Set the default text
//
//label.Text = ResourceManager.GetString("EmailNotificationDropDownList_When");
// Add datetime formats
//
Items.Add(new ListItem(ResourceManager.GetString("EmailNotificationDropDownList_NeverSend"), "0"));
Items.Add(new ListItem(ResourceManager.GetString("EmailNotificationDropDownList_NewThreads"), "1"));
Items.Add(new ListItem(ResourceManager.GetString("EmailNotificationDropDownList_NewPosts"), "2"));
// Set the selected index
//
SelectedIndex = (int)ThreadTracking.GetSectionSubscriptionType(csContext.ForumID);
SelectedIndexChanged += new EventHandler(Subscription_Change);
}
protected override void Render(System.Web.UI.HtmlTextWriter writer) {
// If the user is already authenticated we have no work to do
if (!Page.Request.IsAuthenticated)
return;
label.RenderControl(writer);
base.Render (writer);
}
// *********************************************************************
// Subscription_Change
//
/// <summary>
/// User wants to change their subscription method
/// </summary>
///
// ********************************************************************/
private void Subscription_Change (Object sender, EventArgs e) {
ThreadTracking.SetSectionSubscriptionType(csContext.ForumID, (EmailSubscriptionType)Int32.Parse(SelectedItem.Value));
}
public string Text {
get {
return label.Text;
}
set {
label.Text = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -