Skip to content

Commit

Permalink
#323 Don't reboot the system after installing each mod with "Download…
Browse files Browse the repository at this point in the history
… and Install"
  • Loading branch information
DanTheMan827 committed Apr 13, 2020
1 parent 5083339 commit f57c75f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ModHub/Controls/ModHubTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ private IEnumerable<TaskFunc> GetItemDownloadTask(Repository.Repository.Item ite
private void handleModDownload(bool install = false)
{
using (var tasker = new Tasks.Tasker(parentForm))
using (var taskerForm = new TaskerForm())
{
tasker.AttachViews(new TaskerTaskbar(), new TaskerForm());

tasker.AttachViews(new TaskerTaskbar(), taskerForm);
tasker.SetStatusImage(Resources.sign_cogs);
tasker.SetTitle(Resources.Processing);

Expand All @@ -246,8 +248,15 @@ private void handleModDownload(bool install = false)

if (install && selectedMods.Count > 0)
{
tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.MembootRecovery, forceRecoveryReload: false));
tasker.AddTask(ShellTasks.ShellCommand("touch /user-recovery.flag"));
tasker.AddTask(ShellTasks.ShellCommand("touch /mod-recovery.flag"));
tasker.AddTask(ShellTasks.MountBase);
tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.ProcessMods, selectedMods.ToArray()));
tasker.AddTask((Tasker innerTasker, object syncObject) =>
{
tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.ProcessMods, selectedMods.ToArray()));
return Conclusion.Success;
});
}

tasker.Start();
Expand Down
1 change: 1 addition & 0 deletions ModHub/ModHubForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions ModHub/ModHubForm.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using com.clusterrr.hakchi_gui.Hmod.Controls;
using com.clusterrr.hakchi_gui.ModHub.Controls;
using com.clusterrr.hakchi_gui.Properties;
using com.clusterrr.hakchi_gui.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -83,5 +84,20 @@ public void LoadData(Repository.Repository repo)

tabControl1.ResumeLayout();
}

private void ModHubForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (hakchi.Shell.IsOnline && hakchi.Shell.Execute("[ -e /mod-recovery.flag ]") == 0)
{
using (var tasker = new Tasker(this))
{
tasker.AttachViews(new TaskerTaskbar(), new TaskerForm());
tasker.SetStatusImage(Resources.sign_sync);
tasker.SetTitle(Resources.Rebooting);
tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.Memboot));
tasker.Start();
}
}
}
}
}

0 comments on commit f57c75f

Please sign in to comment.