MarkItUp.SingleUserBlog.Web/Administration/ManageBlogSettings.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using MarkItUp.SingleUserBlog.Common;
using System.Web.Security;

public partial class ManageBlogSettings : System.Web.UI.Page {

    protected override void OnInit(EventArgs e) {
        base.OnInit(e);

        this.btnCancel.Attributes.Add("onClick", "document.location='Default.aspx'; return false;");

        LoadConfig();

        this.Load += new EventHandler(ManageBlogSettings_Load);
    }

    private int TimeZoneComparer(TimeZoneInformation tz1, TimeZoneInformation tz2) {
        // The display name is in the format "(GMT+xx:xx) xxx", "(GMT) xxx" or "(GMT-xx:xx)". We want
        // the order to be "(GMT-xx:xx)", "(GMT) xxx", "(GMT+xx:xx)". We also want the negative offsets
        // to start at a high number and the positive offsets to end with a high number.
        if(tz1.DisplayName[4]=='-' && tz2.DisplayName[4]!='-')
            return -1;
        if(tz1.DisplayName[4]==')')
        {
            if(tz2.DisplayName[4]=='-')
                return 1;
            if(tz2.DisplayName[4]=='+')
                return -1;
        }
        if(tz1.DisplayName[4]=='+' && tz2.DisplayName[4]!='+')
            return 1;

        // Make sure the negative offsets are descending
        if (tz1.DisplayName[4] == '-')
            return string.Compare(tz2.DisplayName, tz1.DisplayName);

        return string.Compare(tz1.DisplayName, tz2.DisplayName);
    }

    void ManageBlogSettings_Load(object sender, EventArgs e) {
        if (!this.IsPostBack)
        {
            // TODO: This is a bit nasty. We're sorting TimeZoneInformation's copy of the array...
            TimeZoneInformation[] timeZones=TimeZoneInformation.EnumZones();
            Array.Sort(timeZones, new Comparison<TimeZoneInformation>(TimeZoneComparer));
            ddlTimeZone.DataSource = timeZones;
            ddlTimeZone.DataValueField = "Name";
            ddlTimeZone.DataTextField = "DisplayName";
            ddlTimeZone.DataBind();
            ddlTimeZone.SelectedValue = BlogConfigurationSettings.TimeZoneName;
        }
    }

    void LoadConfig() {

        this.txtBlogTitle.Text = BlogConfigurationSettings.BlogTitle;
后面还有 32 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。