当前位置: 首页>>代码示例>>C#>>正文


C# ServiceStatus类代码示例

本文整理汇总了C#中ServiceStatus的典型用法代码示例。如果您正苦于以下问题:C# ServiceStatus类的具体用法?C# ServiceStatus怎么用?C# ServiceStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceStatus类属于命名空间,在下文中一共展示了ServiceStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServiceStatusEventArgs

 internal ServiceStatusEventArgs(IServiceAddress serviceAddress, ServiceType serviceType, ServiceStatus oldStatus, ServiceStatus newStatus)
 {
     this.serviceAddress = serviceAddress;
     this.serviceType = serviceType;
     this.oldStatus = oldStatus;
     this.newStatus = newStatus;
 }
开发者ID:erpframework,项目名称:cloudb,代码行数:7,代码来源:ServiceStatusEventArgs.cs

示例2: GetServiceStatus

 private void GetServiceStatus()
 {
     if (service != null)
         service.Refresh();
     var ss = ServiceControl.GetServiceStatus(service);
     if (ss != serviceStatus)
     {
         serviceStatus = ss;
         DDnsSharpTray.SetStatus(serviceStatus);
         string serviceStr;
         switch (serviceStatus)
         {
             case ServiceStatus.Running:
                 serviceStr = "服务正在运行.";
                 break;
             case ServiceStatus.Stopped:
                 serviceStr = "服务已停止.";
                 break;
             case ServiceStatus.NotExist:
                 serviceStr = "服务尚未安装.";
                 break;
             default:
                 serviceStr = "服务状态未知.";
                 break;
         }
         DDnsSharpTray.Current.Text = "DDnsSharp: " + serviceStr + "\r\n双击打开或隐藏界面.";
     }
 }
开发者ID:moacs,项目名称:DDnsSharp,代码行数:28,代码来源:KeepAliveWindow.xaml.cs

示例3: SetStatus

 public static void SetStatus(ServiceStatus ss)
 {
     if (instance != null)
     {
         instance.Icon = iconDict[ss];
     }
 }
开发者ID:moacs,项目名称:DDnsSharp,代码行数:7,代码来源:DDnsSharpTray.cs

示例4: Service

        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="Service"/> class.
        /// </summary>
        protected Service()
        {
            this.status = (this is ServiceControllable) ? ServiceStatus.Stopped : ServiceStatus.Passive;
            this.statusDate = DateTimeOffset.UtcNow;

            this.log = new Logger(this.Name);
        }
开发者ID:eserozvataf,项目名称:tasslehoff,代码行数:11,代码来源:Service.cs

示例5: Start

        public void Start()
        {
            Stop();

            _timer = new Timer(5000);
            _timer.Elapsed += TimerOnElapsed;
            _timer.Start();
            ServiceStatus = ServiceStatus.Started;
        }
开发者ID:Hem,项目名称:SimpleNet,代码行数:9,代码来源:BackgroundTaskService.cs

示例6: Stop

        public void Stop()
        {
            if (_timer != null)
            {
                _timer.Stop();
                _timer.Dispose();
                _timer = null;
            }

            ServiceStatus = ServiceStatus.Stopped;
        }
开发者ID:Hem,项目名称:SimpleNet,代码行数:11,代码来源:BackgroundTaskService.cs

示例7: Resume

        public void Resume()
        {
            Monitor.Enter(this.lockObject);

            if (this.serviceStatus == ServiceStatus.Paused)
            {
                this.serviceStatus = ServiceStatus.Running;
            }

            Monitor.Exit(this.lockObject);
        }
开发者ID:andreaskoch,项目名称:SignalKo-SystemMonitor,代码行数:11,代码来源:SystemInformationMessageQueueFeeder.cs

示例8: StopService

 public void StopService()
 {
     try
     {
         SaveSettings();
     }
     finally
     {
         Status = ServiceStatus.Stopped;
     }
 }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:11,代码来源:SettingsService.cs

示例9: DoStart

        private void DoStart(string[] args)
        {
            if (m_verbose_messages)
                m_eventLog.WriteEntry("Starting...");
            lock(m_lock)
                if (m_runner == null)
                {
                    if (m_verbose_messages)
                        m_eventLog.WriteEntry("Set start time to 30 seconds...");
                    var sv = new ServiceStatus()
                    {
                        dwCurrentState = ServiceState.SERVICE_START_PENDING,
                        dwWaitHint = (int)TimeSpan.FromSeconds(30).TotalMilliseconds
                    };
                    SetServiceStatus(this.ServiceHandle, ref sv);

                    if (m_verbose_messages)
                        m_eventLog.WriteEntry("Starting runner...");

                    m_runner = new Runner(
                        m_cmdargs,
                        () =>
                        {
                            if (m_verbose_messages)
                                m_eventLog.WriteEntry("Started!");

                            var sv2 = new ServiceStatus()
                            {
                                dwCurrentState = ServiceState.SERVICE_RUNNING
                            };
                            SetServiceStatus(this.ServiceHandle, ref sv2);
                        },
                        () =>
                        {
                            if (m_verbose_messages)
                                m_eventLog.WriteEntry("Stopped!");
                            var sv2 = new ServiceStatus()
                            {
                                dwCurrentState = ServiceState.SERVICE_STOPPED
                            };
                            SetServiceStatus(this.ServiceHandle, ref sv2);

                            base.Stop();
                        },
                        (msg, important) =>
                        {
                            if (important || m_verbose_messages)
                                m_eventLog.WriteEntry(msg);
                        }
                    );
                }
        }
开发者ID:AlexFRAN,项目名称:duplicati,代码行数:52,代码来源:ServiceControl.cs

示例10: OnStop

        protected override void OnStop()
        {
            // Update the service state to Start Pending.
            ServiceStatus serviceStatus = new ServiceStatus();
            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            eventLog1.WriteEntry("In onStop.");

            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }
开发者ID:ShipraKoka,项目名称:Coursework-TheTechAcademy,代码行数:14,代码来源:MyNewService.cs

示例11: SetServiceStatus

		public static void SetServiceStatus(string name, ServiceStatus status)
		{
			switch (status)
			{
				case ServiceStatus.Started:
					Start(name, StatusChangeTimeout);
				return;
				case ServiceStatus.Stopped:
					Stop(name, StatusChangeTimeout);
				return;
			}

			Debug.Assert(false, status.ToString());
		}
开发者ID:pragmatrix,项目名称:Dominator,代码行数:14,代码来源:ServiceTools.cs

示例12: Color

 private ConsoleColor Color(ServiceStatus status)
 {
     switch (status)
     {
         case ServiceStatus.Pending :
             return ConsoleColor.DarkYellow;
         case ServiceStatus.Ok:
             return ConsoleColor.Green;
         case ServiceStatus.Fail:
             return ConsoleColor.Red;
         default:
             throw new ArgumentOutOfRangeException(nameof(status), status, null);
     }
 }
开发者ID:michal-franc,项目名称:OverSeer,代码行数:14,代码来源:ConsoleDashBoardActor.cs

示例13: StartService

        public void StartService()
        {
            try
            {
                LoadSettings();

                Status = ServiceStatus.Started;
            }
            catch
            {
                Status = ServiceStatus.Error;
                throw;
            }
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:14,代码来源:SettingsService.cs

示例14: OnStop

        protected override void OnStop()
        {
            var serviceStatus = new ServiceStatus();
            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING;
            serviceStatus.dwWaitHint = 10000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            if (server != null) server.Stop();

            if (dataServer != null) dataServer.Stop();

            // Update the service state to Stopped.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:15,代码来源:Service1.cs

示例15: OnStart

        protected override void OnStart(string[] args)
        {
            var serviceStatus = new ServiceStatus();
            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint = 10000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            if (server != null) server.Start();

            if (dataServer != null) dataServer.Start();

            // Update the service state to Running.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:15,代码来源:Service1.cs


注:本文中的ServiceStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。