-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChildFrame.cs
38 lines (30 loc) · 1.05 KB
/
ChildFrame.cs
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
using System.Windows.Forms;
namespace R2ObjView
{
public class ChildFrame : Form
{
public virtual string ChildStatusText { get; protected set; }
public virtual ToolStrip ChildToolStrip { get; }
protected ChildFrame()
{
EnableLevelChanged();
EnableRefresh();
FormClosing += OnFormClosing;
}
private void OnFormClosing(object sender, FormClosingEventArgs e)
{
DisableRefresh();
DisableLevelChanged();
}
protected void EnableRefresh() => MainFrame.Instance.RefreshData += RefreshData;
protected void DisableRefresh() => MainFrame.Instance.RefreshData -= RefreshData;
protected void EnableLevelChanged() => MainFrame.Instance.LevelChanged += OnLevelChanged;
protected void DisableLevelChanged() => MainFrame.Instance.LevelChanged -= OnLevelChanged;
protected virtual void RefreshData()
{
}
protected virtual void OnLevelChanged(string levelName)
{
}
}
}