/
CheckableSimpleAction.cs
31 lines (30 loc) · 1.08 KB
/
CheckableSimpleAction.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
using System;
using System.ComponentModel;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
namespace CustomActionControl.Module {
public class CheckableSimpleAction : SimpleAction {
private bool _Checked = false;
private void OnCheckedStateChanged() {
if(CheckedStateChanged != null) {
CheckedStateChanged(this, EventArgs.Empty);
}
}
public CheckableSimpleAction(IContainer container) : base(container) { }
public CheckableSimpleAction(Controller owner, string id, PredefinedCategory category) : base(owner, id, category) { }
public bool Checked {
get { return _Checked; }
set {
if(_Checked != value) {
_Checked = value;
OnCheckedStateChanged();
if(Enabled.ResultValue && Active.ResultValue) {
DoExecute();
}
}
}
}
public event EventHandler CheckedStateChanged;
}
}