Windows 7 Taskbar progress Windows 7 Taskbar progress wpf wpf

Windows 7 Taskbar progress


I believe this is something that Scott Hanselman covered in one of his weekly source code blogs.

Not sure if that was what you were looking for or not.


I know how to put it in the Taskbar, i just need to catch the download progress so i can show the progress in the taskbar. Heres a snippet of how i get it to show navigation, the file copy is displayed without the need for code, shell is picking that up automatically.

  #region Background Worker    void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)    {        this.TaskbarItemInfo.ProgressValue = (double)e.ProgressPercentage / 100;    }    void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)    {        if (e.Cancelled == true)        {            this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Paused;        }        else if (e.Error != null)        {            this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Error;        }        else        {            this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;        }    }    void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)    {        for (int i = 1; i <= 100; i++)        {            Thread.Sleep(100);            this.backgroundWorker1.ReportProgress(i,i.ToString());        }            }        }    }    #endregion

All thats needed for the Navigation is:

 private void Browser_Navigated(object sender, WebBrowserNavigatedEventArgs e)    {        if (backgroundWorker1.IsBusy == false)        {            backgroundWorker1.RunWorkerAsync();            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;        }        if (tabControl1.TabPages.Count > 10 && tabControl1.SelectedTab != null)            UpdatePreviewBitmap(tabControl1.SelectedTab);

And taken from the Window Load Event:

        this.backgroundWorker1.WorkerReportsProgress = true;        this.backgroundWorker1.WorkerSupportsCancellation = true;        this.backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);        this.backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);        this.backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);        //        TabbedThumbnail preview = new TabbedThumbnail(this.Handle, tabPage.Handle);        //        preview.TabbedThumbnailActivated += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailActivated);        preview.TabbedThumbnailClosed += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailClosed);        preview.TabbedThumbnailMaximized += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailMaximized);        preview.TabbedThumbnailMinimized += new EventHandler<TabbedThumbnailEventArgs>(preview_TabbedThumbnailMinimized);        //        TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview);        //        tabControl1.SelectedTab = tabPage;        TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(tabControl1.SelectedTab);        //        scrollEventAdded = false;

Hope this makes sense. Thanks