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

📄 topic.cs

📁 JAVA的精彩实例
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections.Generic;

using System.Threading;
using System.Web;
using System.Net;
using feiyun0112.cnblogs.com.CSDNReader.Functions;

namespace feiyun0112.cnblogs.com.CSDNReader.Model
{
    /// <summary>
    /// Summary description for Topic.
    /// </summary>
    public class Topic
    {
        public delegate void DelegatePost(bool blnPosted);
        public delegate void DelegateShowWarning(string  strMsg);
        public delegate void DelegateStartPost();
        public DelegatePost PostedEvent;
        public DelegateShowWarning  ShowWarningEvent;
        public DelegateStartPost StartPostEvent;

        public Topic(Room room,string id, string name, string user, string points, string replies,string replyuser, string replytime, string forumID, string topicID, string topicdate)
        {
            //
            // TODO: Add constructor logic here
            //

            _room = room;
            _id = id.Trim();
            _name = HttpUtility.HtmlDecode(name.Trim());
            //_HaveRead = false;
            _replytime = replytime.Trim();
            _user = user.Trim();
            _points = points.Trim();
            _replies = replies.Trim();
            _replyuser = replyuser.Trim();
            //_recid = 0;
            //_ReadAgain = false;
            _forumID = forumID.Trim();
            _topicID = topicID.Trim();
            _topicdate = topicdate.Trim();
        }
        private Room _room;
        private string _name;
        private string _id;
        private string _replytime;
        private string _user;
        private string _points;
        private string _replies;
        private string _replyuser;
        private bool _HaveRead;
        private bool _HaveReplied;
        private bool _ReadAgain;
        private int _recid;
        private string _forumID;
        private string _topicID;
        private string _topicdate;

        public Room Room
        {
            get
            {
                return _room;
            }
         
        }
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = HttpUtility.HtmlDecode(value);
            }
        }

        public string forumID
        {
            get
            {
                return _forumID;
            }
            set
            {
                _forumID = value;
            }
        }
        public string topicID
        {
            get
            {
                return _topicID;
            }
            set
            {
                _topicID = value;
            }
        }
        public string topicdate
        {
            get
            {
                return _topicdate;
            }
            set
            {
                _topicdate = value;
            }
        }

        public string Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
        public string User
        {
            get
            {
                return _user;
            }
            set
            {
                _user = value;
            }
        }
        public string Point
        {
            get
            {
                return _points;
            }
            set
            {
                _points = value;
            }
        }
        public string Replies
        {
            get
            {
                return _replies;
            }
            set
            {
                _replies = value;
            }
        }
        public string ReplyUser
        {
            get
            {
                return _replyuser;
            }
            set
            {
                _replyuser = value;
            }
        }
        public string ReplyTime
        {
            get
            {
                return _replytime;
            }
            set
            {
                _replytime = value;
            }
        }
        public bool HaveRead
        {
            get
            {
                return _HaveRead;
            }
            set
            {
                _HaveRead = value;
            }
        }

        public bool HaveReplied
        {
            get
            {
                return _HaveReplied;
            }
            set
            {
                _HaveReplied = value;
            }
        }

        public bool ReadAgain
        {
            get
            {
                return _ReadAgain;
            }
            set
            {
                _ReadAgain = value;
            }
        }
        public int RecID
        {
            get
            {
                return _recid;
            }
            set
            {
                _recid = value;
            }
        }
        private Controls.TopicTabPage  _TabPage;

        public Controls.TopicTabPage  TabPage 
        {
            get { return _TabPage; }
            set { _TabPage = value; }
        }


        private string _Html;

        public string Html
        {
            get { return _Html; }
            set { _Html = value; }
        }

        #region Show Topic
        private bool blnInShow;

        public void ShowTopic()
        {
            if (this.blnInShow)
            {
                return;
            }
            blnInShow = true;
            HttpWebRequest webRequest = WEBFunc.CreateWebRequest("http://topic.csdn.net/" + this.Id);            
            WEBFunc.Get(webRequest, new RequestCompleteCallback(this.WebRequestComplete), new ExceptionCallback(this.WebRequestException), new StartDownloadCallback(this.StartDownload),RequestStatePriority.ShowTopic);

        }
        private bool  StartDownload()
        {

            return true;
        }
        private void WebRequestComplete(byte[] dataBuffer)
        {

            WorkerFunc.AddWorkerTask(new LoadHtmlDelegate(this.ShowProc), WorkPriority.ShowTopic, new object[] { dataBuffer });
        }

        private void WebRequestException(Exception e)
        {
            try
            {
                DelegateFunc.OnShowTopics(this.Id);
            }
            finally
            {
                this.blnInShow = false;
            }
        }
        /// <summary>
        /// 显示帖子
        /// </summary>
        private void ShowProc(byte[] dataBuffer)
        {


            try
            {
                string strHTML = Variant.encoding.GetString(dataBuffer);
                if (strHTML.Length == 0)
                {
                    DelegateFunc.OnShowTopics(this.Id);

⌨️ 快捷键说明

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