Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Account.AccountManager / Tizen.Account.AccountManager / AccountSubscriberEventArgs.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
17 using System;
18
19 namespace Tizen.Account.AccountManager
20 {
21     /// <summary>
22     /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class AccountSubscriberEventArgs : EventArgs
26     {
27         private const string NotiInsert = "insert";
28         private const string NotiDelete = "delete";
29         private const string NotiUpdate = "update";
30         private const string NotiSyncUpdate = "sync_update";
31         internal AccountSubscriberEventArgs(string eventType, int accountId)
32         {
33             if (eventType.CompareTo(NotiInsert) == 0)
34             {
35                 EventType = AccountNotificationType.Insert;
36             }
37             else if (eventType.CompareTo(NotiDelete) == 0)
38             {
39                 EventType = AccountNotificationType.Delete;
40             }
41             else if (eventType.CompareTo(NotiUpdate) == 0)
42             {
43                 EventType = AccountNotificationType.Update;
44             }
45             else if (eventType.CompareTo(NotiSyncUpdate) == 0)
46             {
47                 EventType = AccountNotificationType.syncUpdate;
48             }
49
50             AccountId = accountId;
51         }
52
53         /// <summary>
54         /// The account event type
55         /// </summary>
56         /// <since_tizen> 3 </since_tizen>
57         public AccountNotificationType EventType
58         {
59             get;
60             internal set;
61         }
62
63         /// <summary>
64         /// The account ID to update
65         /// </summary>
66         /// <since_tizen> 3 </since_tizen>
67         public int AccountId
68         {
69             get;
70             internal set;
71         }
72     }
73 }