亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? servicecontrolform.cs

?? Professional C# 2nd Edition
?? CS
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.ServiceProcess;

namespace Wrox.ProCSharp.WinServices
{
    /// <summary>
    ///    Summary description for Form1.
    /// </summary>
    public class ServiceControlForm : System.Windows.Forms.Form
    {
        /// <summary>
        ///    Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components;
        private System.Windows.Forms.Button buttonRefresh;
        private System.Windows.Forms.Button buttonExit;
        private System.Windows.Forms.Button buttonContinue;
        private System.Windows.Forms.Button buttonPause;
        private System.Windows.Forms.Button buttonStop;
        private System.Windows.Forms.Button buttonStart;
        private System.Windows.Forms.TextBox textBoxServiceName;
        private System.Windows.Forms.TextBox textBoxServiceType;
        private System.Windows.Forms.TextBox textBoxServiceStatus;
        private System.Windows.Forms.TextBox textBoxDisplayName;
        private System.Windows.Forms.ListBox listBoxServices;
        private System.ServiceProcess.ServiceController[] services;

        public ServiceControlForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            RefreshServiceList();
        }

        protected void RefreshServiceList()
        {
           services = ServiceController.GetServices();

           listBoxServices.DisplayMember = "DisplayName";
           listBoxServices.DataSource = services;      
        }

        /// <summary>
        ///    Clean up any resources being used.
        /// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
			this.buttonContinue = new System.Windows.Forms.Button();
			this.buttonStart = new System.Windows.Forms.Button();
			this.buttonExit = new System.Windows.Forms.Button();
			this.listBoxServices = new System.Windows.Forms.ListBox();
			this.textBoxServiceType = new System.Windows.Forms.TextBox();
			this.textBoxServiceName = new System.Windows.Forms.TextBox();
			this.textBoxDisplayName = new System.Windows.Forms.TextBox();
			this.buttonRefresh = new System.Windows.Forms.Button();
			this.textBoxServiceStatus = new System.Windows.Forms.TextBox();
			this.buttonPause = new System.Windows.Forms.Button();
			this.buttonStop = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// buttonContinue
			// 
			this.buttonContinue.Enabled = false;
			this.buttonContinue.Location = new System.Drawing.Point(408, 160);
			this.buttonContinue.Name = "buttonContinue";
			this.buttonContinue.Size = new System.Drawing.Size(96, 24);
			this.buttonContinue.TabIndex = 8;
			this.buttonContinue.Text = "Continue";
			this.buttonContinue.Click += new System.EventHandler(this.buttonCommand_Click);
			// 
			// buttonStart
			// 
			this.buttonStart.Enabled = false;
			this.buttonStart.Location = new System.Drawing.Point(296, 120);
			this.buttonStart.Name = "buttonStart";
			this.buttonStart.Size = new System.Drawing.Size(96, 24);
			this.buttonStart.TabIndex = 5;
			this.buttonStart.Text = "Start";
			this.buttonStart.Click += new System.EventHandler(this.buttonCommand_Click);
			// 
			// buttonExit
			// 
			this.buttonExit.Location = new System.Drawing.Point(408, 224);
			this.buttonExit.Name = "buttonExit";
			this.buttonExit.Size = new System.Drawing.Size(96, 24);
			this.buttonExit.TabIndex = 10;
			this.buttonExit.Text = "Exit";
			this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click);
			// 
			// listBoxServices
			// 
			this.listBoxServices.Location = new System.Drawing.Point(16, 16);
			this.listBoxServices.Name = "listBoxServices";
			this.listBoxServices.Size = new System.Drawing.Size(256, 238);
			this.listBoxServices.TabIndex = 0;
			this.listBoxServices.SelectedIndexChanged += new System.EventHandler(this.OnSelectedIndexChanged);
			// 
			// textBoxServiceType
			// 
			this.textBoxServiceType.Location = new System.Drawing.Point(296, 64);
			this.textBoxServiceType.Name = "textBoxServiceType";
			this.textBoxServiceType.Size = new System.Drawing.Size(208, 20);
			this.textBoxServiceType.TabIndex = 3;
			this.textBoxServiceType.Text = "";
			// 
			// textBoxServiceName
			// 
			this.textBoxServiceName.Location = new System.Drawing.Point(296, 88);
			this.textBoxServiceName.Name = "textBoxServiceName";
			this.textBoxServiceName.Size = new System.Drawing.Size(208, 20);
			this.textBoxServiceName.TabIndex = 4;
			this.textBoxServiceName.Text = "";
			// 
			// textBoxDisplayName
			// 
			this.textBoxDisplayName.Location = new System.Drawing.Point(296, 16);
			this.textBoxDisplayName.Name = "textBoxDisplayName";
			this.textBoxDisplayName.Size = new System.Drawing.Size(208, 20);
			this.textBoxDisplayName.TabIndex = 1;
			this.textBoxDisplayName.Text = "";
			// 
			// buttonRefresh
			// 
			this.buttonRefresh.Location = new System.Drawing.Point(296, 224);
			this.buttonRefresh.Name = "buttonRefresh";
			this.buttonRefresh.Size = new System.Drawing.Size(96, 24);
			this.buttonRefresh.TabIndex = 9;
			this.buttonRefresh.Text = "Refresh";
			this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
			// 
			// textBoxServiceStatus
			// 
			this.textBoxServiceStatus.Location = new System.Drawing.Point(296, 40);
			this.textBoxServiceStatus.Name = "textBoxServiceStatus";
			this.textBoxServiceStatus.Size = new System.Drawing.Size(208, 20);
			this.textBoxServiceStatus.TabIndex = 2;
			this.textBoxServiceStatus.Text = "";
			// 
			// buttonPause
			// 
			this.buttonPause.Enabled = false;
			this.buttonPause.Location = new System.Drawing.Point(296, 160);
			this.buttonPause.Name = "buttonPause";
			this.buttonPause.Size = new System.Drawing.Size(96, 24);
			this.buttonPause.TabIndex = 7;
			this.buttonPause.Text = "Pause";
			this.buttonPause.Click += new System.EventHandler(this.buttonCommand_Click);
			// 
			// buttonStop
			// 
			this.buttonStop.Enabled = false;
			this.buttonStop.Location = new System.Drawing.Point(408, 120);
			this.buttonStop.Name = "buttonStop";
			this.buttonStop.Size = new System.Drawing.Size(96, 24);
			this.buttonStop.TabIndex = 6;
			this.buttonStop.Text = "Stop";
			this.buttonStop.Click += new System.EventHandler(this.buttonCommand_Click);
			// 
			// ServiceControlForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(512, 273);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.buttonRefresh,
																		  this.buttonExit,
																		  this.buttonContinue,
																		  this.buttonPause,
																		  this.buttonStop,
																		  this.buttonStart,
																		  this.textBoxServiceName,
																		  this.textBoxServiceType,
																		  this.textBoxServiceStatus,
																		  this.textBoxDisplayName,
																		  this.listBoxServices});
			this.Name = "ServiceControlForm";
			this.Text = "Wrox Service Control";
			this.ResumeLayout(false);

		}
       #endregion

        protected void buttonCommand_Click (object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            ServiceController controller = (ServiceController)listBoxServices.SelectedItem;

            if (sender == this.buttonStart)
            {
                controller.Start();
                controller.WaitForStatus(ServiceControllerStatus.Running);
            }
            else if (sender == this.buttonStop)
            {
                controller.Stop();
                controller.WaitForStatus(ServiceControllerStatus.Stopped);
            }
            else if (sender == this.buttonPause)
            {
                controller.Pause();
                controller.WaitForStatus(ServiceControllerStatus.Paused);
            }
            else if (sender == this.buttonContinue)
            {
                controller.Continue();
                controller.WaitForStatus(ServiceControllerStatus.Running);
            }

            int index =listBoxServices.SelectedIndex;
            RefreshServiceList();
            listBoxServices.SelectedIndex = index;
            Cursor.Current = Cursors.Default;
        }

        protected void buttonExit_Click (object sender, System.EventArgs e)
        {
            Application.Exit();
        }

        protected void buttonRefresh_Click (object sender, System.EventArgs e)
        {
            RefreshServiceList();
        }

        protected string GetServiceTypeName(ServiceType type)
        {
            string serviceType = "";
            if ((type & ServiceType.InteractiveProcess) != 0)
            {
                serviceType = "Interactive ";
                type -= ServiceType.InteractiveProcess;
            }
            switch (type)
            {
                case ServiceType.Adapter:
                    serviceType += "Adapter";
                    break;
                case ServiceType.FileSystemDriver:
                case ServiceType.KernelDriver:
                case ServiceType.RecognizerDriver:
                    serviceType += "Driver";
                    break;
                case ServiceType.Win32OwnProcess:
                    serviceType += "Win32 Service Process";
                    break;
                case ServiceType.Win32ShareProcess:
                    serviceType += "Win32 Shared Process";
                    break;
                default:
                    serviceType += "unknown type " + type.ToString();
                    break;
            }
            return serviceType;
        }

        protected void SetServiceStatus(ServiceController controller)
        {
            buttonStart.Enabled = true;
            buttonStop.Enabled = true;
            buttonPause.Enabled = true;
            buttonContinue.Enabled = true;

            if (!controller.CanPauseAndContinue)
            {
                buttonPause.Enabled = false;
                buttonContinue.Enabled = false;
            }
            if (!controller.CanStop)
            {
                buttonStop.Enabled = false;
            }

            ServiceControllerStatus status = controller.Status;
            switch (status)
            {
                case ServiceControllerStatus.ContinuePending:
                    textBoxServiceStatus.Text = "Continue Pending";
                    buttonContinue.Enabled = false;
                    break;
                case ServiceControllerStatus.Paused:
                    textBoxServiceStatus.Text = "Paused";
                    buttonPause.Enabled = false;
                    buttonStart.Enabled = false;
                    break;
                case ServiceControllerStatus.PausePending:
                    textBoxServiceStatus.Text = "Pause Pending";
                    buttonPause.Enabled = false;
                    buttonStart.Enabled = false;
                    break;
                case ServiceControllerStatus.StartPending:
                    textBoxServiceStatus.Text = "Start Pending";
                    buttonStart.Enabled = false;                    
                    break;
                case ServiceControllerStatus.Running:
                    textBoxServiceStatus.Text = "Running";
                    buttonStart.Enabled = false;
                    buttonContinue.Enabled = false;
                    break;
                case ServiceControllerStatus.Stopped:
                    textBoxServiceStatus.Text = "Stopped";
                    buttonStop.Enabled = false;
                    break;
                case ServiceControllerStatus.StopPending:
                    textBoxServiceStatus.Text = "Stop Pending";
                    buttonStop.Enabled = false;
                    break;
                default:
                    textBoxServiceStatus.Text = "Unknown status";
                    break;
            }            
        }

        protected void OnSelectedIndexChanged (object sender, System.EventArgs e)
        {
            ServiceController controller = (ServiceController)listBoxServices.SelectedItem;
            textBoxDisplayName.Text = controller.DisplayName;
            textBoxServiceType.Text = GetServiceTypeName(controller.ServiceType);
            textBoxServiceName.Text = controller.ServiceName;

            SetServiceStatus(controller);
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args) 
        {
            Application.Run(new ServiceControlForm());
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合九色欧美综合狠狠 | 国产亚洲欧美一级| 成人精品视频一区| 日本不卡在线视频| 一区二区三区在线免费观看| 久久只精品国产| 欧美精品777| 色婷婷久久久久swag精品| 毛片一区二区三区| 亚洲国产精品自拍| 亚洲图片你懂的| 国产日韩欧美综合在线| 制服视频三区第一页精品| 91在线免费看| 国产精品中文欧美| 久久精品国产亚洲aⅴ| 亚洲一区二区视频在线观看| 国产精品久久福利| 2021中文字幕一区亚洲| 欧美一级二级三级乱码| 91福利视频网站| 精品福利一二区| 丰满少妇久久久久久久| 久久99精品视频| 日韩中文字幕91| 亚洲一区二区三区在线播放| 国产精品成人一区二区三区夜夜夜| 久久美女艺术照精彩视频福利播放 | 中文字幕一区二区视频| 欧美tk—视频vk| 日韩视频免费观看高清完整版 | 91麻豆精品91久久久久久清纯| 色哟哟一区二区在线观看| 豆国产96在线|亚洲| 国产精品99久| 国产91对白在线观看九色| 国内外精品视频| 韩国精品主播一区二区在线观看| 久久精品国产一区二区三区免费看| 香蕉av福利精品导航| 亚洲va中文字幕| 日韩高清在线观看| 美女在线一区二区| 激情综合五月天| 国产高清精品网站| 成人av集中营| 色婷婷av久久久久久久| 欧美三级韩国三级日本一级| 777亚洲妇女| 韩国午夜理伦三级不卡影院| 国产精品盗摄一区二区三区| 国产精品色哟哟网站| 国产精品久久久久久久久快鸭| 国产精品美女久久久久久久网站| 国产精品麻豆欧美日韩ww| 日韩一区中文字幕| 一区二区三区成人| 亚洲午夜激情网站| 免费高清在线视频一区·| 激情偷乱视频一区二区三区| 国产精品1024| 色天使久久综合网天天| 欧美挠脚心视频网站| 26uuu成人网一区二区三区| 中文字幕免费不卡| 亚洲综合色噜噜狠狠| 免费看黄色91| 成人avav影音| 欧美高清一级片在线| 久久精品综合网| 亚洲卡通动漫在线| 男女男精品网站| 成人免费看视频| 欧美日韩精品欧美日韩精品| 久久一二三国产| 亚洲精品国产一区二区三区四区在线| 亚洲v日本v欧美v久久精品| 国产毛片精品国产一区二区三区| 99v久久综合狠狠综合久久| 欧美一区在线视频| 国产精品丝袜91| 日韩avvvv在线播放| 成人一区二区三区在线观看| 欧美人伦禁忌dvd放荡欲情| 国产欧美一区二区精品性| 一区二区成人在线| 国产麻豆视频精品| 欧美日韩免费观看一区二区三区 | 一本到三区不卡视频| 日韩视频永久免费| 中文字幕日韩一区二区| 三级欧美在线一区| 99久久99久久综合| 亚洲精品一区二区三区精华液 | 欧美久久久久久蜜桃| 国产婷婷精品av在线| 午夜电影久久久| www.色精品| 欧美tickling网站挠脚心| 亚洲在线中文字幕| 成人av集中营| 欧美成人性战久久| 亚洲风情在线资源站| 国产成人免费视频一区| 欧美三区在线观看| 中文字幕在线一区免费| 精品一区二区三区在线播放| 91官网在线免费观看| 国产亚洲人成网站| 久久国产精品色| 欧美日韩精品一区二区三区蜜桃 | 精品久久一区二区三区| 亚洲一区二区三区激情| 97se亚洲国产综合在线| 久久精品无码一区二区三区| 久久精品99国产精品| 9191成人精品久久| 亚洲九九爱视频| 成人av免费在线播放| 久久精品网站免费观看| 国内精品自线一区二区三区视频| 欧美一卡在线观看| 视频一区在线视频| 欧美午夜一区二区三区免费大片| 中文字幕一区三区| 不卡免费追剧大全电视剧网站| 国产日韩三级在线| 国产成人高清在线| 久久久国际精品| 国产成人精品午夜视频免费| 国产日韩影视精品| 国产成人av资源| 国产精品区一区二区三区| 大桥未久av一区二区三区中文| 久久久久国产精品人| 福利一区二区在线观看| 国产欧美精品一区二区色综合 | 亚洲一区精品在线| 在线一区二区观看| 午夜影视日本亚洲欧洲精品| 欧美日韩一区二区在线观看视频| 亚洲最大成人综合| 欧美日韩国产综合视频在线观看| 天天色综合天天| 欧美大片顶级少妇| 国产精品自产自拍| 国产精品毛片久久久久久久| 94-欧美-setu| 亚洲一区在线看| 欧美一区二区三区视频免费播放| 麻豆传媒一区二区三区| 国产日韩欧美精品一区| youjizz久久| 亚洲国产精品久久久久婷婷884| 91麻豆精品国产综合久久久久久 | 国产一区欧美日韩| 日本一区二区三区高清不卡| 色综合中文字幕| 舔着乳尖日韩一区| 日韩欧美不卡在线观看视频| 福利一区二区在线| 亚洲免费观看高清在线观看| 欧美精品亚洲一区二区在线播放| 国产永久精品大片wwwapp| 中文字幕中文字幕一区二区| 欧美另类变人与禽xxxxx| 狠狠色狠狠色合久久伊人| 国产精品少妇自拍| 欧美日韩视频在线第一区 | 中文乱码免费一区二区| 一本大道久久精品懂色aⅴ| 日本一不卡视频| 国产欧美精品一区二区色综合朱莉| 色婷婷综合久久久久中文| 免费成人av在线| 国产精品不卡在线观看| 91精品国产综合久久国产大片| 国产精品影视在线| 亚洲女人小视频在线观看| 91精品在线观看入口| 国产成人99久久亚洲综合精品| 一区二区三区四区五区视频在线观看| 欧美一级搡bbbb搡bbbb| www.久久久久久久久| 免费的成人av| 亚洲免费观看高清完整 | 亚洲第一久久影院| 久久先锋影音av| 欧美日韩亚洲不卡| 成人一区二区在线观看| 免费成人在线视频观看| 亚洲欧美日韩久久| 久久精品人人做人人爽97| 欧美丰满美乳xxx高潮www| 成人性生交大合| 蜜桃视频在线一区| 一区二区三区不卡视频| 国产欧美日韩精品一区| 日韩欧美国产系列| 欧美日韩一本到|