Compartilhar via


ModulePropertiesPage.ApplyChanges Método

Definição

Atualizações o ModuleDialogPage objeto quando o usuário clica no botão Aplicar.

protected:
 override bool ApplyChanges();
protected override bool ApplyChanges ();
override this.ApplyChanges : unit -> bool
Protected Overrides Function ApplyChanges () As Boolean

Retornos

true se a atualização for bem-sucedida, caso contrário, false.

Exemplos

O exemplo a seguir chama o método UpdateCustomSettings user para salvar as alterações nas configurações da propriedade.

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);
} 

Aplica-se a