20ba02aa88535ebeea7a726dfeb287b8e3b420e9
[platform/core/csapi/tizenfx.git] / Tizen.Applications / Tizen.Applications.CoreBackend / EventType.cs
1 // Copyright 2016 by Samsung Electronics, Inc.,
2 //
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
8
9 namespace Tizen.Applications.CoreBackend
10 {
11     /// <summary>
12     /// Class that represents the type of event for backends. This class can be converted from string type.
13     /// </summary>
14     public class EventType
15     {
16         /// <summary>
17         /// Pre-defined event type. "PreCreated"
18         /// </summary>
19         public static readonly EventType PreCreated = "PreCreated";
20
21         /// <summary>
22         /// Pre-defined event type. "Created"
23         /// </summary>
24         public static readonly EventType Created = "Created";
25
26         /// <summary>
27         /// Pre-defined event type. "Terminated"
28         /// </summary>
29         public static readonly EventType Terminated = "Terminated";
30
31         /// <summary>
32         /// Pre-defined event type. "AppControlReceived"
33         /// </summary>
34         public static readonly EventType AppControlReceived = "AppControlReceived";
35
36         /// <summary>
37         /// Pre-defined event type. "Resumed"
38         /// </summary>
39         public static readonly EventType Resumed = "Resumed";
40
41         /// <summary>
42         /// Pre-defined event type. "Paused"
43         /// </summary>
44         public static readonly EventType Paused = "Paused";
45
46         /// <summary>
47         /// Pre-defined event type. "LowMemory"
48         /// </summary>
49         public static readonly EventType LowMemory = "LowMemory";
50
51         /// <summary>
52         /// Pre-defined event type. "LowBattery"
53         /// </summary>
54         public static readonly EventType LowBattery = "LowBattery";
55
56         /// <summary>
57         /// Pre-defined event type. "LocaleChanged"
58         /// </summary>
59         public static readonly EventType LocaleChanged = "LocaleChanged";
60
61         /// <summary>
62         /// Pre-defined event type. "RegionFormatChanged"
63         /// </summary>
64         public static readonly EventType RegionFormatChanged = "RegionFormatChanged";
65
66         private string _typeName;
67
68         /// <summary>
69         /// Initializes the EventType class.
70         /// </summary>
71         /// <param name="name">The name of event type.</param>
72         public EventType(string name)
73         {
74             _typeName = name;
75         }
76
77         /// <summary>
78         /// Returns the name of event type.
79         /// </summary>
80         public override string ToString()
81         {
82             return _typeName;
83         }
84
85         /// <summary>
86         /// Returns the hash code for event type string.
87         /// </summary>
88         public override int GetHashCode()
89         {
90             return _typeName.GetHashCode();
91         }
92
93         /// <summary>
94         /// Determines whether this instance and a specified object.
95         /// </summary>
96         public override bool Equals(object obj)
97         {
98             return _typeName.Equals(obj);
99         }
100
101         /// <summary>
102         /// Determines whether this instance and a specified object.
103         /// </summary>
104         public bool Equals(EventType obj)
105         {
106             if (obj == null)
107             {
108                 return false;
109             }
110             return _typeName.Equals(obj._typeName);
111         }
112
113         /// <summary>
114         /// Converts a string to EventType instance.
115         /// </summary>
116         public static implicit operator EventType(string value)
117         {
118             return new EventType(value);
119         }
120     }
121 }