// Called when a control currently in the collection // has a property changed - this handles propagating // the new property values to the Win32 API. // If there isn't a way to change the Win32 value, then we // should have already screened out the property set // in NotifyControlPropertyChanging. void IDialogControlHost.ApplyControlPropertyChange(string propertyName, DialogControl control) { // We only need to apply changes to the // native dialog when it actually exists. if (NativeDialogShowing) { // One of the progress bar flavors? if (control is TaskDialogMarquee) { if (propertyName == "State") { nativeDialog.UpdateProgressBarState(marquee.State); } else { Debug.Assert(true, "Unknown property being set"); } } else if (control is TaskDialogProgressBar) { if (!progressBar.HasValidValues) { throw new ArgumentException( "Progress bar must have a value between Minimum and Maximum."); } switch (propertyName) { case "State": nativeDialog.UpdateProgressBarState(progressBar.State); break; case "Value": nativeDialog.UpdateProgressBarValue(progressBar.Value); break; case "Minimum": case "Maximum": nativeDialog.UpdateProgressBarRange(); break; default: Debug.Assert(true, "Unknown property being set"); break; } } else if (control is TaskDialogButton) { TaskDialogButton button = (TaskDialogButton)control; switch (propertyName) { case "ShowElevationIcon": nativeDialog.UpdateElevationIcon(button.Id, button.ShowElevationIcon); break; case "Enabled": if (control is TaskDialogRadioButton) { nativeDialog.UpdateRadioButtonEnabled(button.Id, button.Enabled); } else { nativeDialog.UpdateButtonEnabled(button.Id, button.Enabled); } break; default: Debug.Assert(true, "Unknown property being set"); break; } } else { // Do nothing with property change - // note that this shouldn't ever happen, we should have // either thrown on the changing event, or we handle above. Debug.Assert(true, "Control property changed notification not handled properly - being ignored"); } } return; }