⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createeditpost.cs

📁 微软的.NET论坛的源代码(COOL!!!)
💻 CS
📖 第 1 页 / 共 3 页
字号:
        /// <seealso cref="PostStyle"/>
        /// </summary>
        public PostStyle Post {
            get {  return _post;  }
        }

        /// <summary>
        /// Defines the style and UI settings for the Post Preview panel.
        /// <seealso cref="PreviewPostSyle"/>
        /// </summary>
        public PreviewPostSyle PreviewPost {
            get {  return _previewPostStyle;  }
        }

        /// <summary>
        /// Defines the style and settings for the panel that shows the post being replied to.
        /// <seealso cref="ReplyToPostStyle"/>
        /// </summary>
        public ReplyToPostStyle ReplyToPost {
            get {  return _replyToPostStyle;  }
        }

        /// <summary>
        /// Indicates whether the post being made is a new post, a reply to an existing post, or an
        /// editing of an existing post.  The allowable values are NewPost, ReplyToPost, and EditPost.
        /// </summary>
        /// <remarks>When setting the Mode property to NewPost, you must supply a ForumID property.
        /// When setting the Mode to ReplyToPost or EditPost, you must supply a PostID property.</remarks>
        public CreateEditPostMode Mode {
            get {
                if (ViewState["mode"] == null) return CreateEditPostMode.NewPost;
                return (CreateEditPostMode) ViewState["mode"];
            }
            set { ViewState["mode"] = value; }
        }

        /// <summary>
        /// This property determines the ForumID a new post is being posted to.
        /// <seealso cref="Mode"/>
        /// </summary>
        /// <remarks>Failure to pass in a ForumID when setting the Mode property to NewPost will result
        /// in a thrown Exception.</remarks>
        public int ForumID {
            get {
                if (ViewState["forumID"] == null) return -1;
                return (int) ViewState["forumID"];
            }
            set { ViewState["forumID"] = value; }
        }

        /// <summary>
        /// When editing a post, specifies the Url to send the end user once the post has been
        /// updates or the user clicks the Cancel button.
        /// </summary>
        public String RedirectUrl {
            get {
                if (ViewState["redirectUrl"] == null) return _defaultRedirectUrl;
                return (String) ViewState["redirectUrl"];
            }
            set { ViewState["redirectUrl"] = value; }
        }

        /// <summary>
        /// This property is required when the Mode property is set to either ReplyToPost or EditPost.
        /// When the Mode is set to ReplyToPost, the PostID indicates the post that the end user is
        /// replying to.  When Mode is set to EditPost, the PostID indicates the post that is being edited.
        /// <seealso cref="Mode"/>
        /// </summary>
        /// <remarks>An Exception will be thrown if the Mode property is set to either EditPost or
        /// ReplyToPost and the PostID property is not set.</remarks>
        public int PostID {
            get {
                if (ViewState["postID"] == null) return -1;
                return (int) ViewState["postID"];
            }
            set { ViewState["postID"] = value; }
        }

        /// <summary>
        /// Specifies the text that appears at the top of the page when posting a new message.
        /// </summary>
        public String PostNewMessageText {
            get {
                if (ViewState["postNewMessageText"] == null) return _defaultPostNewMessageText;
                return (String) ViewState["postNewMessageText"];
            }
            set { ViewState["postNewMessageText"] = value; }
        }

        /// <summary>
        /// Specifies the message that appears at the top of the page when previewing a message.
        /// </summary>
        public String PreviewMessageText {
            get {
                if (ViewState["previewMessageText"] == null) return _defaultPreviewMessageText;
                return (String) ViewState["previewMessageText"];
            }
            set { ViewState["previewMessageText"] = value; }
        }

        /// <summary>
        /// Specifies the message that appears at the top of the page when editing an existing post.
        /// </summary>
        public String EditMessageText {
            get {
                if (ViewState["editMessageText"] == null) return _defaultEditMessageText;
                return (String) ViewState["editMessageText"];
            }
            set { ViewState["editMessageText"] = value; }
        }

        /// <summary>
        /// Specifies the message that appears at the top of the page when replying to an existing post.
        /// </summary>
        public String ReplyToMessageText {
            get {
                if (ViewState["replyToMessageText"] == null) return _defaultReplyToMessageText;
                return (String) ViewState["replyToMessageText"];
            }
            set { ViewState["replyToMessageText"] = value; }
        }
        /********************************************************/
    }



    /************************** PostStyle Class **************************
        This class represents the style and misc. UI options for making the post.
     *********************************************************************/
    /// <summary>
    /// This class represents the style and miscellaneous UI options for making the post.
    /// Using this class, the look and feel of the text boxes and buttons used for making a 
    /// new post can be customized.
    /// </summary>
	
    [ ToolboxItemAttribute(false) ]
    public class PostStyle : Style {
        /********** DECLARE PRIVATE CONSTANTS **************/
        const int _defaultSubjectColumns = 40;					// how many columns in the subject textbox
        const int _defaultBodyColumns = 75;						// how many columns in the body textbox
        const int _defaultBodyRows = 15;						// how many rows in the body textbox
        const String _defaultPostText = "  Post Message ";				// the default text for the Post button
        const String _defaultPreviewText = " Preview > ";			// the default text for the Preview button
        const String _defaultEditModePostText = "Post Altered Message";	// the default text for the Post button in Edit mode
        const String _defaultEditModePreviewText = " Preview ";	// the default text for the Preview button in Edit mode
        /***************************************************/


        /************ PROPERTY SET/GET STATEMENTS **************/
        /// <summary>
        /// Specifies how the Post and Preview buttons should be aligned.  The default is Right aligned.
        /// </summary>
        public HorizontalAlign ButtonHorizontalAlign {
            get {
                if (ViewState["postStyleButtonHZ"] == null) return HorizontalAlign.Right;
                return (HorizontalAlign) ViewState["postStyleButtonHZ"];
            }
            set {  ViewState["postStyleButtonHZ"] = value;  }
        }

        /// <summary>
        /// Indicates how many columns the subject text box should contain.  The default is 40.
        /// </summary>
        public int SubjectColumns {
            get {
                if (ViewState["postStyleSubjectColumns"] == null) return _defaultSubjectColumns;
                return (int) ViewState["postStyleSubjectColumns"];
            }
            set {  ViewState["postStyleSubjectColumns"] = value;  }
        }

        /// <summary>
        /// Indicates how many columns the multi-line Body text box should have.  The default is 75.
        /// </summary>
        public int BodyColumns {
            get {
                if (ViewState["postStyleBodyColumns"] == null) return _defaultBodyColumns;
                return (int) ViewState["postStyleBodyColumns"];
            }
            set {  ViewState["postStyleBodyColumns"] = value;  }
        }

        /// <summary>
        /// Indicates how many rows the multi-line Body text box should have.  The default is 15.
        /// </summary>
        public int BodyRows {
            get {
                if (ViewState["postStyleBodyRows"] == null) return _defaultBodyRows;
                return (int) ViewState["postStyleBodyRows"];
            }
            set {  ViewState["postStyleBodyRows"] = value;  }
        }

        /// <summary>
        /// Specifies the text for the Post button.
        /// </summary>
        public String PostText {
            get {
                if (ViewState["postStylePostText"] == null) return _defaultPostText;
                return (String) ViewState["postStylePostText"];
            }
            set {  ViewState["postStylePostText"] = value;  }
        }

        /// <summary>
        /// Specifies the text for the Preview button.
        /// </summary>
        public String PreviewText {
            get {
                if (ViewState["postStylePreviewText"] == null) return _defaultPreviewText;
                return (String) ViewState["postStylePreviewText"];
            }
            set { ViewState["postStylePreviewText"] = value; }
        }

        /// <summary>
        /// Specifies the text for the Post button when the user is editing a post (as opposed to
        /// posting a new message or replying to an existing message).
        /// </summary>
        public String EditModePostText {
            get {
                if (ViewState["postStyleEditModePostText"] == null) return _defaultEditModePostText;
                return (String) ViewState["postStyleEditModePostText"];
            }
            set {  ViewState["postStyleEditModePostText"] = value;  }
        }

        /// <summary>
        /// Specifies the text for the Preview button when the user is editing a post.
        /// </summary>
        public String EditModePreviewText {
            get {
                if (ViewState["postStyleEditModePreviewText"] == null) return _defaultEditModePreviewText;
                return (String) ViewState["postStyleEditModePreviewText"];
            }
            set { ViewState["postStyleEditModePreviewText"] = value; }
        }
        /********************************************************/
    }
    /**********************************************************************/



    /************************** PreviewPostSyle Class **************************
        This class represents the style and miscellaneous options for the Preview pane,
        which is displayed when the user clicks the Preview button.
     *********************************************************************/
    /// <summary>
    /// This class represents the style and miscellaneous options for the Preview pane,
    /// which is displayed when the user clicks the Preview button.
    /// </summary>
    [ ToolboxItemAttribute(false) ]
    public class PreviewPostSyle : Style {
        /********** DECLARE PRIVATE CONSTANTS **************/
        const String _defaultCancelText = "Cancel";				// the default text for the Cancel button
        const String _defaultPostText = "Post Message >>";		// the default text for the Post button
        const String _defaultReturnToEditText = "<< Edit the Post";	// the default text for the "Edit the Post" button
        const String _defaultEditModePostText = "Post Altered Message >>";		// the default text for the Post button when in Edit mode
        const String _defaultEditModeReturnToEditText = "<< Edit the Post";	// the default text for the "Edit the Post" button when in Edit mode
        /***************************************************/


        /************ PROPERTY SET/GET STATEMENTS **************/
        /// <summary>
        /// Determines how the preview panel should be horizontally aligned.  The default is
        /// Center align.
        /// </summary>
        public HorizontalAlign HorizontalAlign {
            get {
                if (ViewState["previewPostStyleHZ"] == null) return HorizontalAlign.Center;
                return (HorizontalAlign) ViewState["previewPostStyleHZ"];
            }
            set {  ViewState["previewPostStyleHZ"] = value;  }
        }

        /// <summary>
        /// Specifies the text in the Post button on the Preview pane.
        /// </summary>
        public String PostText {
            get {
                if (ViewState["previewPostStylePostText"] == null) return _defaultPostText;
                return (String) ViewState["previewPostStylePostText"];
            }
            set {  ViewState["previewPostStylePostText"] = value;  }
        }

        /// <summary>
        /// Specifies the text in the Cancel button on the Preview pane.
        /// </summary>
        /// <remarks>When the user clicks the Cancel button, she is taken back to the
        /// message she was replying to or the forum she was visiting when she clicked the "Post a
        /// New Message" link.</remarks>
        public String CancelText {
            get {
                if (ViewState["previewPostStyleCancelText"] == null) return _defaultCancelText;
                return (String) ViewState["previewPostStyleCancelText"];
            }
            set { ViewState["previewPostStyleCancelText"] = value; }
        }

        /// <summary>
        /// The text for the button to allow the user to return to edit the post.
        /// </summary>
        public String RetunToEditText {
            get {
                if (ViewState["previewPostStyleReturnToEditText"] == null) return _defaultReturnToEditText;
                return (String) ViewState["previewPostStyleReturnToEditText"];
            }
            set { ViewState["previewPostStyleReturnToEditText"] = value; }
        }

        /// <summary>
        /// The text for the button to allow the user to return to edit the post when the Mode property
        /// is set to EditPost.
        /// </summary>
        public String EditModeRetunToEditText {
            get {
                if (ViewState["previewPostStyleEditModeReturnToEditText"] == null) return _defaultEditModeReturnToEditText;
                return (String) ViewState["previewPostStyleEditModeReturnToEditText"];
            }
            set { ViewState["previewPostStyleEditModeReturnToEditText"] = value; }
        }

        /// <summary>
        /// Specifies the text in the Post button on the Preview pane when the Mode property is set
        /// to EditPost.
        /// </summary>
        public String EditModePostText {
            get {
                if (ViewState["previewEditModePostStylePostText"] == null) return _defaultEditModePostText;
                return (String) ViewState["previewEditModePostStylePostText"];
            }
            set {  ViewState["previewEditModePostStylePostText"] = value;  }
        }
        /********************************************************/
    }
    /**********************************************************************/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -