mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-18 09:35:48 +00:00
Task Scheduler Changes
- added on Login option to Auto-Start server.
This commit is contained in:
parent
795055f2f1
commit
19a6a80c56
7 changed files with 92 additions and 26 deletions
|
|
@ -870,6 +870,14 @@ namespace ServerManagerTool.Lib
|
|||
set { SetValue(EnableAutoStartProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AutoStartOnLoginProperty = DependencyProperty.Register(nameof(AutoStartOnLogin), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
|
||||
[DataMember]
|
||||
public bool AutoStartOnLogin
|
||||
{
|
||||
get { return (bool)GetValue(AutoStartOnLoginProperty); }
|
||||
set { SetValue(AutoStartOnLoginProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty EnableAutoUpdateProperty = DependencyProperty.Register(nameof(EnableAutoUpdate), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false));
|
||||
[DataMember]
|
||||
public bool EnableAutoUpdate
|
||||
|
|
@ -4603,13 +4611,14 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
var taskKey = GetProfileKey();
|
||||
|
||||
if(!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, true, Config.Default.AutoStart_TaskPriority))
|
||||
if (!TaskSchedulerUtils.ScheduleAutoStart(taskKey, null, this.EnableAutoStart, GetLauncherFile(), ProfileName, this.AutoStartOnLogin, Config.Default.AutoStart_TaskPriority))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TimeSpan shutdownTime;
|
||||
var command = Assembly.GetEntryAssembly().Location;
|
||||
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out TimeSpan shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1, Config.Default.AutoShutdown_TaskPriority))
|
||||
if (!TaskSchedulerUtils.ScheduleAutoShutdown(taskKey, "#1", command, this.EnableAutoShutdown1 ? (TimeSpan.TryParseExact(this.AutoShutdownTime1, "g", null, out shutdownTime) ? shutdownTime : (TimeSpan?)null) : null, ShutdownDaysOfTheWeek1, ProfileName, TaskSchedulerUtils.ShutdownType.Shutdown1, Config.Default.AutoShutdown_TaskPriority))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue