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
54 lines (47 loc) · 1.46 KB
/
Copy pathPluginBase.cs
File metadata and controls
54 lines (47 loc) · 1.46 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
using System;
using System.Windows.Forms;
namespace PluginCore
{
public class PluginBase
{
/// <summary>
/// Activates if the sender is MainForm
/// </summary>
public static void Initialize(IMainForm sender)
{
if (sender.GetType().ToString() == "FlashDevelop.MainForm")
{
MainForm = sender;
}
}
/// <summary>
/// Gets the instance of the Settings
/// </summary>
public static ISettings Settings => MainForm.Settings;
/// <summary>
/// Gets the instance of the MainForm
/// </summary>
public static IMainForm MainForm { get; set; }
/// <summary>
/// Sets and gets the current project
/// </summary>
public static IProject CurrentProject { get; set; }
/// <summary>
/// Sets and gets the current solution
/// </summary>
public static IProject CurrentSolution { get; set; }
/// <summary>
/// Sets and gets the current project's SDK
/// </summary>
public static InstalledSDK CurrentSDK { get; set; }
/// <summary>
/// Run action on UI thread
/// </summary>
/// <param name="action"></param>
public static void RunAsync(Action action)
{
if (MainForm is Form {InvokeRequired: true} ui) ui.BeginInvoke(action);
else action.Invoke();
}
}
}