Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Common / Tizen.Applications / RecentApplicationInfo.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 using System.ComponentModel;
19 using System.Runtime.InteropServices;
20
21 namespace Tizen.Applications
22 {
23     /// <summary>
24     /// This class provides methods and properties to get information of recent application.
25     /// </summary>
26     [EditorBrowsable(EditorBrowsableState.Never)]
27     public class RecentApplicationInfo : ApplicationInfo
28     {
29         private const string LogTag = "Tizen.Applications";
30
31         /// <summary>
32         /// Gets the instance id.
33         /// </summary>
34         public string InstanceId { get; private set; }
35
36         /// <summary>
37         /// Gets the instance Name.
38         /// </summary>
39         public string InstanceName { get; private set; }
40
41         /// <summary>
42         /// Gets the arguements.
43         /// </summary>
44         public string Arg { get; private set; }
45
46         /// <summary>
47         /// Gets the uri.
48         /// </summary>
49         public string Uri { get; private set; }
50
51         /// <summary>
52         /// Gets the launchTime.
53         /// </summary>
54         public DateTime LaunchTime { get; private set; }
55
56         /// <summary>
57         /// Gets the recent application controller.
58         /// </summary>
59         public RecentApplicationControl Controller { get; private set; }
60
61         internal RecentApplicationInfo(Interop.ApplicationManager.RuaRec record) : base(Marshal.PtrToStringAnsi(record.pkgName))
62         {
63             InstanceId = Marshal.PtrToStringAnsi(record.instanceId);
64             InstanceName = Marshal.PtrToStringAnsi(record.instanceName);
65             Arg = Marshal.PtrToStringAnsi(record.arg);
66             Uri = Marshal.PtrToStringAnsi(record.uri);
67             long seconds = record.launchTime.ToInt64();
68             LaunchTime = new DateTime(1970, 1, 1).AddSeconds(seconds);
69             Controller = new RecentApplicationControl(Marshal.PtrToStringAnsi(record.pkgName));
70         }
71     }
72 }