private void ProgressUpdate(SynoReportCacheDownloadEventArgs e) { treeView1.Enabled = false; toolsStripMenuItem.Enabled = false; toolStripMenuItem2.Enabled = false; switch (e.Status) { case CacheStatus.FetchingDirectoryInfo: toolStripStatusLabel1.Text = "Fetching folder contents."; break; case CacheStatus.FetchingVersionInfo: toolStripStatusLabel1.Text = "Fetching DSM version."; break; case CacheStatus.FetchingVersionInfoCompleted: toolStripStatusLabel1.Text = "DSM version " + e.Message; break; case CacheStatus.Cleanup: toolStripStatusLabel1.Text = "Removing Storage Analyzer database files..."; break; case CacheStatus.Downloading: toolStripStatusLabel1.Text = string.Format("Downloading files.. [{0} of {1}]", e.FilesFetched, e.TotalFiles); toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = e.TotalFiles; toolStripProgressBar1.Value = e.FilesFetched; break; default: treeView1.Enabled = true; toolsStripMenuItem.Enabled = true; toolStripMenuItem2.Enabled = true; exportSharesReportToolStripMenuItem.Enabled = cache != null; exportVolumeReportToolStripMenuItem.Enabled = cache != null; toolStripStatusLabel1.Text = "Idle."; toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = e.TotalFiles; toolStripProgressBar1.Value = e.FilesFetched; break; case CacheStatus.Processing: toolStripStatusLabel1.Text = "Processing..."; break; } }
private void Cache_StatusUpdate(object sender, SynoReportCacheDownloadEventArgs e) { Invoke(new Action <SynoReportCacheDownloadEventArgs>(ProgressUpdate), e); }