• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ServiceStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Start

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

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

            Monitor.Exit(this.lockObject);

            while (true)
            {
                Thread.Sleep(SendIntervalInMilliseconds);

                Monitor.Enter(this.lockObject);
                if (this.serviceStatus == ServiceStatus.Stopped)
                {
                    Monitor.Exit(this.lockObject);
                    break;
                }

                if (this.serviceStatus == ServiceStatus.Paused)
                {
                    Monitor.Exit(this.lockObject);
                    continue;
                }

                Monitor.Exit(this.lockObject);

                // retrieve data
                var systemInfo = this.systemInformationProvider.GetSystemInfo();
                if (systemInfo == null)
                {
                    // skip this run
                    continue;
                }

                // add message to queue
                this.workQueue.Enqueue(new SystemInformationQueueItem(systemInfo));
            }

            Monitor.Enter(this.lockObject);

            this.serviceStatus = ServiceStatus.Stopped;

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


示例17: OnStart

        protected override void OnStart(string[] args)
        {
            eventLog1.WriteEntry("In OnStart");
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 60000; // 60 seconds
            timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
            timer.Start();

            // 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);

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


示例18: VideosUpdated

        public static void VideosUpdated()
        {
            if (CurrentStatus == null) CurrentStatus = new ServiceStatus();

            CurrentStatus.VideosLastUpdated = DateTime.Now;
        }
开发者ID:joelmartinez,项目名称:Khan-Academy-for-Windows-Phone,代码行数:6,代码来源:KhanAcademy.svc.cs


示例19: CategoriesUpdated

        public static void CategoriesUpdated()
        {
            if (CurrentStatus == null) CurrentStatus = new ServiceStatus();

            CurrentStatus.CategoriesLastUpdated = DateTime.Now;
        }
开发者ID:joelmartinez,项目名称:Khan-Academy-for-Windows-Phone,代码行数:6,代码来源:KhanAcademy.svc.cs


示例20: RootServerInfo

 internal RootServerInfo(IServiceAddress address, ServiceStatus status)
 {
     this.address = address;
     this.status = status;
 }
开发者ID:ikvm,项目名称:cloudb,代码行数:5,代码来源:ManagerService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServiceType类代码示例发布时间:2022-05-24
下一篇:
C# ServiceStackHost类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap