MCPcopy
hub / github.com/lxn/walk / SetEnabledCondition

Method SetEnabledCondition

action.go:258–278  ·  view source on GitHub ↗
(c Condition)

Source from the content-addressed store, hash-verified

256}
257
258func (a *Action) SetEnabledCondition(c Condition) {
259 if a.enabledCondition != nil {
260 a.enabledCondition.Changed().Detach(a.enabledConditionChangedHandle)
261 }
262
263 a.enabledCondition = c
264
265 if c != nil {
266 a.enabled = c.Satisfied()
267
268 a.enabledConditionChangedHandle = c.Changed().Attach(func() {
269 if a.enabled != c.Satisfied() {
270 a.enabled = !a.enabled
271
272 a.raiseChanged()
273 }
274 })
275 }
276
277 a.raiseChanged()
278}
279
280func (a *Action) Exclusive() bool {
281 return a.exclusive

Callers 1

releaseMethod · 0.95

Calls 5

raiseChangedMethod · 0.95
ChangedMethod · 0.65
SatisfiedMethod · 0.65
DetachMethod · 0.45
AttachMethod · 0.45

Tested by

no test coverage detected