public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax) { if (taskbarSupported) { taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax); } }
public static void SetProgressValue(IntPtr hwnd, ulong value, ulong max) { if (IsInitialized) { taskbar.SetProgressValue(hwnd, value, max); } }
public static void SetTaskbarProgress(this IWin32Window window, int maxValue, int value) { if (Instance != null) { Marshal.ThrowExceptionForHR( Instance.SetProgressValue(window.Handle, (ulong)value, (ulong)maxValue)); } }
/// <summary>Displays or updates a progress bar hosted in a taskbar button to show the specific percentage completed of the full operation.</summary> /// <param name="parent">The window whose associated taskbar button is being used as a progress indicator.</param> /// <param name="completed"> /// An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called. /// </param> /// <param name="total">An application-defined value that specifies the value ullCompleted will have when the operation is complete.</param> public static void SetProgressValue(IWin32Window parent, ulong completed, ulong total) { Validate7OrLater(); if (parent == null) { throw new ArgumentNullException(nameof(parent)); } taskbar4?.SetProgressValue(parent.Handle, completed, total); }
/// <summary> /// Displays or updates a progress bar hosted in a taskbar button of the main application window /// to show the specific percentage completed of the full operation. /// </summary> /// <param name="currentValue">An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called.</param> /// <param name="maximumValue">An application-defined value that specifies the value currentValue will have when the operation is complete.</param> public void SetProgressValue(int currentValue, int maximumValue) { if (!IsWin7()) { return; } TaskbarList.SetProgressValue(OwnerHandle, Convert.ToUInt32(currentValue), Convert.ToUInt32(maximumValue)); }
public void UpdateProgress(ulong completed, ulong total) { if (_taskbarList != null) { MainThread.Post(delegate(object x) { _taskbarList.SetProgressValue(MainThread.MainWindow.Handle, completed, total); }); } }
private void UpdateProgressBarValue(int i) { if (i < progressBarMinimum || i > progressBarMaximum) { throw new ArgumentOutOfRangeException(); } SendMessageHelper(TaskDialogMessage.SetProgressBarPosition, i, 0); if (!SupportsTaskbarProgress) { return; } taskbarList.SetProgressValue(hWndOwner, Convert.ToUInt32(i), Convert.ToUInt32(progressBarMaximum)); }
public static void SetProgressValue(IntPtr handle, int currentValue, int maximumValue) { if (!WindowsUtils.IsWindows7) { return; } try { lock (_taskbarList) _taskbarList.SetProgressValue(handle, Convert.ToUInt32(currentValue), Convert.ToUInt32(maximumValue)); } catch {} }
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 SetProgressValue(int currentValue, int maximumValue) => taskbarList.SetProgressValue(OwnerHandle, (ulong)currentValue, (ulong)maximumValue);
/// <summary> /// Displays or updates a progress bar hosted in a taskbar button of the main application window /// to show the specific percentage completed of the full operation. /// </summary> /// <param name="currentValue">An application-defined value that indicates the proportion of the operation that has been completed at the time the method is called.</param> /// <param name="maximumValue">An application-defined value that specifies the value currentValue will have when the operation is complete.</param> public void SetProgressValue(int currentValue, int maximumValue) { CoreHelpers.ThrowIfNotWin7(); TaskbarList.SetProgressValue(OwnerHandle, Convert.ToUInt32(currentValue), Convert.ToUInt32(maximumValue)); }