Merge remote-tracking branch 'origin/API9' into tizen_6.5
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Common / Tizen.Applications.CoreBackend / EventType.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 namespace Tizen.Applications.CoreBackend
17 {
18     /// <summary>
19     /// This class represents the type of event for backends. This class can be converted from the string type.
20     /// </summary>
21     /// <since_tizen> 3 </since_tizen>
22     public class EventType
23     {
24         /// <summary>
25         /// Pre-defined event type "PreCreated".
26         /// </summary>
27         /// <since_tizen> 3 </since_tizen>
28         public static readonly EventType PreCreated = "PreCreated";
29
30         /// <summary>
31         /// Pre-defined event type "Created".
32         /// </summary>
33         /// <since_tizen> 3 </since_tizen>
34         public static readonly EventType Created = "Created";
35
36         /// <summary>
37         /// Pre-defined event type "Terminated".
38         /// </summary>
39         /// <since_tizen> 3 </since_tizen>
40         public static readonly EventType Terminated = "Terminated";
41
42         /// <summary>
43         /// Pre-defined event type "AppControlReceived".
44         /// </summary>
45         /// <since_tizen> 3 </since_tizen>
46         public static readonly EventType AppControlReceived = "AppControlReceived";
47
48         /// <summary>
49         /// Pre-defined event type "Resumed".
50         /// </summary>
51         /// <since_tizen> 3 </since_tizen>
52         public static readonly EventType Resumed = "Resumed";
53
54         /// <summary>
55         /// Pre-defined event type "Paused".
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         public static readonly EventType Paused = "Paused";
59
60         /// <summary>
61         /// Pre-defined event type "LowMemory".
62         /// </summary>
63         /// <since_tizen> 3 </since_tizen>
64         public static readonly EventType LowMemory = "LowMemory";
65
66         /// <summary>
67         /// Pre-defined event type "LowBattery".
68         /// </summary>
69         /// <since_tizen> 3 </since_tizen>
70         public static readonly EventType LowBattery = "LowBattery";
71
72         /// <summary>
73         /// Pre-defined event type "LocaleChanged".
74         /// </summary>
75         /// <since_tizen> 3 </since_tizen>
76         public static readonly EventType LocaleChanged = "LocaleChanged";
77
78         /// <summary>
79         /// Pre-defined event type "RegionFormatChanged".
80         /// </summary>
81         /// <since_tizen> 3 </since_tizen>
82         public static readonly EventType RegionFormatChanged = "RegionFormatChanged";
83
84         /// <summary>
85         /// Pre-defined event type "DeviceOrientationChanged".
86         /// </summary>
87         /// <since_tizen> 3 </since_tizen>
88         public static readonly EventType DeviceOrientationChanged = "DeviceOrientationChanged";
89
90         /// <summary>
91         /// Pre-defined event type "SuspendedStateChanged".
92         /// The SuspendedStateEventArgs class is an event argument class for this EventType.
93         /// </summary>
94         /// <since_tizen> 6 </since_tizen>
95         public static readonly EventType SuspendedStateChanged = "SuspendedStateChanged";
96
97         private string _typeName;
98
99         /// <summary>
100         /// Initializes the EventType class.
101         /// </summary>
102         /// <param name="name">The name of event type.</param>
103         /// <since_tizen> 3 </since_tizen>
104         public EventType(string name)
105         {
106             _typeName = name;
107         }
108
109         /// <summary>
110         /// Returns the name of event type.
111         /// </summary>
112         /// <since_tizen> 3 </since_tizen>
113         public override string ToString()
114         {
115             return _typeName;
116         }
117
118         /// <summary>
119         /// Returns the hash code for event type string.
120         /// </summary>
121         /// <since_tizen> 3 </since_tizen>
122         public override int GetHashCode()
123         {
124             if (_typeName == null) return 0;
125             return _typeName.GetHashCode();
126         }
127
128         /// <summary>
129         /// Determines whether this instance and a specified object.
130         /// </summary>
131         /// <since_tizen> 3 </since_tizen>
132         public override bool Equals(object obj)
133         {
134             EventType other = obj as EventType;
135             return other != null && other._typeName == this._typeName;
136         }
137
138         /// <summary>
139         /// Converts a string to EventType instance.
140         /// </summary>
141         /// <since_tizen> 3 </since_tizen>
142         public static implicit operator EventType(string value)
143         {
144             return new EventType(value);
145         }
146     }
147 }