ServiceInstallerDialogResultとは? わかりやすく解説

ServiceInstallerDialog.Result プロパティ

サービス アカウント フォームダイアログ ボックス結果取得します

名前空間: System.ServiceProcess.Design
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

Public ReadOnly Property
 Result As ServiceInstallerDialogResult
Dim instance As ServiceInstallerDialog
Dim value As ServiceInstallerDialogResult

value = instance.Result
public ServiceInstallerDialogResult Result { get;
 }
public:
property ServiceInstallerDialogResult Result {
    ServiceInstallerDialogResult get ();
}
/** @property */
public ServiceInstallerDialogResult get_Result ()
public function get Result
 () : ServiceInstallerDialogResult

プロパティ
ダイアログ ボックス対すユーザー応答を示す ServiceInstallerDialogResult。既定値OK です。

解説解説
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ServiceInstallerDialog クラス
ServiceInstallerDialog メンバ
System.ServiceProcess.Design 名前空間
ServiceInstallerDialogResult

ServiceInstallerDialogResult 列挙体

ServiceInstallerDialog フォーム戻り値指定します

名前空間: System.ServiceProcess.Design
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

Public Enumeration ServiceInstallerDialogResult
Dim instance As ServiceInstallerDialogResult
public enum ServiceInstallerDialogResult
public enum class ServiceInstallerDialogResult
public enum ServiceInstallerDialogResult
public enum ServiceInstallerDialogResult
メンバメンバ
解説解説

ServiceInstallerDialog.Result プロパティは、この列挙体を使用してダイアログ ボックスへのユーザー応答示します

使用例使用例

ServiceInstallerDialog使用してユーザーサービス インストール アカウント入力するように要求するプロンプト表示する例を次に示します

// Prompt the user for service installation account values.
public static bool GetServiceAccount(ref
 ServiceProcessInstaller svcInst)
{
    bool accountSet = false;
    ServiceInstallerDialog svcDialog = new ServiceInstallerDialog();

    // Query the user for the service account type.
    do
    {
        svcDialog.TopMost = true;
        svcDialog.ShowDialog();

        if (svcDialog.Result == ServiceInstallerDialogResult.OK)
        {
            // Do a very simple validation on the user
            // input.  Check to see whether the user name
            // or password is blank.

            if ((svcDialog.Username.Length > 0) &&
                (svcDialog.Password.Length > 0)   )
            {
                // Use the account and password.
                accountSet = true;

                svcInst.Account = ServiceAccount.User;
                svcInst.Username = svcDialog.Username;
                svcInst.Password = svcDialog.Password;
            }
        }
        else if (svcDialog.Result == ServiceInstallerDialogResult.UseSystem)
        {
            svcInst.Account = ServiceAccount.LocalSystem;
            svcInst.Username = null;
            svcInst.Password = null;
            accountSet  = true;
        }
            
        if (!accountSet )
        {
            // Display a message box.  Tell the user to
            // enter a valid user and password, or cancel
            // out to leave the service account alone.
            DialogResult result;
            result = MessageBox.Show("Invalid user name or password for
 service installation."+
                                     "  Press Cancel to leave the service account
 unchanged.",
                                     "Change Service Account", 
                                     MessageBoxButtons.OKCancel,
                                     MessageBoxIcon.Hand);

            if (result == DialogResult.Cancel)
            {
                // Break out of loop.
                break;
            }
        }
    } while (!accountSet);

    return accountSet;
}
   // Prompt the user for service installation account values.
public:
   static bool GetServiceAccount( interior_ptr<ServiceProcessInstaller^>
 svcInst )
   {
      bool accountSet = false;
      ServiceInstallerDialog^ svcDialog = gcnew ServiceInstallerDialog;

      // Query the user for the service account type.
      do
      {
         svcDialog->TopMost = true;
         svcDialog->ShowDialog();
         if ( svcDialog->Result == ServiceInstallerDialogResult::OK
 )
         {
            // Do a very simple validation on the user
            // input.  Check to see whether the user name
            // or password is blank.
            if ( (svcDialog->Username->Length > 0) &&
 (svcDialog->Password->Length > 0) )
            {
               // Use the account and password.
               accountSet = true;
               ( *svcInst)->Account = ServiceAccount::User;
               ( *svcInst)->Username = svcDialog->Username;
               ( *svcInst)->Password = svcDialog->Password;
            }
         }
         else
         if ( svcDialog->Result == ServiceInstallerDialogResult::UseSystem
 )
         {
            ( *svcInst)->Account = ServiceAccount::LocalSystem;
            ( *svcInst)->Username = nullptr;
            ( *svcInst)->Password = nullptr;
            accountSet = true;
         }

         if (  !accountSet )
         {
            // Display a message box.  Tell the user to
            // enter a valid user and password, or cancel
            // out to leave the service account alone.
            DialogResult result;
            result = MessageBox::Show( "Invalid user name or password for
 service installation."
                  "  Press Cancel to leave the service account unchanged.",
 "Change Service Account", 
                  MessageBoxButtons::OKCancel, MessageBoxIcon::Hand );
            if ( result == DialogResult::Cancel )
            {
               // Break out of loop.
               break;
            }
         }
      }
      while (  !accountSet );

      return accountSet;
   }
// Prompt the user for service installation account values.
public static boolean GetServiceAccount(ServiceProcessInstaller
 svcInst)
{
    boolean accountSet = false;
    ServiceInstallerDialog svcDialog = new ServiceInstallerDialog();
    // Query the user for the service account type.
    do {
        svcDialog.set_TopMost(true);
        svcDialog.ShowDialog();

        if (svcDialog.get_Result().Equals(ServiceInstallerDialogResult.OK))
        {
            // Do a very simple validation on the user
            // input.  Check to see whether the user name
            // or password is blank.
            if (svcDialog.get_Username().get_Length() > 0 
                && svcDialog.get_Password().get_Length() > 0) {
                // Use the account and password.
                accountSet = true;

                svcInst.set_Account(ServiceAccount.User);
                svcInst.set_Username(svcDialog.get_Username());
                svcInst.set_Password(svcDialog.get_Password());
            }
        }
        else {
            if (svcDialog.get_Result().Equals(ServiceInstallerDialogResult.
                UseSystem)) {
                svcInst.set_Account(ServiceAccount.LocalSystem);
                svcInst.set_Username(null);
                svcInst.set_Password(null);
                accountSet = true;
            }
        }

        if (!(accountSet)) {
            // Display a message box.  Tell the user to
            // enter a valid user and password, or cancel
            // out to leave the service account alone.
            DialogResult result;
            result = MessageBox.Show("Invalid user name or password for
 "
                + "service installation." 
                + "  Press Cancel to leave the service account unchanged.",
 
                "Change Service Account", 
                MessageBoxButtons.OKCancel, MessageBoxIcon.Hand);

            if (result.Equals(DialogResult.Cancel)) {
                // Break out of loop.
                break;
            }
        }
    } while (!(accountSet));
    return accountSet;
} //GetServiceAccount
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.ServiceProcess.Design 名前空間
ServiceInstallerDialog クラス
ServiceAccount 列挙



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ServiceInstallerDialogResult」の関連用語

ServiceInstallerDialogResultのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ServiceInstallerDialogResultのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS