Csharp/C Sharp/Development Class/Service — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 18:31, 26 мая 2010
demonstrates service control
<source lang="csharp"> /* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110
- /
/*
Example21_15.cs demonstrates service control
- /
using System; using System.ServiceProcess; public class Example21_15 {
public static void Main() { // connect to the Alerter service ServiceController scAlerter = new ServiceController("Alerter"); Console.WriteLine(scAlerter.DisplayName); Console.WriteLine(scAlerter.CanStop); scAlerter.Stop(); Console.WriteLine("Service stopped"); scAlerter.Start(); Console.WriteLine("Service started"); }
}
</source>