Release 4.0.0-preview1-00051
[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     /// Class that represents the type of event for backends. This class can be converted from string type.
20     /// </summary>
21     public class EventType
22     {
23         /// <summary>
24         /// Pre-defined event type. "PreCreated"
25         /// </summary>
26         public static readonly EventType PreCreated = "PreCreated";
27
28         /// <summary>
29         /// Pre-defined event type. "Created"
30         /// </summary>
31         public static readonly EventType Created = "Created";
32
33         /// <summary>
34         /// Pre-defined event type. "Terminated"
35         /// </summary>
36         public static readonly EventType Terminated = "Terminated";
37
38         /// <summary>
39         /// Pre-defined event type. "AppControlReceived"
40         /// </summary>
41         public static readonly EventType AppControlReceived = "AppControlReceived";
42
43         /// <summary>
44         /// Pre-defined event type. "Resumed"
45         /// </summary>
46         public static readonly EventType Resumed = "Resumed";
47
48         /// <summary>
49         /// Pre-defined event type. "Paused"
50         /// </summary>
51         public static readonly EventType Paused = "Paused";
52
53         /// <summary>
54         /// Pre-defined event type. "LowMemory"
55         /// </summary>
56         public static readonly EventType LowMemory = "LowMemory";
57
58         /// <summary>
59         /// Pre-defined event type. "LowBattery"
60         /// </summary>
61         public static readonly EventType LowBattery = "LowBattery";
62
63         /// <summary>
64         /// Pre-defined event type. "LocaleChanged"
65         /// </summary>
66         public static readonly EventType LocaleChanged = "LocaleChanged";
67
68         /// <summary>
69         /// Pre-defined event type. "RegionFormatChanged"
70         /// </summary>
71         public static readonly EventType RegionFormatChanged = "RegionFormatChanged";
72
73         /// <summary>
74         /// Pre-defined event type. "DeviceOrientationChanged"
75         /// </summary>
76         public static readonly EventType DeviceOrientationChanged = "DeviceOrientationChanged";
77
78         private string _typeName;
79
80         /// <summary>
81         /// Initializes the EventType class.
82         /// </summary>
83         /// <param name="name">The name of event type.</param>
84         public EventType(string name)
85         {
86             _typeName = name;
87         }
88
89         /// <summary>
90         /// Returns the name of event type.
91         /// </summary>
92         public override string ToString()
93         {
94             return _typeName;
95         }
96
97         /// <summary>
98         /// Returns the hash code for event type string.
99         /// </summary>
100         public override int GetHashCode()
101         {
102             if (_typeName == null) return 0;
103             return _typeName.GetHashCode();
104         }
105
106         /// <summary>
107         /// Determines whether this instance and a specified object.
108         /// </summary>
109         public override bool Equals(object obj)
110         {
111             EventType other = obj as EventType;
112             return other != null && other._typeName == this._typeName;
113         }
114
115         /// <summary>
116         /// Converts a string to EventType instance.
117         /// </summary>
118         public static implicit operator EventType(string value)
119         {
120             return new EventType(value);
121         }
122     }
123 }