ModulePropertiesPage.ApplyChanges Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Updates the ModuleDialogPage object when the user clicks the Apply button.
protected:
override bool ApplyChanges();
protected override bool ApplyChanges ();
override this.ApplyChanges : unit -> bool
Protected Overrides Function ApplyChanges () As Boolean
Returns
true
if the update was successful; otherwise, false
.
Examples
The following example calls the user method UpdateCustomSettings
to save changes to the property settings.
internal class CustomModuleServiceProxy : ModuleServiceProxy {
public PropertyBag GetCustomSettings() {
return (PropertyBag)Invoke("GetCustomSettingsMSM");
}
public void UpdateCustomSettings(PropertyBag updatedSettings) {
Invoke("UpdateCustomSettingsMSM", updatedSettings);
}
}
[ModuleServiceMethod]
public void UpdateCustomSettingsMSM(
PropertyBag updatedSettings) {
if (updatedSettings == null) {
throw new ArgumentNullException("updatedSettings");
}
foreach (int key in updatedSettings.ModifiedKeys) {
SetAttrVal_IF(key, updatedSettings, SH.boolProp);
SetAttrVal_IF(key, updatedSettings, SH.intProp);
SetAttrVal_IF(key, updatedSettings, SH.strProp);
SetAttrVal_IF(key, updatedSettings, SH.strProp2);
SetAttrVal_IF(key, updatedSettings, SH.TSprop);
}
// save the configuration file.
ManagementUnit.Update();
}
protected override PropertyBag
UpdateProperties(
out bool updateSuccessful
) {
TrcAll();
updateSuccessful = false;
try {
ServiceProxy.UpdateCustomSettings(_clone);
_bag = _clone;
updateSuccessful = true;
} catch (Exception ex) {
OnException(ex);
}
return _bag;
}
void SetAttrVal_IF(int key,
PropertyBag updatedSettings,
SH.PropInt pi) {
if (key == pi.Indx)
SetAttrVal(pi, updatedSettings);
}