开发者

Using Windows 7 Taskbar progress indicator from a Windows Explorer namespace extension

开发者 https://www.devze.com 2023-01-21 03:09 出处:网络
I have a namespace extension and when the user does certain action we display a progress bar in a separate window (Ideally we should use the Windows Explorer built in progress indicator in the address

I have a namespace extension and when the user does certain action we display a progress bar in a separate window (Ideally we should use the Windows Explorer built in progress indicator in the address bar, but I'm told that there isn't an API for that from my component vendor). I using the Windows Code Pack 1.1 to g开发者_StackOverflow中文版et a .NET API.

This progress window is a regular Windows Form window. I've included the following code:

...
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Taskbar;
...
public sealed partial class ProgressWindow : Form, IProgressPresenter
{
    ...
    public int ProgressLevel
    {
        get { return JobProgress.Value; }
        set
        {
            JobProgress.Value = value;

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.SetProgressValue(value, 99);
            }
        }
    }
...

I would like the Explorer icon to display the progress, but this doesn't happen. I've tried to add Handle property as a parameter, but this doesn't seem to help.


(Ideally we should use the Windows Explorer built in progress indicator in the address bar, but I'm told that there isn't an API for that from my component vendor)

If its a namespace extension your supposed to use the IProgressDialog interface, Its built into Explorer and also nativity supports the Taskbar progress indicator on Windows 7.

http://www.codeproject.com/KB/dotnet/winprogressdialog.aspx

http://www.codeproject.com/KB/shell/iprogressdialognet.aspx

dmex


Did you set the state?

TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Error);

That will get you a red one. Paused for yellow and Normal for green.

0

精彩评论

暂无评论...
验证码 换一张
取 消