Click here to Skip to main content
15,885,921 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using NLog in many classes Pin
Richard Deeming23-Oct-15 1:40
mveRichard Deeming23-Oct-15 1:40 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:15
Member 1206160023-Oct-15 2:15 
GeneralRe: Using NLog in many classes Pin
Member 1206160023-Oct-15 2:29
Member 1206160023-Oct-15 2:29 
QuestionHow to change Font in Word by C# Pin
naylynn22-Oct-15 3:54
naylynn22-Oct-15 3:54 
AnswerRe: How to change Font in Word by C# Pin
Eddy Vluggen22-Oct-15 8:37
professionalEddy Vluggen22-Oct-15 8:37 
GeneralRe: How to change Font in Word by C# Pin
naylynn25-Oct-15 11:10
naylynn25-Oct-15 11:10 
QuestionCheck Remote Computer Windows Services Pin
Jassim Rahma21-Oct-15 23:07
Jassim Rahma21-Oct-15 23:07 
AnswerRe: Check Remote Computer Windows Services Pin
Richard Deeming22-Oct-15 2:48
mveRichard Deeming22-Oct-15 2:48 
The ServiceController[^] class is what you're looking for. Just pass the service name and server name to this constructor[^], and you should be able to check the status of the service.
C#
var controller = new ServiceController("Service Name", "Server Name");
switch (controller.Status)
{
    case ServiceControllerStatus.Running:
    {
        // The service is running.
        break;
    }
    case ServiceControllerStatus.StartPending:
    case ServiceControllerStatus.ContinuePending:
    {
        // The service is starting or resuming.
        
        // If you want to wait for it to be running:
        controller.WaitForStatus(ServiceControllerStatus.Running);
        // When the method returns, the service is running.
        break;
    }
    case ServiceControllerStatus.StopPending:
    case ServiceControllerStatus.PausePending:
    {
        // The service is stopping or pausing.
        break;
    }
    case ServiceControllerStatus.Stopped:
    case ServiceControllerStatus.Paused:
    {
        // The service is stopped or paused.
        break;
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionKeyDown for Form and all its Controls Pin
Jassim Rahma21-Oct-15 12:28
Jassim Rahma21-Oct-15 12:28 
AnswerRe: KeyDown for Form and all its Controls Pin
BillWoodruff21-Oct-15 15:02
professionalBillWoodruff21-Oct-15 15:02 
AnswerRe: KeyDown for Form and all its Controls Pin
Dave Kreskowiak21-Oct-15 17:15
mveDave Kreskowiak21-Oct-15 17:15 
AnswerRe: KeyDown for Form and all its Controls Pin
John Torjo21-Oct-15 23:18
professionalJohn Torjo21-Oct-15 23:18 
SuggestionRe: KeyDown for Form and all its Controls Pin
Foothill23-Oct-15 10:20
professionalFoothill23-Oct-15 10:20 
Questionc# Pin
Member 1061105521-Oct-15 8:11
Member 1061105521-Oct-15 8:11 
GeneralRe: c# Pin
harold aptroot21-Oct-15 8:42
harold aptroot21-Oct-15 8:42 
AnswerRe: c# Pin
cvogt6145721-Oct-15 8:48
cvogt6145721-Oct-15 8:48 
Questionthread safe log class with simple functionality Pin
Member 1206160021-Oct-15 5:57
Member 1206160021-Oct-15 5:57 
AnswerRe: thread safe log class with simple functionality Pin
BillWoodruff21-Oct-15 7:08
professionalBillWoodruff21-Oct-15 7:08 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 7:36
Member 1206160021-Oct-15 7:36 
GeneralRe: thread safe log class with simple functionality Pin
BillWoodruff21-Oct-15 7:45
professionalBillWoodruff21-Oct-15 7:45 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 7:51
Member 1206160021-Oct-15 7:51 
GeneralRe: thread safe log class with simple functionality Pin
BillWoodruff21-Oct-15 7:58
professionalBillWoodruff21-Oct-15 7:58 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 8:29
Member 1206160021-Oct-15 8:29 
AnswerRe: thread safe log class with simple functionality Pin
Richard Deeming21-Oct-15 8:09
mveRichard Deeming21-Oct-15 8:09 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 8:16
Member 1206160021-Oct-15 8:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.