mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Startup re-scheduling https://github.com/seerge/g-helper/issues/1410
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.127</AssemblyVersion>
|
<AssemblyVersion>0.128</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ public class Startup
|
|||||||
|
|
||||||
public static bool IsScheduled()
|
public static bool IsScheduled()
|
||||||
{
|
{
|
||||||
TaskService taskService = new TaskService();
|
using (TaskService taskService = new TaskService())
|
||||||
return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName));
|
return (taskService.RootFolder.AllTasks.Any(t => t.Name == taskName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReScheduleAdmin()
|
public static void ReScheduleAdmin()
|
||||||
@@ -23,6 +23,26 @@ public class Startup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void StartupCheck()
|
||||||
|
{
|
||||||
|
using (TaskService taskService = new TaskService())
|
||||||
|
{
|
||||||
|
var task = taskService.RootFolder.AllTasks.FirstOrDefault(t => t.Name == taskName);
|
||||||
|
if (task != null)
|
||||||
|
{
|
||||||
|
string strExeFilePath = Application.ExecutablePath.Trim();
|
||||||
|
string action = task.Definition.Actions.FirstOrDefault()!.ToString().Trim();
|
||||||
|
if (!strExeFilePath.Equals(action, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
Logger.WriteLine(action);
|
||||||
|
Logger.WriteLine("Rescheduling to: " + strExeFilePath);
|
||||||
|
UnSchedule();
|
||||||
|
Schedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void Schedule()
|
public static void Schedule()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,9 @@ namespace GHelper
|
|||||||
settingsForm.FansToggle(2);
|
settingsForm.FansToggle(2);
|
||||||
modeControl.SetRyzen();
|
modeControl.SetRyzen();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
Startup.StartupCheck();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user