@@ -473,12 +473,16 @@ private static ProgressBarStyle ProgressFormStyle {
473473
474474 set {
475475 if ( value != ProgressBarStyle . Marquee ) {
476+ if ( ProgressManager . progressFormState != TBPF . TBPF_INDETERMINATE ) {
477+ return ;
478+ }
479+
476480 ProgressFormValue = ProgressManager . value ;
477481 ProgressFormState = ProgressManager . state ;
478482 return ;
479483 }
480484
481- // normal state does not take priority over indeterminate state
485+ // only enter indeterminate state from normal/no progress states
482486 if ( ProgressManager . progressFormState != TBPF . TBPF_NORMAL
483487 && ProgressManager . progressFormState != TBPF . TBPF_NOPROGRESS ) {
484488 return ;
@@ -530,8 +534,9 @@ private static int ProgressFormValue {
530534
531535 ProgressManager . progressFormState = TBPF . TBPF_NOPROGRESS ;
532536 } else {
533- // if we haven't completed, ignore the value in the indeterminate state
534- if ( ProgressManager . progressFormState == TBPF . TBPF_INDETERMINATE ) {
537+ // if we haven't completed, ignore the value in the marquee style
538+ // (note: we don't check indeterminate state here, in case we are trying to leave that state)
539+ if ( ProgressManager . style == ProgressBarStyle . Marquee ) {
535540 ProgressFormStyle = ProgressManager . style ;
536541 return ;
537542 }
@@ -551,7 +556,7 @@ private static int ProgressFormValue {
551556
552557 taskbarList . SetProgressValue ( ProgressForm . Handle , ProgressManager . progressFormValue , PROGRESS_FORM_VALUE_COMPLETE ) ;
553558
554- // it is required to set the state to No Progress when completed
559+ // it is required to enter no progress state when completed
555560 if ( completed ) {
556561 taskbarList . SetProgressState ( ProgressForm . Handle , ProgressManager . progressFormState ) ;
557562 return ;
@@ -591,12 +596,13 @@ private static IntPtr ProgressFormState {
591596
592597 ProgressManager . progressFormState = TBPF . TBPF_PAUSED ;
593598 } else {
594- if ( ProgressManager . progressFormState == TBPF . TBPF_NORMAL ) {
599+ // normal state does not take priority over marquee style
600+ // (note: we don't check indeterminate state here, in case we are trying to leave that state)
601+ if ( ProgressManager . style == ProgressBarStyle . Marquee ) {
595602 return ;
596603 }
597604
598- // normal state does not take priority over indeterminate state
599- if ( ProgressManager . progressFormState == TBPF . TBPF_INDETERMINATE ) {
605+ if ( ProgressManager . progressFormState == TBPF . TBPF_NORMAL ) {
600606 return ;
601607 }
602608
0 commit comments