System.ServiceProcess.ServiceController.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
        }

Same methods

ServiceController::Dispose ( bool disposing ) : void

Usage Example

示例#1
0
        /// <summary>
        /// Executes the task.
        /// </summary>
        /// <returns><see langword="true"/> if the task ran successfully;
        /// otherwise <see langword="false"/>.</returns>
        public override bool Execute()
        {
            Service controller = null;

            try
            {
                controller = GetServiceController();
                if (controller != null)
                {
                    Log.LogMessage(Properties.Resources.ServiceStatus,
                                   _displayName, _machineName, _status);
                }
                else
                {
                    Log.LogMessage(Properties.Resources.ServiceNotFound,
                                   _serviceName, _machineName);
                }
            }
            catch (Exception ex)
            {
                Log.LogErrorFromException(ex);
                return(false);
            }
            finally
            {
                if (controller != null)
                {
                    controller.Dispose();
                }
            }

            return(true);
        }
All Usage Examples Of System.ServiceProcess.ServiceController::Dispose