Merge pull request #435 from Cyberboss/NoMoreFactory

Changes Task.Factory.StartNew to Task.Run
This commit is contained in:
Jordan Brown
2017-12-04 11:14:11 -05:00
committed by GitHub
4 changed files with 15 additions and 15 deletions
+9 -9
View File
@@ -321,7 +321,7 @@ namespace TGS.ControlPanel
{
string res = null;
var repo = Interface.GetComponent<ITGRepository>();
var pulls = await Task.Factory.StartNew(() => repo.MergedPullRequests(out res));
var pulls = await Task.Run(() => repo.MergedPullRequests(out res));
if (pulls == null)
{
@@ -338,7 +338,7 @@ namespace TGS.ControlPanel
pullsRequests.Add(ghclient.PullRequest.Get(remoteOwner, remoteName, I.Number));
}
res = await Task.Factory.StartNew(() => repo.Update(true));
res = await Task.Run(() => repo.Update(true));
if (res != null)
{
@@ -346,12 +346,12 @@ namespace TGS.ControlPanel
return;
}
await Task.Factory.StartNew(() => repo.GenerateChangelog(out res));
await Task.Run(() => repo.GenerateChangelog(out res));
if (res != null)
MessageBox.Show(res, "Error generating changelog");
res = await Task.Factory.StartNew(() => repo.SynchronizePush());
res = await Task.Run(() => repo.SynchronizePush());
if (res != null)
MessageBox.Show(res, "Error synchronizing commits");
@@ -363,8 +363,8 @@ namespace TGS.ControlPanel
if (I.Result.Merged)
pulls.RemoveAll(x => x.Number == I.Result.Number);
var mergeResults = await Task.Factory.StartNew(() => repo.MergePullRequests(pulls, true));
var compileStartResult = await Task.Factory.StartNew(() => Interface.GetComponent<ITGCompiler>().Compile(true));
var mergeResults = await Task.Run(() => repo.MergePullRequests(pulls, true));
var compileStartResult = await Task.Run(() => Interface.GetComponent<ITGCompiler>().Compile(true));
//Show any errors
for (var I = 0; I < mergeResults.Count(); ++I)
@@ -412,7 +412,7 @@ namespace TGS.ControlPanel
{
var repo = Interface.GetComponent<ITGRepository>();
var res = await Task.Factory.StartNew(() => repo.Reset(true));
var res = await Task.Run(() => repo.Reset(true));
if (res != null)
{
@@ -420,12 +420,12 @@ namespace TGS.ControlPanel
return;
}
await Task.Factory.StartNew(() => repo.GenerateChangelog(out res));
await Task.Run(() => repo.GenerateChangelog(out res));
if (res != null)
MessageBox.Show(res, "Error generating changelog");
await Task.Factory.StartNew(() => Interface.GetComponent<ITGCompiler>().Compile(false));
await Task.Run(() => Interface.GetComponent<ITGCompiler>().Compile(false));
if (res != null)
MessageBox.Show(res, "Error starting compile!");
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace TGS.ControlPanel
UseWaitCursor = true;
try
{
return Task.Factory.StartNew(action);
return Task.Run(action);
}
finally
{
+4 -4
View File
@@ -93,7 +93,7 @@ namespace TGS.ControlPanel
List<PullRequestInfo> pulls = null;
//get started on this while we're processing here
var pullsRequest = Task.Factory.StartNew(() => pulls = repo.MergedPullRequests(out error));
var pullsRequest = Task.Run(() => pulls = repo.MergedPullRequests(out error));
//Search for open PRs
Enabled = false;
@@ -276,11 +276,11 @@ namespace TGS.ControlPanel
if (UpdateToRemoteRadioButton.Checked)
{
GenerateChangelog(repo);
error = await Task.Factory.StartNew(() => repo.SynchronizePush());
error = await Task.Run(() => repo.SynchronizePush());
}
//Merge the PRs, collect errors
var errors = await Task.Factory.StartNew(() => repo.MergePullRequests(pulls, false));
var errors = await Task.Run(() => repo.MergePullRequests(pulls, false));
//Show any errors
for (var I = 0; I < errors.Count(); ++I)
@@ -298,7 +298,7 @@ namespace TGS.ControlPanel
GenerateChangelog(repo);
//Start the compile
var compileStarted = await Task.Factory.StartNew(() => currentInterface.GetComponent<ITGCompiler>().Compile(pulls.Count == 1));
var compileStarted = await Task.Run(() => currentInterface.GetComponent<ITGCompiler>().Compile(pulls.Count == 1));
if (error != null)
MessageBox.Show(String.Format("Error sychronizing repo: {0}", error));
+1 -1
View File
@@ -387,7 +387,7 @@ namespace TGS.Installer.UI
// Microsoft.Deployment.WindowsInstaller.Installer.SetInternalUI(InstallUIOptions.Silent);
Microsoft.Deployment.WindowsInstaller.Installer.SetExternalUI(OnUIUpdate, InstallLogModes.Progress);
await Task.Factory.StartNew(() => Microsoft.Deployment.WindowsInstaller.Installer.InstallProduct(msipath, cl));
await Task.Run(() => Microsoft.Deployment.WindowsInstaller.Installer.InstallProduct(msipath, cl));
if (cancelled)
{