• 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;
            }

  • 相关阅读:
    复制对象
    element.classList属性及方法应用
    Object.defineProperty
    965. Univalued Binary Tree
    700. Search in a Binary Search Tree
    561, Array Partition Ⅰ
    933. Number of Recent Calls
    999.Available Capture for rook
    961. N-Repeated Element in Size 2N Array
    709. To Lower Case
  • 原文地址:https://www.cnblogs.com/xsmhero/p/1932776.html
Copyright © 2020-2023  润新知