private void btnStop_Click(object sender, EventArgs e) { // stop service try { this.Enabled = false; Cursor.Current = Cursors.WaitCursor; ServiceUtilities.StopService("EDScreenshotService"); } finally { updateServiceStatus(); Cursor.Current = Cursors.Default; this.Enabled = true; } }
private void btnInstall_Click(object sender, EventArgs e) { // install service try { this.Enabled = false; Cursor.Current = Cursors.WaitCursor; var pathToService = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "EDScreenshotService.exe"); var removeBMPOption = "always"; if (rbHighResOnly.Checked) { removeBMPOption = "4konly"; } if (rbNever.Checked) { removeBMPOption = "never"; } var preferredFormat = "jpg"; if (rbPNG.Checked) { preferredFormat = "png"; } ServiceUtilities.InstallAndStart("EDScreenshotService", "Elite:Dangerous screenshot service", string.Concat(pathToService, // service EXE " \"", txtScreenshotFolder.Text, "\" ", // screenshot folder to watch for BMPs removeBMPOption, " ", // always / 4k only / never preferredFormat, " ", // JPG / PNG tbQuality.Value)); // JPG quality } finally { updateServiceStatus(); Cursor.Current = Cursors.Default; this.Enabled = true; } }
private ServiceController getService() { return(ServiceUtilities.GetService(serviceController1, "EDScreenshotService")); }