SettingsSavedEventArgs SettingsSavedEventArgs SettingsSavedEventArgs SettingsSavedEventArgs Class

定義

SettingsSaved イベントのデータを提供します。Provides data for the SettingsSaved event.

public ref class SettingsSavedEventArgs : EventArgs
public class SettingsSavedEventArgs : EventArgs
type SettingsSavedEventArgs = class
    inherit EventArgs
Public Class SettingsSavedEventArgs
Inherits EventArgs
継承
SettingsSavedEventArgsSettingsSavedEventArgsSettingsSavedEventArgsSettingsSavedEventArgs

次のコード例では、このクラスを使用して、正常に保存された設定の一覧を表示する方法を示します。The following example code demonstrates how to use this class to display a list of settings that were not successfully saved.

private void AttachSettingsSavedEventHandler()
{
    ((ClientSettingsProvider)Properties.Settings.Default.Providers
        ["System.Web.ClientServices.Providers.ClientSettingsProvider"])
        .SettingsSaved +=
        new EventHandler<SettingsSavedEventArgs>(Form1_SettingsSaved);
}

private void Form1_SettingsSaved(object sender,
    SettingsSavedEventArgs e)
{
    // If any settings were not saved, display a list of them.
    if (e.FailedSettingsList.Count > 0)
    {
        String failedSettings = String.Join(
            Environment.NewLine,
            e.FailedSettingsList.ToArray());

        String message = String.Format("{0}{1}{1}{2}",
            "The following setting(s) were not saved:",
            Environment.NewLine, failedSettings);

        MessageBox.Show(message, "Unable to save settings",
            MessageBoxButtons.OK, MessageBoxIcon.Warning);
    }
}
Private WithEvents settingsProvider As ClientSettingsProvider = My.Settings _
    .Providers("System.Web.ClientServices.Providers.ClientSettingsProvider")

Private Sub Form1_SettingsSaved(ByVal sender As Object, _
    ByVal e As SettingsSavedEventArgs) _
    Handles settingsProvider.SettingsSaved

    ' If any settings were not saved, display a list of them.
    If e.FailedSettingsList.Count > 0 Then

        Dim failedSettings As String = String.Join( _
            Environment.NewLine, e.FailedSettingsList.ToArray())

        Dim message As String = String.Format("{0}{1}{1}{2}", _
            "The following setting(s) were not saved:", _
            Environment.NewLine, failedSettings)

        MessageBox.Show(message, "Unable to save settings", _
            MessageBoxButtons.OK, MessageBoxIcon.Warning)

    End If

End Sub

注釈

ClientSettingsProvider.SettingsSaved設定が正常に保存されていない場合でも発生する設定プロバイダーが、設定サービスにアクセスした後のイベント。The ClientSettingsProvider.SettingsSaved event occurs after the settings provider accesses the settings service, even if the settings were not successfully saved. プロバイダーは、設定を保存できない理由の 1 つは、現在のユーザーがログアウトしたかどうかです。使用することができます、FailedSettingsListプロパティをすべての設定が正常に保存されないかどうかを判断します。One reason that the provider might fail to save the settings is if the current user has been logged out. You can use the FailedSettingsList property to determine whether any settings were not successfully saved.

設定プロバイダーが、代わりに、プロバイダーをスローすると、その設定サービスにアクセスできない場合、このイベントは発生しませんが、WebExceptionします。This event does not occur if the settings provider cannot access the settings service, which instead causes the provider to throw a WebException.

イベントを処理する方法の詳細については、次を参照してください。処理とイベントの発生します。For more information about how to handle events, see Handling and Raising Events.

コンストラクター

SettingsSavedEventArgs(IEnumerable<String>) SettingsSavedEventArgs(IEnumerable<String>) SettingsSavedEventArgs(IEnumerable<String>) SettingsSavedEventArgs(IEnumerable<String>)

SettingsSavedEventArgs クラスの新しいインスタンスを初期化します。Initializes a new instance of the SettingsSavedEventArgs class.

プロパティ

FailedSettingsList FailedSettingsList FailedSettingsList FailedSettingsList

ClientSettingsProvider がサーバーに保存できなかった設定を取得します。Gets the settings that the ClientSettingsProvider was unable to save to the server.

メソッド

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

こちらもご覧ください