Environment.UserInteractive Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan nilai yang menunjukkan apakah proses saat ini berjalan dalam mode interaktif pengguna.
public:
static property bool UserInteractive { bool get(); };
public static bool UserInteractive { get; }
static member UserInteractive : bool
Public Shared ReadOnly Property UserInteractive As Boolean
Nilai Properti
true jika proses saat ini berjalan dalam mode interaktif pengguna; jika tidak, false.
Contoh
Contoh berikut menampilkan apakah proses saat ini berjalan dalam mode interaktif pengguna.
// 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
'
Keterangan
Properti UserInteractive melaporkan false untuk proses Windows atau layanan seperti IIS yang berjalan tanpa antarmuka pengguna. Jika properti ini adalah false, jangan tampilkan dialog modal atau kotak pesan karena tidak ada antarmuka pengguna grafis untuk berinteraksi dengan pengguna.