NCDS
2012-10-02 23:56:27
The following functions are from a little side project I mess with from time to time; mainly for learning purposes. The goal here is have progressBar1.Style set to Marquee while the files are being parsed, then switch back to Style.Blocks (value = 0) to "kill" the progress bar as the process has finished.
The progress bar "activates" and switches to Marquee with no problem at all. However, the style is never switched back to Blocks, even though the files are parsed correctly. Any help?
Note: Time.Enabled is set in parseFile()
The progress bar "activates" and switches to Marquee with no problem at all. However, the style is never switched back to Blocks, even though the files are parsed correctly. Any help?
Note: Time.Enabled is set in parseFile()
private void progressBar1_Click(object sender, EventArgs e)
{
// To ensure the progress bar has adequate time to display progress before execution is complete.
Time = new System.Timers.Timer(10000);
//Time.AutoReset = false;
Time.Elapsed += new ElapsedEventHandler(onTimeEvent);
Time.Interval = 2000;
// Init progress bar 'process'
progressBar1.Style = ProgressBarStyle.Marquee;
if (!parseFile())
{
MessageBox.Show("Unable to parse file @ " + cDir, "Error!");
}
}
//
private void onTimeEvent(object source, ElapsedEventArgs e)
{
//if (parse) //This is just a variable to ensure the respective files have been parsed.
{
progressBar1.Style = ProgressBarStyle.Blocks;
Time.Enabled = false;
}
}