74ee0a2eb3d6763c1e9591b737c4c482c7eb8b2d
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / XamlBinding / Interactivity / Condition.cs
1 using System;
2
3 namespace Tizen.NUI.Binding
4 {
5     internal abstract class Condition
6     {
7         Action<BindableObject, bool, bool> _conditionChanged;
8
9         bool _isSealed;
10
11         internal Condition()
12         {
13         }
14
15         internal Action<BindableObject, bool, bool> ConditionChanged
16         {
17             get { return _conditionChanged; }
18             set
19             {
20                 if (_conditionChanged == value)
21                     return;
22                 if (_conditionChanged != null)
23                     throw new InvalidOperationException("The same condition instance can not be reused");
24                 _conditionChanged = value;
25             }
26         }
27
28         internal bool IsSealed
29         {
30             get { return _isSealed; }
31             set
32             {
33                 if (_isSealed == value)
34                     return;
35                 if (!value)
36                     throw new InvalidOperationException("What is sealed can not be unsealed.");
37                 _isSealed = value;
38                 OnSealed();
39             }
40         }
41
42         internal abstract bool GetState(BindableObject bindable);
43
44         internal virtual void OnSealed()
45         {
46         }
47
48         internal abstract void SetUp(BindableObject bindable);
49         internal abstract void TearDown(BindableObject bindable);
50     }
51 }