forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginBase.cs
More file actions
78 lines (69 loc) · 1.95 KB
/
PluginBase.cs
File metadata and controls
78 lines (69 loc) · 1.95 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System.Windows.Forms;
namespace PluginCore
{
public class PluginBase
{
private static IProject project;
private static IProject solution;
private static InstalledSDK sdk;
private static IMainForm instance;
/// <summary>
/// Activates if the sender is MainForm
/// </summary>
public static void Initialize(IMainForm sender)
{
if (sender.GetType().ToString() == "FlashDevelop.MainForm")
{
instance = sender;
}
}
/// <summary>
/// Gets the instance of the Settings
/// </summary>
public static ISettings Settings
{
get { return instance.Settings; }
}
/// <summary>
/// Gets the instance of the MainForm
/// </summary>
public static IMainForm MainForm
{
get { return instance; }
}
/// <summary>
/// Sets and gets the current project
/// </summary>
public static IProject CurrentProject
{
get { return project; }
set { project = value; }
}
/// <summary>
/// Sets and gets the current solution
/// </summary>
public static IProject CurrentSolution
{
get { return solution; }
set { solution = value; }
}
/// <summary>
/// Sets and gets the current project's SDK
/// </summary>
public static InstalledSDK CurrentSDK
{
get { return sdk; }
set { sdk = value; }
}
/// <summary>
/// Run action on UI thread
/// </summary>
/// <param name="action"></param>
public static void RunAsync(MethodInvoker action)
{
Form ui = MainForm as Form;
if (ui != null && ui.InvokeRequired) ui.BeginInvoke(action);
else action.Invoke();
}
}
}