Environment.UserInteractive Właściwość

Definicja

Pobiera wartość wskazującą, czy bieżący proces jest uruchomiony w trybie interaktywnym użytkownika.

public:
 static property bool UserInteractive { bool get(); };
public static bool UserInteractive { get; }
static member UserInteractive : bool
Public Shared ReadOnly Property UserInteractive As Boolean

Wartość właściwości

true jeśli bieżący proces jest uruchomiony w trybie interaktywnym użytkownika; w przeciwnym razie , false.

Przykłady

W poniższym przykładzie pokazano, czy bieżący proces jest uruchomiony w trybie interaktywnym użytkownika.

// Sample for the Environment::UserInteractive property
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive );
}

/*
This example produces the following results:

UserInteractive: True
*/
// Sample for the Environment.UserInteractive property
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine();
    Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive);
    }
}
/*
This example produces the following results:

UserInteractive: True
*/
// Sample for the Environment.UserInteractive property
open System

printfn $"\nUserInteractive: {Environment.UserInteractive}"

// This example produces the following results:
//     UserInteractive: True
' Sample for the Environment.UserInteractive property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive)
   End Sub
End Class
'
'This example produces the following results:
'
'UserInteractive: True
'

Uwagi

Właściwość UserInteractive raportuje false proces systemu Windows lub usługę, na przykład usługi IIS, która działa bez interfejsu użytkownika. Jeśli ta właściwość to false, nie wyświetlaj modalnych okien dialogowych ani okien komunikatów, ponieważ nie ma graficznego interfejsu użytkownika do interakcji z użytkownikiem.

Dotyczy

Zobacz też