service1.cs

来自「Listas ordenadas [ordered list]」· CS 代码 · 共 41 行

CS
41
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;

namespace chatserver
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
            this.ServiceName = "Chat ip";
            this.EventLog.Source = "Chat ip";
            this.EventLog.Log = "Application";

            this.CanStop = false;
            this.CanPauseAndContinue = true;
        }

        protected override void OnStart(string[] args)
        {
            String hostPort = "";
            Form2 chat = new Form2(hostPort);
            chat.Show();
            
        }

        protected override void OnStop()
        {
            
            String hostPort = "";
            Form2 blockedForm = new Form2(hostPort);
            blockedForm.Show();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?