Skip to content

Commit

Permalink
Clean-up awesomium
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Nov 24, 2018
1 parent 7dc1550 commit e50135b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Binary file removed .vs/Neutronium/DesignTimeBuild/.dtbcache
Binary file not shown.
Expand Up @@ -2,7 +2,6 @@
using System.Threading;
using System.Threading.Tasks;
using Awesomium.Core;
using HTMLEngine.Awesomium;
using Neutronium.Core.WebBrowserEngine.Window;

namespace Neutronium.WebBrowserEngine.Awesomium.Internal
Expand All @@ -21,25 +20,27 @@ private void RunOnContext(Action act)
public Task RunAsync(Action act)
{
var tcs = new TaskCompletionSource<object>();
Action nact = () =>

void Nact()
{
try
{
act();
tcs.SetResult(null);
}
catch (Exception e)
{
try
{
act();
tcs.SetResult(null);
}
catch (Exception e)
{
tcs.SetException(e);
}
};
RunOnContext(nact);
tcs.SetException(e);
}
}

RunOnContext(Nact);
return tcs.Task;
}

public void Dispatch(Action act)
{
Action nact = () =>
void Nact()
{
try
{
Expand All @@ -48,8 +49,9 @@ public void Dispatch(Action act)
catch
{
}
};
RunOnContext(nact);
}

RunOnContext(Nact);
}

public void Run(Action act)
Expand All @@ -60,7 +62,8 @@ public void Run(Action act)
public Task<T> EvaluateAsync<T>(Func<T> compute)
{
var tcs = new TaskCompletionSource<T>();
Action nact = () =>

void Nact()
{
try
{
Expand All @@ -70,8 +73,9 @@ public Task<T> EvaluateAsync<T>(Func<T> compute)
{
tcs.TrySetException(e);
}
};
RunOnContext(nact);
}

RunOnContext(Nact);
return tcs.Task;
}

Expand Down

0 comments on commit e50135b

Please sign in to comment.