Ejemplo n.º 1
0
        public ServiceButtons()
        {
            winServiceInstaller = new WinServiceInstaller();

            _StatusLabel = new Label()
            {
                ForeColor = Color.Red
            };
            _InstallButton = new Button()
            {
                Size = new Size(75, 23)
            };
            _InstallButton.Click += InstallButton_Click;
            _UninstallButton      = new Button()
            {
                Size = new Size(75, 23)
            };
            _UninstallButton.Click += UninstallButton_Click;
            _StartButton            = new Button()
            {
                Size = new Size(75, 23)
            };
            _StartButton.Click += StartButton_Click;
            _StopButton         = new Button()
            {
                Size = new Size(75, 23)
            };
            _StopButton.Click += StopButton_Click;

            checkServiceStatus();
        }
Ejemplo n.º 2
0
        public async Task <int> OnExecuteAsync
        (
            CommandLineApplication app,
            CancellationToken cancellationToken = default
        )
        {
            await Task.Run(() => {
                WinServiceInstaller.Uninstall(WinService.WinServiceName);
            });

            return(0);
        }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            winServiceInstaller = new WinServiceInstaller();
            this.Text           = ProgramUtils.GetProgramTitle();
            this.Icon           = System.Drawing.Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().Location);
            //托盘图标
            niMain.Text = this.Text;
            niMain.Icon = this.Icon;

            ensureOnlyOne();
        }
Ejemplo n.º 4
0
 public void UnInstall()
 {
     WinServiceInstaller.UnInstall(ServiceInfo);
 }
Ejemplo n.º 5
0
 public void Install()
 {
     WinServiceInstaller.Install(ServiceInfo);
 }
 public void TestInstall()
 {
     WinServiceInstaller.Install("Sample Test Service");
 }