예제 #1
0
 public static void SetProgressValue(double progressValue, double progressMax)
 {
     if (taskbarSupported && hWnd != IntPtr.Zero)
     {
         taskbarInstance.SetProgressValue(hWnd, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #2
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #3
0
 /// <summary>Set progress state.</summary>
 /// <param name="window">User window handle.</param>
 /// <param name="state">State of taskbar.</param>
 /// <param name="maxValue">Maximal progress position.</param>
 public static void SetState(eStates state, ulong maxValue)
 {
     FormInvoke((MethodInvoker) delegate
     {
         taskbar.SetProgressState(taskBarForm.Handle, state);
         taskbar.SetProgressValue(taskBarForm.Handle, 0, maxValue);
     });
 }
예제 #4
0
 public static void SetProgressValue(IntPtr hwnd, ulong current, ulong maximum)
 {
     try
     {
         if (IsInitialized)
         {
             TaskbarList.SetProgressValue(hwnd, current, maximum);
         }
     }
     catch { }
 }
예제 #5
0
 /// <summary>
 /// Set value
 /// </summary>
 /// <param name="form">Form</param>
 /// <param name="progressValue">Progress value</param>
 /// <param name="progressMax">Progress maximal</param>
 public static void SetValue(Form form, double progressValue, double progressMax)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressValue(form.Handle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #6
0
        public void SetProgress(TaskbarProgressState state, float progress)
        {
            if (!supported)
            {
                return;
            }

            var winhandle = Process.GetCurrentProcess().MainWindowHandle;
            var taskstate = 0;

            switch (state)
            {
            case TaskbarProgressState.Indeterminate:
                taskstate = 0x1;
                break;

            case TaskbarProgressState.Progress:
                taskstate = 0x2;
                break;

            case TaskbarProgressState.Error:
                taskstate = 0x4;
                break;

            case TaskbarProgressState.Paused:
                taskstate = 0x8;
                break;
            }

            instance.SetProgressState(winhandle, taskstate);
            instance.SetProgressValue(winhandle, (ulong)(progress * 1000), 1000);
        }
예제 #7
0
 public void SetProgressValue(UInt64 progressValue, UInt64 progressMax)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressValue(this.handle_, progressValue, progressMax);
     }
 }
예제 #8
0
 public static void SetValue(IntPtr windowHandle, int progressValue, int progressMax)
 {
     if (taskbarSupported && !IndicatorStateLocked)
     {
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #9
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (taskbarSupported && !(DetectLinux.WineDetected() || DetectLinux.NativeLinuxDetected()))
     {
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #10
0
 public static void SetProgressValue(this Form form, ulong value, ulong max)
 {
     if (_Supported)
     {
         _Instance.SetProgressValue(form.Handle, value, max);
     }
 }
예제 #11
0
 /// <summary>
 /// Sets the progress value of the specified window's
 /// taskbar button.
 /// </summary>
 /// <param name="hWnd">The window handle.</param>
 /// <param name="current">The current value.</param>
 /// <param name="maximum">The maximum value.</param>
 public static void SetProgressValue(IntPtr hWnd, ulong current, ulong maximum)
 {
     if (Windows7OrGreater)
     {
         TaskbarList.SetProgressValue(hWnd, current, maximum);
     }
 }
예제 #12
0
 private static void SetTaskbarProgressValue(IntPtr hwnd, double value)
 {
     if (_taskbarSupported)
     {
         _taskbar.SetProgressValue(hwnd, (ulong)(value * 1000), 1000);
     }
 }
 public static void SetValue(double progressValue, double progressMax)
 {
     if (_taskbarSupported)
     {
         _taskbarInstance.SetProgressValue(GetConsoleWindow(), (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #14
0
 private static void SetValue(IntPtr handle, ulong value, ulong max)
 {
     if (!Supported)
     {
         return;
     }
     Instance.SetProgressValue(handle, value, max);
 }
예제 #15
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (!IsSupported())
     {
         return;
     }
     taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
 }
예제 #16
0
 internal static void SetValue(IntPtr windowHandle, int progressValue, int progressMax)
 {
     if (!_taskbarSupported || windowHandle == IntPtr.Zero)
     {
         return;
     }
     _instance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
 }
예제 #17
0
 private static void SetValueUnsafe(IntPtr handle, ulong value, ulong max)
 {
     // ReSharper disable once SuspiciousTypeConversion.Global
     if (_instance == null)
     {
         _instance = new TaskbarInstance() as ITaskbarList3;
     }
     _instance?.SetProgressValue(handle, value, max);
 }
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     try {
         if (taskbarSupported && !DetectLinux.LinuxDetected())
         {
             taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
         }
     } catch { }
 }
예제 #19
0
 void Show()
 {
     _isVisible = true;
     _taskbarList?.SetProgressState(_handle, ProgressValue.HasValue ? TaskbarStates.Normal : TaskbarStates.Indeterminate);
     if (ProgressValue.HasValue)
     {
         _taskbarList?.SetProgressValue(_handle, (ulong)(ProgressValue.Value * 100), 100);
     }
 }
예제 #20
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
     else
     {
         throw new NotSupportedException("TaskBar function is not supported in this OS version");
     }
 }
예제 #21
0
        public static void SetProgressValue(Form fWindow, UInt64 ullCompleted,
                                            UInt64 ullTotal)
        {
            if (!EnsureInitialized())
            {
                return;
            }

            try { m_tbList.SetProgressValue(fWindow.Handle, ullCompleted, ullTotal); }
            catch (Exception) { Debug.Assert(false); }
        }
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState, double progressValue = 0.0, double progressMax = 0.0)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
         if (progressValue > 0 && progressMax > 0)
         {
             taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
         }
     }
 }
예제 #23
0
 public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
 {
     if (taskbarSupported)
     {
         if (taskbarInstance == null)
         {
             taskbarInstance = (ITaskbarList3) new TaskbarInstance();
         }
         taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
     }
 }
예제 #24
0
        /// <summary>
        /// catches the StatusUpdate event fired from Form1 and updates the GUI accordingly
        /// </summary>
        /// <param name="su"></param>
        public void UpdateStatus(StatusUpdate su)
        {
            try
            {
                // possible to abort job
                abortButton.Enabled = (su.JobStatus == JobStatus.PROCESSING);

                // Current position
                positionInClip.Text = (Util.ToString(su.ClipPosition) ?? "---") +
                                      " / " + (Util.ToString(su.ClipLength) ?? "---");

                // Current frame
                currentVideoFrame.Text = (Util.ToString(su.NbFramesDone, true) ?? "---") +
                                         " / " + (Util.ToString(su.NbFramesTotal, true) ?? "---");

                // Data
                videoData.Text = (su.CurrentFileSize.HasValue ? su.CurrentFileSize.Value.ToString() : "---") +
                                 " / " + (su.ProjectedFileSize.HasValue ? su.ProjectedFileSize.Value.ToString() : "---");

                // Processing speed
                fps.Text = su.ProcessingSpeed ?? "---";

                // Time elapsed
                // Now we use TotalHours to avoid 24h+ resets...
                if (su.TimeElapsed.TotalHours > 24)
                {
                    timeElapsed.Text = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", (int)su.TimeElapsed.TotalDays, su.TimeElapsed.Hours, su.TimeElapsed.Minutes, su.TimeElapsed.Seconds);
                }
                else
                {
                    timeElapsed.Text = string.Format("{0:00}:{1:00}:{2:00}", (int)su.TimeElapsed.Hours, su.TimeElapsed.Minutes, su.TimeElapsed.Seconds);
                }

                // Estimated time
                // go back to the old function ;-)
                totalTime.Text = getTimeString(su.TimeElapsed, su.PercentageDoneExact ?? 0M);

                this.Text        = "Status: " + (su.PercentageDoneExact ?? 0M).ToString("0.00") + " %";
                statusLabel.Text = su.Status ?? "";

                jobNameLabel.Text = "[" + su.JobName + "]";

                progress.Value = su.PercentageDone;

                if ((Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1) ||
                    Environment.OSVersion.Version.Major > 6)
                {
                    taskbarProgress.SetProgressValue(this.Handle, Convert.ToUInt64(su.PercentageDone), 100);
                }
            }
            catch (Exception) { }
        }
예제 #25
0
        private HRESULT _UpdateProgressValue(bool attached)
        {
            if (!attached || ProgressState == TaskbarItemProgressState.None || ProgressState == TaskbarItemProgressState.Indeterminate)
            {
                return(HRESULT.S_OK);
            }
            const ulong precisionValue = 1000;

            Assert.BoundedDoubleInc(0, ProgressValue, 1);
            var intValue = (ulong)(ProgressValue * precisionValue);

            return(_taskbarList.SetProgressValue(_hwndSource.Handle, intValue, precisionValue));
        }
예제 #26
0
 public static void SetProgress(IntPtr WindowHandle, ulong Completed, ulong Total)
 {
     if (Interface != null)
     {
         try
         {
             Interface.SetProgressValue(WindowHandle, Completed, Total);
         }
         catch
         {
         }
     }
 }
예제 #27
0
 private static void SetValue(IntPtr handle, ulong value, ulong max)
 {
     if (!_supported)
     {
         return;
     }
     try {
         Instance.SetProgressValue(handle, value, max);
     } catch (InvalidCastException e) {
         Logging.Warning(e);
         _supported = false;
     }
 }
예제 #28
0
 public void SetValue(IntPtr windowHandle, ulong progressValue, ulong progressMax)
 {
     if (isSupported)
     {
         try
         {
             instance.SetProgressValue(windowHandle, progressValue, progressMax);
         }
         catch (Exception e)
         {
             Util.Logging.Log(e);
         }
     }
 }
        public override void WriteProgress(long sourceId, ProgressRecord record)
        {
            IntPtr hWnd = GetConsoleWindow();

            if (record.PercentComplete == 100)
            {
                taskBarList.SetProgressState(hWnd, TBPFLAG.TBPF_NOPROGRESS);
            }
            else
            {
                taskBarList.SetProgressState(hWnd, TBPFLAG.TBPF_NORMAL);
            }

            taskBarList.SetProgressValue(hWnd, unchecked ((ulong)record.PercentComplete), unchecked ((ulong)100));
        }
예제 #30
0
 private void SetTaskbarProgress(int progress)
 {
     if (_isWin7TaskBar)
     {
         try
         {
             if (progress == 0)
             {
                 _taskbarList.SetProgressState(_taskbarParent, TBPFLAG.TBPF_NOPROGRESS);
             }
             else
             {
                 _taskbarList.SetProgressState(_taskbarParent, TBPFLAG.TBPF_NORMAL);
                 _taskbarList.SetProgressValue(_taskbarParent, (ulong)progress, 100);
             }
         }
         catch { }
     }
 }