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

C# ServiceController类代码示例

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

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



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

示例1: TestMergeMessageWithParametersCallsMerge

        public void TestMergeMessageWithParametersCallsMerge()
        {
            var merged = false;

            var service = new ServiceController() {
                Settings = {
                    ServiceUpdateCore = false
                },
                Packages = new MockServicePackageManager() {
                    PackageInstalled = (sender, uri, packageId) => { merged = true; }
                }
            };

            service.SignalMessage(new ServiceMessage() {
                Name = "merge",
                Arguments = new Dictionary<string, string>() {
                    { "uri", "localhost" },
                    { "packageid", "id" }
                }
            });

            Assert.IsTrue(merged);

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:25,代码来源:TestSignalMessageCallback.cs


示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Headers["User-Agent"] != null && (Request.Browser["IsMobileDevice"] == "true" || Request.UserAgent.ToUpper().Contains("MIDP") || Request.UserAgent.ToUpper().Contains("CLDC") || Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("avant") || Request.UserAgent.ToLower().Contains("nokia") || Request.UserAgent.ToLower().Contains("pda") || Request.UserAgent.ToLower().Contains("moto") || Request.UserAgent.ToLower().Contains("windows ce") || Request.UserAgent.ToLower().Contains("hand") || Request.UserAgent.ToLower().Contains("mobi") || Request.UserAgent.ToUpper().Contains("HTC") || Request.UserAgent.ToLower().Contains("sony") || Request.UserAgent.ToLower().Contains("panasonic") || Request.UserAgent.ToLower().Contains("blackberry") || Request.UserAgent.ToLower().Contains("240x320") || Request.UserAgent.ToLower().Contains("voda")))
        {
            Response.Redirect("mobile/index.aspx");
        }
        OSAEObjectCollection screens = OSAEObjectManager.GetObjectsByType("SCREEN");

        this.SetSessionTimeout();       

        foreach (OSAEObject s in screens)
        {
            HtmlGenericControl li = new HtmlGenericControl("li");
            ddlScreens.Controls.Add(li);

            HtmlGenericControl anchor = new HtmlGenericControl("a");
            anchor.Attributes.Add("href", "screens.aspx?id="+s.Name);
            anchor.InnerText = s.Name;

            li.Controls.Add(anchor);
        }

        ServiceController sc = new ServiceController("OSAE");

        if (sc.Status != ServiceControllerStatus.Running)
        {
            cog.ImageUrl = "~/Images/cog_red.png";
            cog.ToolTip = "OSA service is not running.";
        }
    }
开发者ID:just8,项目名称:Open-Source-Automation,代码行数:30,代码来源:MasterPage.master.cs


示例3: CheckServiceStatus

 private void CheckServiceStatus()
 {
     try
     {
         ServiceController sc = new ServiceController("OSAE");
         switch (sc.Status)
         {
             case ServiceControllerStatus.Running:
                 serviceLabel.Text = "Running";
                 break;
             case ServiceControllerStatus.Stopped:
                 serviceLabel.Text = "Stopped";
                 break;
             case ServiceControllerStatus.Paused:
                 serviceLabel.Text = "Paused";
                 break;
             case ServiceControllerStatus.StopPending:
                 serviceLabel.Text = "Stopping";
                 break;
             case ServiceControllerStatus.StartPending:
                 serviceLabel.Text = "Starting";
                 break;
             default:
                 serviceLabel.Text = "Status Changing";
                 break;
         }
     }
     catch (Exception exc)
     {
         serviceLabel.Text = "Could not find service";
     }
 }
开发者ID:just8,项目名称:Open-Source-Automation,代码行数:32,代码来源:config.aspx.cs


示例4: ConstructWithServiceName

 public void ConstructWithServiceName()
 {
     var controller = new ServiceController(_testService.TestServiceName);
     Assert.Equal(_testService.TestServiceName, controller.ServiceName);
     Assert.Equal(_testService.TestServiceDisplayName, controller.DisplayName);
     Assert.Equal(_testService.TestMachineName, controller.MachineName);
     Assert.Equal(ServiceType.Win32OwnProcess, controller.ServiceType);
 }
开发者ID:nnyamhon,项目名称:corefx,代码行数:8,代码来源:ServiceControllerTests.cs


示例5: OnAfterInstall

 protected override void OnAfterInstall(System.Collections.IDictionary savedState)
 {
     ServiceConfigurator.SetRecoveryOptions(ServiceName());
     using (ServiceController pc = new ServiceController(ServiceName()))
     {
         pc.Start();
     }
 }
开发者ID:jvshahid,项目名称:diego-windows-release,代码行数:8,代码来源:CommonService.cs


示例6: NWMasterServer

        /// <summary>
        /// Instantiate a new master server instance.
        /// </summary>
        /// <param name="ServiceObject">Optionally supplies the associated
        /// service instance, else null if the program is not running in
        /// service mode.</param>
        public NWMasterServer(ServiceController ServiceObject)
        {
            this.ServiceObject = ServiceObject;
            QueryCombineTimer = new System.Timers.Timer(QUERY_COMBINE_INTERVAL);

            QueryCombineTimer.AutoReset = false;
            QueryCombineTimer.Elapsed += new ElapsedEventHandler(QueryCombineTimer_Elapsed);
        }
开发者ID:jakkn,项目名称:nwn2dev-public,代码行数:14,代码来源:NWMasterServer.cs


示例7: TestServiceProxyType

        public void TestServiceProxyType()
        {
            var service = new ServiceController();

            Assert.AreEqual(typeof(ServiceLoaderProxy), service.ServiceLoaderProxyType);

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:8,代码来源:TestConstructor.cs


示例8: ServiceManager

        /// <summary>
        /// Inject alternative container and strategy for resolving Service Types
        /// </summary>
        public ServiceManager(Container container, ServiceController serviceController)
        {
            if (serviceController == null)
                throw new ArgumentNullException("serviceController");

            this.Container = container ?? new Container();
            this.ServiceController = serviceController;
        }
开发者ID:bman654,项目名称:ServiceStack,代码行数:11,代码来源:ServiceManager.cs


示例9: TestInitalServiceStateIsStopped

        public void TestInitalServiceStateIsStopped()
        {
            var service = new ServiceController();

            Assert.AreEqual(ServiceStatusType.Stopped, service.Observer.Status);

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:8,代码来源:TestConstructor.cs


示例10: TestMonitoringIsEnabled

        public void TestMonitoringIsEnabled()
        {
            var service = new ServiceController();

            Assert.IsTrue(AppDomain.MonitoringIsEnabled);

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:8,代码来源:TestConstructor.cs


示例11: Can_execute_BasicService

        public void Can_execute_BasicService()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new BasicService());
            var result = serviceController.Execute(new BasicRequest()) as BasicRequestResponse;

            Assert.That(result, Is.Not.Null);
        }
开发者ID:Braunson,项目名称:ServiceStack,代码行数:9,代码来源:ServiceHostTests.cs


示例12: With_ServiceStackFunq

        public void With_ServiceStackFunq()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new BasicService());
            var request = new BasicRequest();

            Console.WriteLine("With_TypedArguments(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:9,代码来源:PerfTests.cs


示例13: NewConnection

        public NewConnection()
        {
            InitializeComponent();

            communicator = ServiceController.Communicator;

            serverVariables = new ServerVariables();
            DataContext = serverVariables;
            OnDialogContentRequest += NewConnection_OnDialogContentRequest;
        }
开发者ID:ieuan0928,项目名称:vumva,代码行数:10,代码来源:NewConnection.xaml.cs


示例14: TestJunkMessageReturnsFalse

        public void TestJunkMessageReturnsFalse()
        {
            var service = new ServiceController();

            Assert.IsFalse(service.SignalMessage(new ServiceMessage() {
                Name = "junk"
            }));

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:10,代码来源:TestSignalMessage.cs


示例15: With_Expressions

        public void With_Expressions()
        {
            var requestType = typeof(BasicRequest);
            var serviceController = new ServiceController();

            serviceController.Register(requestType, typeof(BasicService));
            var request = new BasicRequest();

            Console.WriteLine("With_Expressions(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:10,代码来源:PerfTests.cs


示例16: Can_execute_RestTestService

        public void Can_execute_RestTestService()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new RestTestService());
            var result = serviceController.Execute(new RestTest()) as RestTestResponse;

            Assert.That(result, Is.Not.Null);
            Assert.That(result.MethodName, Is.EqualTo("Execute"));
        }
开发者ID:Braunson,项目名称:ServiceStack,代码行数:10,代码来源:ServiceHostTests.cs


示例17: TestNopMessageReturnsTrue

        public void TestNopMessageReturnsTrue()
        {
            var service = new ServiceController();

            Assert.IsTrue(service.SignalMessage(new ServiceMessage() {
                Name = "nop"
            }));

            service.Dispose();
        }
开发者ID:EBassie,项目名称:Potato,代码行数:10,代码来源:TestSignalMessage.cs


示例18: NativeFunq_Perf

        public void NativeFunq_Perf()
        {
            var serviceController = new ServiceController();

            RegisterServices(serviceController, GetNativeFunqTypeFactory());

            StoreAndGetCustomers(serviceController);

            var request = new GetCustomer { CustomerId = 2 };
            Console.WriteLine("NativeFunq_Perf(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:11,代码来源:CustomerUseCase.cs


示例19: Service

        protected Service(ServiceType type, string id, ServiceController controller)
        {
            if (type == null) throw new ArgumentNullException ("type");
            if (id == null) throw new ArgumentNullException ("id");
            if (id.Length == 0) throw new ArgumentException ("The id cannot be an empty string.", "id");
            if (controller == null) throw new ArgumentNullException ("controller");

            this.type = type;
            this.id = id;
            this.controller = controller;
        }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:11,代码来源:Service.cs


示例20: StopService

    public static void StopService(string server, string service)
    {
        Console.WriteLine("About to stop the {0} Service", service);
            ServiceController svcCtrl;

            if (server.Length != 0)
                svcCtrl = new ServiceController(server, service);
            else
                svcCtrl = new ServiceController(service);

            svcCtrl.Stop();
    }
开发者ID:dbremner,项目名称:hycs,代码行数:12,代码来源:remoteService.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ServiceControllerStatus类代码示例发布时间:2022-05-24
下一篇:
C# ServiceContext类代码示例发布时间: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