예제 #1
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));
        }
예제 #2
0
 void Program_WatchNotify(object sender, Program.WatcherNotifyEventArgs e)
 {
     if (watcherPaths.ContainsKey((FileSystemWatcher)sender))
     {
         PathSetting ps = watcherPaths[(FileSystemWatcher)sender];
         ps.processed = e.processed;
         ps.exception = e.ex;
         ps.Update();
     }
     if (e.progress != null || e.ex != null)
     {
         TBPFLAG progressflag = e.progress ?? false ? TBPFLAG.TBPF_INDETERMINATE : TBPFLAG.TBPF_NOPROGRESS;
         if (e.ex != null)
         {
             progressflag = TBPFLAG.TBPF_ERROR;
         }
         this.BeginInvoke((MethodInvoker) delegate {
             HideProgress(progressflag == TBPFLAG.TBPF_NOPROGRESS);
             if (progressflag != TBPFLAG.TBPF_NOPROGRESS)
             {
                 tbl.SetProgressState(this.Handle, progressflag);
                 if (progressflag == TBPFLAG.TBPF_ERROR)
                 {
                     tbl.SetProgressValue(this.Handle, 100, 100);
                 }
             }
         });
     }
 }
예제 #3
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);
        }
예제 #4
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));
        }
예제 #5
0
 public HRESULT SetProgressState(HWND hwnd, TBPFLAG tbpFlags)
 {
     return(((delegate * unmanaged <ITaskbarList4 *, HWND, TBPFLAG, int>)(lpVtbl[10]))((ITaskbarList4 *)Unsafe.AsPointer(ref this), hwnd, tbpFlags));
 }
예제 #6
0
 public void SetProgressState(TBPFLAG state)
 {
     this.SetProgressState(this.MainHandle, state);
 }
예제 #7
0
 public void SetProgressState(IntPtr Handle, TBPFLAG state)
 {
     TaskbarHelper.taskbar.SetProgressState(Handle, state);
 }
예제 #8
0
 public virtual extern void SetProgressState([In] IntPtr hwnd, [In] TBPFLAG tbpFlags);