70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Lskj.MyControl;
|
|
using DevExpress.XtraEditors.Controls;
|
|
using System.Threading;
|
|
|
|
namespace Lskj.Main
|
|
{
|
|
public partial class FrmProgressBar : Form
|
|
{
|
|
public Dictionary<string, GridControlEx> dicGrids = new Dictionary<string, GridControlEx>();
|
|
private bool isRun = false;
|
|
|
|
public FrmProgressBar()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmProgressBar_Load(object sender, EventArgs e)
|
|
{
|
|
timer1.Start();
|
|
}
|
|
|
|
private void OnLoad()
|
|
{
|
|
try
|
|
{
|
|
isRun = true;
|
|
progressBarControl1.Properties.Minimum = 0;
|
|
progressBarControl1.Properties.Maximum = dicGrids.Count;
|
|
progressBarControl1.Properties.Step = 1;
|
|
progressBarControl1.Properties.ProgressViewStyle = ProgressViewStyle.Broken;
|
|
progressBarControl1.Position = 0;
|
|
|
|
for (int i = 1; i <= dicGrids.Count; i++)
|
|
{
|
|
label1.Text = dicGrids.Count == i ? "100%" : Convert.ToInt32(Convert.ToDouble(Convert.ToDouble(i) / Convert.ToDouble(dicGrids.Count)) * 100) + "%";
|
|
progressBarControl1.PerformStep();
|
|
Application.DoEvents();
|
|
|
|
GridControlEx grid = dicGrids[i + ""];
|
|
grid.SetDataSource(grid.Sql);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
finally {
|
|
timer1.Stop();
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
if (!isRun)
|
|
{
|
|
OnLoad();
|
|
}
|
|
}
|
|
}
|
|
}
|