Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5b9c8f7a7 | |||
| a9d7e48fac | |||
| 9d7bfbe6b9 | |||
| 908a005812 | |||
| 6d7fec03b4 |
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
VmwareLauncher/obj/
|
||||||
|
VmwareLauncher/bin/Debug/
|
||||||
Binary file not shown.
+10
-7
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Express 2013 for Windows Desktop
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 12.0.21005.1
|
VisualStudioVersion = 16.0.31025.194
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VmwareLauncher", "VmwareLauncher\VmwareLauncher.csproj", "{40A28143-CEF4-41B4-8476-3466822AAAA5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VmwareLauncher", "VmwareLauncher\VmwareLauncher.csproj", "{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -11,12 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{40A28143-CEF4-41B4-8476-3466822AAAA5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{89E29C69-15E2-43ED-9B98-4BFE9C6D7A2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {D877D8E5-8AB4-41AD-A601-EFBD24992B7E}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace VMwareLauncher
|
||||||
|
{
|
||||||
|
public static class ApplicationControl
|
||||||
|
{
|
||||||
|
public static void Shutdown(int exitCode)
|
||||||
|
{
|
||||||
|
switch (exitCode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
Startup.trayIcon.ShowShutdownSuccessMessage();
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
Startup.trayIcon.WarnServiceShutdownFailure();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Startup.trayIcon.Destroy();
|
||||||
|
Environment.Exit(exitCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
public class CheckDependencies
|
public class CheckDependencies
|
||||||
{
|
{
|
||||||
private BackgroundWorker performInitialChecks = new BackgroundWorker();
|
private readonly BackgroundWorker performInitialChecks = new BackgroundWorker();
|
||||||
|
|
||||||
public void PerformCheck()
|
public void PerformCheck()
|
||||||
{
|
{
|
||||||
@@ -14,10 +14,10 @@ namespace VMwareLauncher
|
|||||||
if (!File.Exists(ProcessControl.DefaultVmwarePath))
|
if (!File.Exists(ProcessControl.DefaultVmwarePath))
|
||||||
{
|
{
|
||||||
MessageHandler.Show(MessageHandler.MessageCode.VmwareNotInstalled);
|
MessageHandler.Show(MessageHandler.MessageCode.VmwareNotInstalled);
|
||||||
|
ApplicationControl.Shutdown(-1);
|
||||||
ApplicationControl.BlockingErrors = true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Determine if VML has ever run before.
|
// Determine if VML has ever run before.
|
||||||
string vmlPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\VmwareLauncher";
|
string vmlPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\VmwareLauncher";
|
||||||
string vmlKey = "HasBeenSetup";
|
string vmlKey = "HasBeenSetup";
|
||||||
@@ -27,9 +27,7 @@ namespace VMwareLauncher
|
|||||||
Registry.SetValue(vmlPath, vmlKey, 1);
|
Registry.SetValue(vmlPath, vmlKey, 1);
|
||||||
MessageHandler.Show(MessageHandler.MessageCode.WelcomeMessage);
|
MessageHandler.Show(MessageHandler.MessageCode.WelcomeMessage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Modify service status to manual.
|
|
||||||
ApplicationControl.BlockingErrors = Startup.serviceControl.ForceServicesManual();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System.Diagnostics;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -10,8 +7,11 @@ namespace VMwareLauncher
|
|||||||
public class ProcessControl
|
public class ProcessControl
|
||||||
{
|
{
|
||||||
public readonly static string DefaultVmwareExe = "vmware";
|
public readonly static string DefaultVmwareExe = "vmware";
|
||||||
public readonly static string DefaultVmwarePath = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation", "InstallPath", null) + $"{DefaultVmwareExe}.exe";
|
public readonly static string DefaultVmwarePath = (string) Microsoft.Win32.Registry.GetValue(
|
||||||
public readonly static string DefaultVmlPath = "vmwarelauncher";
|
@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation",
|
||||||
|
"InstallPath", null) +
|
||||||
|
$"{DefaultVmwareExe}.exe";
|
||||||
|
public readonly static string DefaultVmLauncherPath = "vmwarelauncher";
|
||||||
public string ProcessName { get; set; }
|
public string ProcessName { get; set; }
|
||||||
|
|
||||||
public void StartProcess()
|
public void StartProcess()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Windows;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("VMware Launcher")]
|
[assembly: AssemblyProduct("VMware Launcher")]
|
||||||
[assembly: AssemblyCopyright("Rebound Software - 2017")]
|
[assembly: AssemblyCopyright("Rebound Software - 2021")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -51,5 +51,5 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.0.0.0")]
|
[assembly: AssemblyVersion("2.0.9.7")]
|
||||||
[assembly: AssemblyFileVersion("2.0.0.0")]
|
[assembly: AssemblyFileVersion("2.0.9.7")]
|
||||||
|
|||||||
+1
-11
@@ -19,7 +19,7 @@ namespace VMwareLauncher.Properties {
|
|||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
||||||
@@ -69,15 +69,5 @@ namespace VMwareLauncher.Properties {
|
|||||||
return ((System.Drawing.Icon)(obj));
|
return ((System.Drawing.Icon)(obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap VMwareWorkstationBack {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("VMwareWorkstationBack", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,4 @@
|
|||||||
<data name="VMwareLauncher" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="VMwareLauncher" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\VMwareLauncher.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\VMwareLauncher.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="VMwareWorkstationBack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\VMwareWorkstationBack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 202 KiB |
@@ -1,16 +1,20 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ServiceProcess;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace VMwareLauncher
|
namespace VMwareLauncher
|
||||||
{
|
{
|
||||||
public class ServiceControl
|
public class ServiceControl
|
||||||
{
|
{
|
||||||
public static readonly List<string> DefaultVmwareServices = new List<string> { "VMnetDHCP", "VMUSBArbService", "VMware NAT Service", "VMwareHostd", "VMAuthdService" }; //Array of services to close
|
public static readonly List<string> VMwareServiceList = new List<string> //Array of services to close
|
||||||
public List<string> ServiceList { get; set; }
|
{
|
||||||
|
"VMnetDHCP",
|
||||||
|
"VMUSBArbService",
|
||||||
|
"VMware NAT Service",
|
||||||
|
"VMwareHostd",
|
||||||
|
"VMAuthdService" };
|
||||||
|
|
||||||
public bool ForceServicesManual()
|
public bool ForceServicesManual()
|
||||||
{
|
{
|
||||||
@@ -19,7 +23,7 @@ namespace VMwareLauncher
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var service in ServiceList)
|
foreach (var service in VMwareServiceList)
|
||||||
{
|
{
|
||||||
string currentService = winServices + "\\" + service;
|
string currentService = winServices + "\\" + service;
|
||||||
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
|
if ((int)Registry.GetValue(currentService, "Start", null) != 3)
|
||||||
@@ -36,5 +40,20 @@ namespace VMwareLauncher
|
|||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetStoppedVmServices()
|
||||||
|
{
|
||||||
|
var stoppedVmServices = new List<string>();
|
||||||
|
|
||||||
|
var services = ServiceController.GetServices();
|
||||||
|
foreach (var service in services)
|
||||||
|
{
|
||||||
|
if (service.Status == ServiceControllerStatus.Stopped &&
|
||||||
|
VMwareServiceList.Contains(service.ServiceName))
|
||||||
|
stoppedVmServices.Add(service.ServiceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stoppedVmServices;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Windows;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace VMwareLauncher
|
namespace VMwareLauncher
|
||||||
{
|
{
|
||||||
@@ -9,7 +8,6 @@ namespace VMwareLauncher
|
|||||||
public partial class Startup : Window
|
public partial class Startup : Window
|
||||||
{
|
{
|
||||||
static internal TrayIcon trayIcon = new TrayIcon();
|
static internal TrayIcon trayIcon = new TrayIcon();
|
||||||
static internal ServiceControl serviceControl = new ServiceControl();
|
|
||||||
internal StatusWindow statusWindow = new StatusWindow();
|
internal StatusWindow statusWindow = new StatusWindow();
|
||||||
internal CheckDependencies checkDependencies = new CheckDependencies();
|
internal CheckDependencies checkDependencies = new CheckDependencies();
|
||||||
|
|
||||||
@@ -17,44 +15,24 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
serviceControl.ServiceList = ServiceControl.DefaultVmwareServices;
|
ProcessControl vmWStationControl = new ProcessControl();
|
||||||
|
vmWStationControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
||||||
|
|
||||||
ProcessControl vmwareControl = new ProcessControl();
|
ProcessControl vmLauncherControl = new ProcessControl();
|
||||||
vmwareControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
vmLauncherControl.ProcessName = ProcessControl.DefaultVmLauncherPath;
|
||||||
|
|
||||||
ProcessControl vmlControl = new ProcessControl();
|
|
||||||
vmlControl.ProcessName = ProcessControl.DefaultVmlPath;
|
|
||||||
|
|
||||||
// Only continue if no errors have been detected.
|
|
||||||
checkDependencies.PerformCheck();
|
checkDependencies.PerformCheck();
|
||||||
if (ApplicationControl.BlockingErrors)
|
|
||||||
ApplicationControl.Shutdown();
|
|
||||||
|
|
||||||
if (!vmlControl.IsProcessRunning())
|
if (!vmLauncherControl.IsProcessRunning())
|
||||||
{
|
{
|
||||||
statusWindow.Show();
|
statusWindow.Show();
|
||||||
trayIcon.Create();
|
trayIcon.Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vmwareControl.StartProcess();
|
vmWStationControl.StartProcess();
|
||||||
ApplicationControl.Shutdown();
|
ApplicationControl.Shutdown(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ApplicationControl
|
|
||||||
{
|
|
||||||
public static bool BlockingErrors { get; set; }
|
|
||||||
|
|
||||||
public static void Shutdown()
|
|
||||||
{
|
|
||||||
Startup.trayIcon.Destroy();
|
|
||||||
|
|
||||||
if (BlockingErrors)
|
|
||||||
Environment.Exit(1);
|
|
||||||
else
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,14 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:VMwareLauncher"
|
xmlns:local="clr-namespace:VMwareLauncher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="VMware Launcher 2.0" Height="173" Width="495" Loaded="Window_Loaded" ResizeMode="NoResize" Closing="Window_Closing" Icon="Resources/VMwareLauncher.ico">
|
Title="VMware Launcher 2.1" Height="202.5" Width="500" Loaded="Window_Loaded" ResizeMode="NoResize" Closing="Window_Closing" Icon="Resources/VMwareLauncher.ico">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Image Stretch="Fill" Source="Resources/VMWareWorkstationBack.png"/>
|
<Grid.Background>
|
||||||
<ProgressBar x:Name="progLoading" IsIndeterminate="True" Margin="0,0,0,6" Height="14" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="489"/>
|
<ImageBrush ImageSource="Resources/VMware-Logo.jpg" Stretch="UniformToFill"/>
|
||||||
<Label x:Name="labelStatus" Content="Starting VMware Workstation Services..." Margin="4,0,0,21" Foreground="#FFEAEAEA" FontFamily="Calibri" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="470"/>
|
</Grid.Background>
|
||||||
|
|
||||||
|
<ProgressBar x:Name="progLoading" IsIndeterminate="True" Margin="45,0,10,5" Height="14" VerticalAlignment="Bottom"/>
|
||||||
|
<Label x:Name="labelStatus" Content="Starting VMware Workstation Services..." Margin="40,0,-40,14" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" FontFamily="Calibri" Height="26" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="494"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace VMwareLauncher
|
|||||||
BackgroundWorker runProcess = new BackgroundWorker();
|
BackgroundWorker runProcess = new BackgroundWorker();
|
||||||
BackgroundWorker loadServices = new BackgroundWorker();
|
BackgroundWorker loadServices = new BackgroundWorker();
|
||||||
BackgroundWorker stopServices = new BackgroundWorker();
|
BackgroundWorker stopServices = new BackgroundWorker();
|
||||||
|
BackgroundWorker forceServicesManual = new BackgroundWorker();
|
||||||
|
|
||||||
|
ServiceControl serviceControl = new ServiceControl();
|
||||||
|
|
||||||
|
|
||||||
public StatusWindow()
|
public StatusWindow()
|
||||||
@@ -29,11 +32,23 @@ namespace VMwareLauncher
|
|||||||
delayWindowHide.Tick += DelayWindowHide_Tick;
|
delayWindowHide.Tick += DelayWindowHide_Tick;
|
||||||
delayWindowHide.Interval = new TimeSpan(0, 0, 2);
|
delayWindowHide.Interval = new TimeSpan(0, 0, 2);
|
||||||
|
|
||||||
|
forceServicesManual.DoWork += ForceServicesManual_DoWork;
|
||||||
runProcess.DoWork += RunProcess_DoWork;
|
runProcess.DoWork += RunProcess_DoWork;
|
||||||
loadServices.DoWork += LoadServices_DoWork;
|
loadServices.DoWork += LoadServices_DoWork;
|
||||||
stopServices.DoWork += StopServices_DoWork;
|
stopServices.DoWork += StopServices_DoWork;
|
||||||
|
|
||||||
delayWindowHide.Start();
|
delayWindowHide.Start();
|
||||||
|
forceServicesManual.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ForceServicesManual_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
serviceControl.ForceServicesManual();
|
||||||
|
}
|
||||||
|
catch (Exception) { throw; }
|
||||||
|
|
||||||
loadServices.RunWorkerAsync();
|
loadServices.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +61,7 @@ namespace VMwareLauncher
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (string service in Startup.serviceControl.ServiceList)
|
foreach (string service in ServiceControl.VMwareServiceList)
|
||||||
{
|
{
|
||||||
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
||||||
|
|
||||||
@@ -56,14 +71,25 @@ namespace VMwareLauncher
|
|||||||
sc.WaitForStatus(ServiceControllerStatus.Stopped);
|
sc.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApplicationControl.Shutdown();
|
|
||||||
|
// All 5 VMware Workstation services must be stopped to qualify
|
||||||
|
// a successful shutdown.
|
||||||
|
var stoppedVmServices = serviceControl.GetStoppedVmServices();
|
||||||
|
if (stoppedVmServices.Count != 5)
|
||||||
|
{
|
||||||
|
ApplicationControl.Shutdown(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplicationControl.Shutdown(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception) { throw; }
|
catch (Exception) { throw; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadServices_DoWork(object sender, DoWorkEventArgs e)
|
private void LoadServices_DoWork(object sender, DoWorkEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (string service in Startup.serviceControl.ServiceList)
|
foreach (string service in ServiceControl.VMwareServiceList)
|
||||||
{
|
{
|
||||||
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
|
||||||
|
|
||||||
@@ -84,8 +110,6 @@ namespace VMwareLauncher
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void RunProcess_DoWork(object sender, DoWorkEventArgs e)
|
private void RunProcess_DoWork(object sender, DoWorkEventArgs e)
|
||||||
{
|
|
||||||
if (!ApplicationControl.BlockingErrors)
|
|
||||||
{
|
{
|
||||||
ProcessControl processControl = new ProcessControl();
|
ProcessControl processControl = new ProcessControl();
|
||||||
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
|
||||||
@@ -102,7 +126,6 @@ namespace VMwareLauncher
|
|||||||
}
|
}
|
||||||
stopServices.RunWorkerAsync();
|
stopServices.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disable user from terminating application from close button.
|
/// Disable user from terminating application from close button.
|
||||||
|
|||||||
@@ -69,12 +69,24 @@ namespace VMwareLauncher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Destroy()
|
public void WarnServiceShutdownFailure()
|
||||||
|
{
|
||||||
|
trayIcon.ShowBalloonTip(5000,
|
||||||
|
"VMware Launcher",
|
||||||
|
"VMware Launcher was unable to shutdown one or more Workstation services.",
|
||||||
|
ToolTipIcon.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowShutdownSuccessMessage()
|
||||||
{
|
{
|
||||||
trayIcon.ShowBalloonTip(3000,
|
trayIcon.ShowBalloonTip(3000,
|
||||||
"VMware Launcher",
|
"VMware Launcher",
|
||||||
"VMware Launcher has stopped all background Workstation services. Enjoy your day :-)",
|
"VMware Launcher has stopped all background Workstation services. Enjoy your day :-)",
|
||||||
ToolTipIcon.None);
|
ToolTipIcon.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Destroy()
|
||||||
|
{
|
||||||
trayIcon.Dispose();
|
trayIcon.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="ApplicationControl.cs" />
|
||||||
<Compile Include="CheckDependencies.cs" />
|
<Compile Include="CheckDependencies.cs" />
|
||||||
<Compile Include="ProcessControl.cs" />
|
<Compile Include="ProcessControl.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
@@ -105,6 +106,7 @@
|
|||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="app.manifest" />
|
<None Include="app.manifest" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
@@ -118,10 +120,10 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\VMwareWorkstationBack.png" />
|
<Resource Include="Resources\VMwareLauncher.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\VMwareLauncher.ico" />
|
<Resource Include="Resources\VMware-Logo.jpg" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user