Remove default pinned app.
[profile/tv/apps/dotnet/home.git] / LibTVRefCommonPortable / DataModels / AppControlAction.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 using LibTVRefCommonPortable.Utils;
19 using System.Collections.Generic;
20
21 namespace LibTVRefCommonPortable.DataModels
22 {
23     /// <summary>
24     /// A class defines App Control behavior.
25     /// </summary>
26     public class AppControlAction : IAction
27     {
28         /// <summary>
29         /// A target application ID
30         /// </summary>
31         public string AppID { get; set; }
32
33         /// <summary>
34         /// A dictionary which has extra data for App Control
35         /// </summary>
36         private Dictionary<string, string> extraData;
37
38         /// <summary>
39         /// A dictionary which has extra data for App Control
40         /// </summary>
41         public Dictionary<string, string> ExtraData
42         {
43             get
44             {
45                 if (extraData == null)
46                 {
47                     extraData = new Dictionary<string, string>();
48                 }
49
50                 return extraData;
51             }
52         }
53
54         /// <summary>
55         /// A method which invoke a App Control to the application of the AppID
56         /// </summary>
57         /// <returns>a next state after App Control invocation</returns>
58         public string Execute()
59         {
60             string result = "default";
61             if (ExtraData == null)
62             {
63                 AppControlUtils.SendLaunchRequest(AppID);
64             }
65             else
66             {
67                 AppControlUtils.SendLaunchRequest(AppID, ExtraData);
68             }
69
70             return result;
71         }
72     }
73 }