次の方法で共有


ConnectionActiveState.DifferentCredentials プロパティ

定義

資格情報が異なるかどうかを示す値を取得します。

public:
 property bool DifferentCredentials { bool get(); };
public bool DifferentCredentials { get; }
member this.DifferentCredentials : bool
Public ReadOnly Property DifferentCredentials As Boolean

プロパティ値

true 資格情報が同じ場合は 。それ以外の場合は false

void OpenConnection(IServiceProvider serviceProvider,
    ConnectionInfo newConnectionInfo) {

    if (newConnectionInfo != null) {
        IConnectionManager connectionManager =
            (IConnectionManager)
            serviceProvider.GetService(
            typeof(IConnectionManager)
            );

        if (connectionManager == null)
            return;

        using (new WaitCursor()) {
            ConnectionActiveState activeState =
                connectionManager.GetConnectionActiveState(
                newConnectionInfo);
            if (activeState.DifferentCredentials) {
                ShowMessage("ConnectionAlreadyExists",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                newConnectionInfo = 
                    activeState.SimilarConnection;
            }

            MyActivateConnectionInfo(
                connectionManager,
                newConnectionInfo
                );
        }

    }
}

適用対象