bool IActiveTaskDialog.SetProgressBarState(TaskDialogProgressBarState newState) { // TODO Support progress bar state colors on the emulated form // Might be able to do it with some triggers... binding directly to the //Foreground property will overwrite default OS progress bar color return(false); }
/// <summary> /// コントロール名を指定して、 /// <see cref="TaskDialogProgressBar" />クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="name">コントロール名。</param> public TaskDialogProgressBar(string name) : base(name) { Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(name)); this.state = TaskDialogProgressBarState.Normal; }
static Boolean ValidateStateProperty(Object value) { TaskDialogProgressBarState state = (TaskDialogProgressBarState)value; return((state == TaskDialogProgressBarState.Normal) || (state == TaskDialogProgressBarState.Error) || (state == TaskDialogProgressBarState.Paused)); }
public TaskDialogBuilder AddProgressbar(int minValue, int maxValue, TaskDialogProgressBarState state) { Dialog.ProgressBar = new TaskDialogProgressBar(minValue, maxValue, minValue) { State = state }; return(this); }
public bool SetProgressBarState(TaskDialogProgressBarState newState) { if (CurrentProgressBarType == TaskDialogProgressBarType.None) { throw new InvalidOperationException(Resource.InvalidProgressBarModification); } return(SendMessage(Handle, TASKDIALOG_MESSAGE.TDM_SET_PROGRESS_BAR_STATE, (IntPtr)newState, IntPtr.Zero) != IntPtr.Zero); }
/// <summary> /// Shows the TaskDialog. /// </summary> /// <returns>TaskDialogResult.</returns> public TaskDialogResult Show() { result = TaskDialogResult.Cancel; TaskDialogConfiguration nativeConfig = new TaskDialogConfiguration(); nativeConfig.size = (uint)Marshal.SizeOf(nativeConfig); nativeConfig.parentHandle = hWndOwner; nativeConfig.commonButtons = TaskDialogResult.Cancel; nativeConfig.content = text; nativeConfig.windowTitle = caption; nativeConfig.mainInstruction = instructionText; nativeConfig.taskDialogFlags = TaskDialogOptions.AllowCancel | TaskDialogOptions.ShowProgressBar | TaskDialogOptions.PositionRelativeToWindow | TaskDialogOptions.EnableHyperlinks; nativeConfig.callback = new TaskDialogCallback(DialogProc); // Show the dialog. // NOTE: this is a BLOCKING call; the dialog proc callbacks // will be executed by the same thread as the // Show() call before the thread of execution // continues to the end of this method. showState = TaskDialogShowState.Showing; using (new EnableThemingInScope(true)) { // Here is the way we use "vanilla" P/Invoke to call TaskDialogIndirect(). TaskDialogIndirect( nativeConfig, out selectedButtonId, IntPtr.Zero, IntPtr.Zero); } showState = TaskDialogShowState.Closed; // Build and return dialog result to public API - leaving it // null after an exception is thrown is fine in this case if ((TaskDialogCommonButtonReturnId)selectedButtonId == TaskDialogCommonButtonReturnId.Ok) { result = TaskDialogResult.Ok; } // Reset progress bar. ProgressBarState = TaskDialogProgressBarState.Normal; ProgressBarValue = progressBarMinimum; // Free up strings. if (updatedStrings != null) { for (int i = 0; i < updatedStrings.Length; i++) { if (updatedStrings[i] != IntPtr.Zero) { Marshal.FreeHGlobal(updatedStrings[i]); updatedStrings[i] = IntPtr.Zero; } } } return(result); }
/// <summary> /// Sets the state of the progress bar. /// </summary> /// <param name="newState">The state to set the progress bar.</param> /// <returns>If the function succeeds the return value is true.</returns> public bool SetProgressBarState(TaskDialogProgressBarState newState) { // TDM_SET_PROGRESS_BAR_STATE = WM_USER+104, // wParam = new progress state return(UnsafeNativeMethods.SendMessage( this.handle, (uint)TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, (IntPtr)newState, IntPtr.Zero) != IntPtr.Zero); // Future: get more detailed error from and throw. }
/// <summary> /// Sets the state of the progress bar. /// </summary> /// <param name="newState">The state to set the progress bar.</param> /// <returns>If the function succeeds the return value is true.</returns> public static bool SetProgressBarStateAsync(IntPtr handle, TaskDialogProgressBarState newState) { // TDM_SET_PROGRESS_BAR_STATE = WM_USER+104, // wParam = new progress state return(TaskDialogMessageFunctions.SendMessage( handle, (uint)TaskDialogMessages.SetProgressBarState, (IntPtr)newState, IntPtr.Zero) != IntPtr.Zero); // Future: get more detailed error from and throw. }
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); }
static void StatePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { TaskDialogProgressBar progressBar = source as TaskDialogProgressBar; TaskDialogProgressBarState state = (TaskDialogProgressBarState)e.NewValue; if (progressBar != null) { // Get progress bar owner task dialog TaskDialog owner = progressBar.Owner; if (owner != null) { // Send update message only if the owner task dialog has a progress bar and // is activated if (owner.HasProgressBar && owner.IsActivated) { progressBar.SetProgressBarState(state); } } } }
internal void UpdateProgressBarState(TaskDialogProgressBarState state) { AssertCurrentlyShowing(); SendMessageHelper(TaskDialogNativeMethods.TaskDialogMessages.SetProgressBarState, (int)state, 0); }
internal void SetProgressBarState(TaskDialogProgressBar progressBar, TaskDialogProgressBarState state) { this.TaskDialogInternal.SetProgressBarState(progressBar, state); }
/// <summary> /// Resets the state of the control to normal. /// </summary> public virtual void Reset() { state = TaskDialogProgressBarState.Normal; }
internal void SetProgressBarState(TaskDialogProgressBarState state) { NativeMethods.SendMessage( Owner.Handle, (UInt32)NativeMethods.TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, new UIntPtr((UInt32)state), IntPtr.Zero); }
public void SetProgressBarState(TaskDialogProgressBarState state) { SendMessage(TaskDialogHandle, TaskDialogMessages.SetProgressBarState, new IntPtr(( int )state), 0); }
public void SetProgressBarState(TaskDialogProgressBarState state) { SendMessage(TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, (int)state, 0); }
/// <summary> /// Resets the state of the control to normal. /// </summary> protected internal virtual void Reset() { state = TaskDialogProgressBarState.Normal; }
/// <summary> /// プログレスバーの値を最小値に設定します。 /// </summary> protected internal override void Reset() { this.state = TaskDialogProgressBarState.Normal; this.value = this.minimum; }
internal void UpdateProgressBarState(TaskDialogProgressBarState state) { AssertCurrentlyShowing(); SendMessageHelper(NativeMethods.TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, (int)state, 0); }
/// <summary> /// プログレスバーの状態を設定します。 /// </summary> /// <param name="control">プログレスバー。</param> /// <param name="state">プログレスバー状態。</param> public void SetProgressBarState(TaskDialogProgressBar control, TaskDialogProgressBarState state) { this.Commands.SetProgressBarStateCommand(state); }
public void SetProgressBarStateCommand(TaskDialogProgressBarState state) { var wParam = (IntPtr)(int)state; SendCommandMessage(TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, wParam, IntPtr.Zero); }
internal void UpdateProgressBarState(TaskDialogProgressBarState state) { AssertCurrentlyShowing(); SendMessageHelper(TaskDialogNativeMethods.TASKDIALOG_MESSAGES.TDM_SET_PROGRESS_BAR_STATE, (int)state, 0); }
/// <summary> /// /// </summary> public TaskDialogProgressBar(TaskDialogProgressBarState state) : this() { // Use the setter which will validate the value. State = state; }
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 ); }