[VMware Launcher 2.0.9.5]

- Refactored code.
- Fixed bug: "#1 Welcome message shows despite VMware not being installed"
This commit is contained in:
2021-03-26 20:20:46 +00:00
parent 1cbdbccf77
commit 6d7fec03b4
10 changed files with 79 additions and 83 deletions
+14 -17
View File
@@ -46,7 +46,7 @@ namespace VMwareLauncher
{
try
{
foreach (string service in Startup.serviceControl.ServiceList)
foreach (string service in ServiceControl.VMwareServiceList)
{
ServiceController sc = new ServiceController(service, Environment.MachineName.ToString());
@@ -56,14 +56,14 @@ namespace VMwareLauncher
sc.WaitForStatus(ServiceControllerStatus.Stopped);
}
}
ApplicationControl.Shutdown();
ApplicationControl.Shutdown(0);
}
catch (Exception) { throw; }
}
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());
@@ -85,23 +85,20 @@ namespace VMwareLauncher
private void RunProcess_DoWork(object sender, DoWorkEventArgs e)
{
if (!ApplicationControl.BlockingErrors)
ProcessControl processControl = new ProcessControl();
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
processControl.StartProcess();
bool isVmwareRunning = true;
while (isVmwareRunning || TrayIcon.KeepLauncherRunning)
{
ProcessControl processControl = new ProcessControl();
processControl.ProcessName = ProcessControl.DefaultVmwarePath;
processControl.StartProcess();
Thread.Sleep(3000);
bool isVmwareRunning = true;
while (isVmwareRunning || TrayIcon.KeepLauncherRunning)
{
Thread.Sleep(3000);
isVmwareRunning = false; // Default value.
foreach (Process instance in Process.GetProcessesByName(ProcessControl.DefaultVmwareExe))
isVmwareRunning = true;
}
stopServices.RunWorkerAsync();
isVmwareRunning = false; // Default value.
foreach (Process instance in Process.GetProcessesByName(ProcessControl.DefaultVmwareExe))
isVmwareRunning = true;
}
stopServices.RunWorkerAsync();
}
/// <summary>