-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditorBase.cs
54 lines (43 loc) · 1.73 KB
/
EditorBase.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
namespace CommonForms
{
/*
* The base class for all Condition and Action editors
*/
public class EditorBase : UserControl
{
// override this in derived classes to validate the state of the UI
public virtual bool ValidateState()
{
return true;
}
// loads the editor state from a concrete condition
// must override in derived classes
public virtual void LoadState(RealityFrameworks.Conditions.Condition<string> cond)
=> throw new NotImplementedException();
// Saves the editor's state into the condition
public virtual void SaveState(RealityFrameworks.Conditions.Condition<string> cond)
=> throw new NotImplementedException();
// Loads the state of the editor from a concrete Action
// Override in derived classes
public virtual void LoadState(RealityFrameworks.Actions.Action<string> action)
=> throw new NotImplementedException();
// Saves the state of the editor to an Action instance
// Override in derived classes
public virtual void SaveState(RealityFrameworks.Actions.Action<string> action)
=> throw new NotImplementedException();
// Resets the editor state - implement in derived classes
public virtual void ClearState()
{
}
// ERROR STACK
protected Stack<string> mErrorStack = new();
public void PushError(string error)
=> mErrorStack.Push(error);
public string PopError()
=> mErrorStack.Pop();
public bool HasErrors()
=> mErrorStack.Count > 0;
public void ClearErrors()
=> mErrorStack.Clear();
}
}