Little cleanup (extension method for BeginInvoke).

This commit is contained in:
jdpurcell 2015-01-04 18:22:17 +00:00
parent 1d7e9bd80a
commit c81bb3e50e
2 changed files with 9 additions and 6 deletions

View File

@ -32,9 +32,15 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
} }
// extension method to make Control.Invoke easier to use // extension method to make Control.Invoke easier to use
public static void Invoke(this Control control, Action action) public static object Invoke(this Control control, Action action)
{ {
control.Invoke(action); return control.Invoke(action);
}
// extension method to make Control.BeginInvoke easier to use
public static IAsyncResult BeginInvoke(this Control control, Action action)
{
return control.BeginInvoke(action);
} }
public static void AddColumn(this ListView listView, string columnName, bool enabled, int columnWidth) public static void AddColumn(this ListView listView, string columnName, bool enabled, int columnWidth)

View File

@ -70,10 +70,7 @@ namespace BizHawk.Client.EmuHawk
UpdateChecker.CheckComplete += (s2, e2) => UpdateChecker.CheckComplete += (s2, e2) =>
{ {
if (IsDisposed) return; if (IsDisposed) return;
BeginInvoke((MethodInvoker)(() => this.BeginInvoke(() => { UpdateNotification.Visible = UpdateChecker.IsNewVersionAvailable; });
{
UpdateNotification.Visible = UpdateChecker.IsNewVersionAvailable;
}));
}; };
UpdateChecker.BeginCheck(); // Won't actually check unless enabled by user UpdateChecker.BeginCheck(); // Won't actually check unless enabled by user
} }