Ejemplo n.º 1
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
 }
Ejemplo n.º 2
0
 public static void SetProgressState(enTaskbarStates taskbarState)
 {
     if (taskbarSupported && hWnd != IntPtr.Zero)
     {
         taskbarInstance.SetProgressState(hWnd, taskbarState);
     }
 }
        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));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Set state
 /// </summary>
 /// <param name="form">Form</param>
 /// <param name="taskbarState">Taskbar state</param>
 public static void SetState(Form form, TaskbarStates taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(form.Handle, taskbarState);
     }
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public void SetProgressState(Status taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(this.handle_, taskbarState);
     }
 }
Ejemplo n.º 7
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported && !(DetectLinux.WineDetected() || DetectLinux.NativeLinuxDetected()))
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
 }
Ejemplo n.º 8
0
 public static void SetProgressState(this Form form, TBPF state)
 {
     if (_Supported)
     {
         _Instance.SetProgressState(form.Handle, state);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Sets the progress state of the specified window's
 /// taskbar button.
 /// </summary>
 /// <param name="hWnd">The window handle.</param>
 /// <param name="state">The progress state.</param>
 public static void SetProgressState(IntPtr hWnd, ThumbnailProgressState state)
 {
     if (Windows7OrGreater)
     {
         TaskbarList.SetProgressState(hWnd, state);
     }
 }
Ejemplo n.º 10
0
 private static void SetTaskbarProgressState(IntPtr hwnd, TaskbarStates state)
 {
     if (_taskbarSupported)
     {
         _taskbar.SetProgressState(hwnd, state);
     }
 }
Ejemplo n.º 11
0
 public static void SetState(TaskbarState taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(WindowHandle, taskbarState);
     }
 }
Ejemplo n.º 12
0
 public static void SetState(TaskbarStates taskbarState)
 {
     if (_taskbarSupported)
     {
         _taskbarInstance.SetProgressState(GetConsoleWindow(), taskbarState);
     }
 }
Ejemplo n.º 13
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (!IsSupported())
     {
         return;
     }
     taskbarInstance.SetProgressState(windowHandle, taskbarState);
 }
Ejemplo n.º 14
0
 internal static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (!_taskbarSupported || windowHandle == IntPtr.Zero)
     {
         return;
     }
     _instance.SetProgressState(windowHandle, taskbarState);
 }
Ejemplo n.º 15
0
 private static void SetState(IntPtr handle, TaskbarState state)
 {
     if (!Supported)
     {
         return;
     }
     Instance.SetProgressState(handle, state);
 }
Ejemplo n.º 16
0
 private static void SetStateUnsafe(IntPtr handle, TaskbarState state)
 {
     // ReSharper disable once SuspiciousTypeConversion.Global
     if (_instance == null)
     {
         _instance = new TaskbarInstance() as ITaskbarList3;
     }
     _instance?.SetProgressState(handle, state);
 }
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     try {
         if (taskbarSupported && !DetectLinux.LinuxDetected())
         {
             taskbarInstance.SetProgressState(windowHandle, taskbarState);
         }
     } catch { }
 }
Ejemplo n.º 18
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 { }
     }
 }
Ejemplo n.º 19
0
        public static void SetProgressState(Form fWindow, TbpFlag tbpFlags)
        {
            if (!EnsureInitialized())
            {
                return;
            }

            try { m_tbList.SetProgressState(fWindow.Handle, tbpFlags); }
            catch (Exception) { Debug.Assert(false); }
        }
Ejemplo n.º 20
0
 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);
         }
     }
 }
Ejemplo n.º 21
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported)
     {
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
     else
     {
         throw new NotSupportedException("TaskBar function is not supported in this OS version");
     }
 }
Ejemplo n.º 22
0
 public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (taskbarSupported)
     {
         if (taskbarInstance == null)
         {
             taskbarInstance = (ITaskbarList3) new TaskbarInstance();
         }
         taskbarInstance.SetProgressState(windowHandle, taskbarState);
     }
 }
Ejemplo n.º 23
0
 public static void SetState(IntPtr WindowHandle, TaskbarState State)
 {
     if (Interface != null)
     {
         try
         {
             Interface.SetProgressState(WindowHandle, State);
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 24
0
        public static void UninitializeWin7Taskbar()
        {
            //Отключаем вывод прогресса
            _IsInitialized = false;

            if (TaskbarList != null)
            {
                try
                {
                    //Сбрасываем прогресс везде где он мог быть (т.е. во всех активных окнах)
                    foreach (System.Windows.Window wnd in System.Windows.Application.Current.Windows)
                    {
                        TaskbarList.SetProgressState(new System.Windows.Interop.WindowInteropHelper(wnd).Handle, TBPF.NOPROGRESS);
                    }
                }
                catch { }

                try { Marshal.ReleaseComObject(TaskbarList); }
                catch { }
                finally { TaskbarList = null; }
            }
        }
Ejemplo n.º 25
0
        private static bool _supported = false; // Environment.OSVersion.Version >= new Version(6, 1);

        private static void SetState(IntPtr handle, TaskbarState state)
        {
            if (!_supported)
            {
                return;
            }
            try {
                Instance.SetProgressState(handle, state);
            } catch (InvalidCastException e) {
                Logging.Warning(e);
                _supported = false;
            }
        }
Ejemplo n.º 26
0
 public void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     if (isSupported)
     {
         try
         {
             instance.SetProgressState(windowHandle, taskbarState);
         }
         catch (Exception e)
         {
             Util.Logging.Log(e);
         }
     }
 }
Ejemplo n.º 27
0
        private HRESULT _UpdateProgressState(bool attached)
        {
            TaskbarItemProgressState ps = ProgressState;

            TBPF tbpf = TBPF.NOPROGRESS;

            if (attached)
            {
                switch (ps)
                {
                case TaskbarItemProgressState.Error:
                    tbpf = TBPF.ERROR;
                    break;

                case TaskbarItemProgressState.Indeterminate:
                    tbpf = TBPF.INDETERMINATE;
                    break;

                case TaskbarItemProgressState.None:
                    tbpf = TBPF.NOPROGRESS;
                    break;

                case TaskbarItemProgressState.Normal:
                    tbpf = TBPF.NORMAL;
                    break;

                case TaskbarItemProgressState.Paused:
                    tbpf = TBPF.PAUSED;
                    break;

                default:
                    // The coersion should have caught this.
                    Assert.Fail();
                    tbpf = TBPF.NOPROGRESS;
                    break;
                }
            }

            HRESULT hr = _taskbarList.SetProgressState(_hwndSource.Handle, tbpf);

            if (hr.Succeeded)
            {
                // Explicitly update this in case this property being set
                // to None or Indeterminate before made the value not update.
                hr = _UpdateProgressValue(attached);
            }

            return(hr);
        }
Ejemplo n.º 28
0
        private HRESULT _UpdateProgressState(bool attached)
        {
            var ps   = ProgressState;
            var tbpf = TBPF.NOPROGRESS;

            if (attached)
            {
                switch (ps)
                {
                case TaskbarItemProgressState.Error:
                    tbpf = TBPF.ERROR;
                    break;

                case TaskbarItemProgressState.Indeterminate:
                    tbpf = TBPF.INDETERMINATE;
                    break;

                case TaskbarItemProgressState.None:
                    tbpf = TBPF.NOPROGRESS;
                    break;

                case TaskbarItemProgressState.Normal:
                    tbpf = TBPF.NORMAL;
                    break;

                case TaskbarItemProgressState.Paused:
                    tbpf = TBPF.PAUSED;
                    break;

                default:

                    Assert.Fail();
                    tbpf = TBPF.NOPROGRESS;
                    break;
                }
            }
            var hr = _taskbarList.SetProgressState(_hwndSource.Handle, tbpf);

            if (hr.Succeeded)
            {
                hr = _UpdateProgressValue(attached);
            }
            return(hr);
        }
Ejemplo n.º 29
0
 void Hide()
 {
     _isVisible = false;
     _taskbarList?.SetProgressState(_handle, TaskbarStates.NoProgress);
 }
Ejemplo n.º 30
0
 public void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
 {
     taskbarInstance.SetProgressState(windowHandle, taskbarState);
 }