Example #1
0
        /// <summary>
        /// 使用异步方式加载表的构架。
        /// </summary>
        /// <param name="provider"></param>
        /// <param name="source"></param>
        private void GetSchemaAsync(ISourceProvider provider, List <Table> source)
        {
            spbar.Value   = 0;
            spbar.Visible = true;

            Processor.Run(this, () =>
            {
                var tables = provider.GetSchema(source, (t, p) =>
                {
                    Invoke(new Action(() =>
                    {
                        spState.Text = string.Format("{0}%,正在获取表 {1} 的结构...", p, t);
                        spbar.Value  = p;
                    }));
                });

                Invoke(new Action(() =>
                {
                    FillTables(tables);
                    spState.Text  = "就绪";
                    spbar.Value   = 0;
                    spbar.Visible = false;
                }));
            });
        }