public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState) { if (taskbarSupported) { taskbarInstance.SetProgressState(windowHandle, taskbarState); } }
public static void SetProgressStyle(IntPtr hwnd, TaskbarProgressBarStyle style) { if (IsInitialized) { taskbar.SetProgressState(hwnd, style); } }
/// <summary> /// Sets the type and state of the progress indicator displayed on a taskbar button of the main application window. /// </summary> /// <param name="state">Progress state of the progress button</param> public void SetProgressState(TaskbarProgressBarState state) { if (!IsWin7()) { return; } TaskbarList.SetProgressState(OwnerHandle, (TBPFLAG)state); }
public static void SetTaskbarProgressMode(this IWin32Window window, TaskbarProgressMode mode) { if (Instance != null) { Marshal.ThrowExceptionForHR( Instance.SetProgressState(window.Handle, (TBPFLAG)mode)); } }
// Progress Bars ============================================ /// <summary>Sets the type and state of the progress indicator displayed on a taskbar button.</summary> /// <param name="parent"> /// The window in which the progress of an operation is being shown. This window's associated taskbar button will display the progress bar. /// </param> /// <param name="status">The current state of the progress button. Specify only one of the enum values.</param> public static void SetProgressState(IWin32Window parent, TBPFLAG status) { Validate7OrLater(); if (parent == null) { throw new ArgumentNullException(nameof(parent)); } taskbar4?.SetProgressState(parent.Handle, status); }
public void SetProgressStatus(TaskbarProgressBarStatus status) { if (_taskbarList != null) { MainThread.Post(delegate(object x) { _taskbarList.SetProgressState(MainThread.MainWindow.Handle, status); }); } }
public static void SetProgressState(IntPtr handle, ProgressBarState state) { if (!WindowsUtils.IsWindows7) { return; } try { lock (_taskbarList) _taskbarList.SetProgressState(handle, state); } catch {} }
private void UpdateProgressBarState(TaskDialogProgressBarState state) { SendMessageHelper(TaskDialogMessage.SetProgressBarState, (int)state, 0); if (!SupportsTaskbarProgress) { return; } TaskbarProgressBarState taskbarState = TaskbarProgressBarState.Normal; if (state == TaskDialogProgressBarState.Error) { taskbarState = TaskbarProgressBarState.Error; } taskbarList.SetProgressState(hWndOwner, taskbarState); }
static void Main(string[] args) { var opts = new Args(args); var wnds = FindWindow(opts.Title); if (wnds.Length == 0) { Environment.Exit(2); } ITaskbarList4 inst = null; try { inst = (ITaskbarList4) new CTaskbarList(); inst.HrInit(); } catch (Exception e) { Console.WriteLine("Failed to create ITaskbarList4 interface, usually because you are not on Windows 7."); Console.WriteLine(""); Console.WriteLine(e.Message); Environment.Exit(3); } foreach (var wnd in wnds) { if (opts.Value.HasValue) { inst.SetProgressValue(wnd, (ulong)opts.Value.Value, 100); } if (opts.State.HasValue) { inst.SetProgressState(wnd, opts.State.Value); } } }
private void UpdateTaskbar(object sender, PropertyChangedEventArgs e) { TBPFLAG newProgressState; if (testStatistics.Failed > 0) { newProgressState = TBPFLAG.TBPF_ERROR; // red } else if (testStatistics.Skipped > 0) { newProgressState = TBPFLAG.TBPF_PAUSED; // yellow } else if (testStatistics.Passed > 0) { newProgressState = TBPFLAG.TBPF_NORMAL; // green } else { newProgressState = TBPFLAG.TBPF_NOPROGRESS; } if (newProgressState != currentProgressState) { currentProgressState = newProgressState; taskBarList.SetProgressState(windowHandle, newProgressState); } var completed = testStatistics.Passed + testStatistics.Failed + testStatistics.Skipped + testStatistics.Inconclusive; var total = completed > testTreeModel.TestCount ? completed : testTreeModel.TestCount; taskBarList.SetProgressValue(windowHandle, Convert.ToUInt32(completed), Convert.ToUInt32(total)); }
public void SetProgressState(TaskbarProgressBarStatus state) => taskbarList.SetProgressState(OwnerHandle, state);
/// <summary> /// Sets the type and state of the progress indicator displayed on a taskbar button of the main application window. /// </summary> /// <param name="state">Progress state of the progress button</param> public void SetProgressState(TaskbarProgressBarState state) { CoreHelpers.ThrowIfNotWin7(); TaskbarList.SetProgressState(OwnerHandle, (TBPFLAG)state); }