zoukankan      html  css  js  c++  java
  • C# ProgressBar+Thread

    // 委托
            public delegate void ShowProgressBar(long total, long current);
            // 事件
            public event ShowProgressBar showProgressBar;


            void Show_ProgressBar(long total, long current)
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new ShowProgressBar(Show_ProgressBar), new object[] { total, current });
                }
                else
                {
                    this.progressBarImport.Maximum = (int)total;
                    this.progressBarImport.Value = (int)current;
                }
            }

            public void ImportStart()
            {
                this.showProgressBar = new ShowProgressBar(Show_ProgressBar);
                //buttonImport.Enabled = false;
                try
                {
                    sqlDB.Open();
                    oracleDB.Open();
                    ArrayList al = sqlDB.getDataBaseTables();
                    for (int i = 0; i < al.Count; i++)
                    {
                        showProgressBar(al.Count, i);
                        InsertDataTableToTable(al[i].ToString());
                    }
                    Thread.CurrentThread.Abort();
                }
                finally
                {
                    sqlDB.Close();
                    oracleDB.Close();
                }
                //buttonImport.Enabled = true;
            }

  • 相关阅读:
    Python是如何进行内存管理的?
    scrapy利用set()对数据进行去重
    python快速抓取新闻标题及内容
    python爬虫第三方库
    Spring使用@Scheduled定时调度
    redis启动失败
    视图系统
    路由系统
    Django框架 part 2
    Django框架
  • 原文地址:https://www.cnblogs.com/xsmhero/p/1932776.html
Copyright © 2011-2022 走看看