예제 #1
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
 }
예제 #2
0
 public static void SetProgressStyle(IntPtr hwnd, TaskbarProgressBarStyle style)
 {
     if (IsInitialized)
     {
         taskbar.SetProgressState(hwnd, style);
     }
 }
예제 #3
0
 /// <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);
 }
예제 #4
0
 public static void SetTaskbarProgressMode(this IWin32Window window, TaskbarProgressMode mode)
 {
     if (Instance != null)
     {
         Marshal.ThrowExceptionForHR(
             Instance.SetProgressState(window.Handle, (TBPFLAG)mode));
     }
 }
예제 #5
0
        // 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);
         });
     }
 }
예제 #7
0
 public static void SetProgressState(IntPtr handle, ProgressBarState state)
 {
     if (!WindowsUtils.IsWindows7)
     {
         return;
     }
     try
     {
         lock (_taskbarList)
             _taskbarList.SetProgressState(handle, state);
     }
     catch
     {}
 }
예제 #8
0
        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);
        }
예제 #9
0
        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);
                }
            }
        }
예제 #10
0
        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));
        }
예제 #11
0
파일: Program.cs 프로젝트: odalet/misc
 public void SetProgressState(TaskbarProgressBarStatus state) =>
 taskbarList.SetProgressState(OwnerHandle, state);
예제 #12
0
        /// <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);
        }