-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.Threading.cs
More file actions
44 lines (39 loc) · 856 Bytes
/
Main.Threading.cs
File metadata and controls
44 lines (39 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Windows.Forms;
namespace BeanModManager
{
public partial class Main : Form
{
private void UpdateStatus(string message)
{
if (InvokeRequired)
{
Invoke(new Action<string>(UpdateStatus), message);
return;
}
lblStatus.Text = message;
}
private void SafeInvoke(Action action)
{
if (InvokeRequired)
{
Invoke(action);
}
else
{
action();
}
}
private T SafeInvoke<T>(Func<T> func)
{
if (InvokeRequired)
{
return (T)Invoke(func);
}
else
{
return func();
}
}
}
}