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

📄 threadmsgmonitor.cs

📁 用C#编写的一个款搜索engine的源代码!摘自<Visual c#2005 程序设计>
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SECompare.Structure;

namespace SECompare.Controls
{
    public partial class ThreadMsgMonitor : UserControl
    {
        public ThreadMsgMonitor()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Title which is displayed on the top of the control.
        /// </summary>
        public String Title
        {
            set
            {
                this.lblTitle.Text = value;
            }
        }

        /// <summary>
        /// Set the thread to run and controlled by the panel.
        /// </summary>
        public ThreadStatus ThreadStatus
        {
            set
            {
                this.m_ThreadStatus = value;
            }
        }
        private ThreadStatus m_ThreadStatus;        //Thread controller

        /// <summary>
        /// Set the button which starts the process.
        /// </summary>
        public System.Windows.Forms.Button StartButton
        {
            set
            {
                this.m_StartButton = value;
            }
        }
        private System.Windows.Forms.Button m_StartButton;

        public void Start()
        {
            this.timer.Start();
            this.m_StartButton.Enabled = false;
        }

        public void Stop()
        {
            this.timer.Stop();
            this.m_StartButton.Enabled = true;
        }

        private void timer_Tick(object sender, System.EventArgs e)
        {
            if (this.m_ThreadStatus == null)
                return;

            if (this.m_ThreadStatus.IsFinished == false)
                this.lblMsg.Text = this.m_ThreadStatus.Status;
            else
            {
                this.Stop();
                MessageBox.Show("Task [" + this.lblTitle.Text + "] Completed!", "Task Completed");
            }
        }
    }
}

⌨️ 快捷键说明

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