Add Tizen.Application.ApplicationManager
[platform/core/csapi/tizenfx.git] / Tizen.Applications / Tizen.Applications / ApplicationManager.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 using System;
10 using System.Collections.Generic;
11 using System.Threading.Tasks;
12
13 namespace Tizen.Applications
14 {
15     /// <summary>
16     /// ApplicationManager class. This class has the methods and events of the ApplicationManager.
17     /// </summary>
18     static public class ApplicationManager
19     {
20         /// <summary>
21         /// ApplicationLaunched event. This event is occurred when the application is launched.
22         /// </summary>
23         static public event EventHandler<ApplicationChangedEventArgs> ApplicationLaunched
24         {
25             add
26             {
27                 ApplicationManagerImpl.Instance.ApplicationLaunched += value;
28             }
29             remove
30             {
31                 ApplicationManagerImpl.Instance.ApplicationLaunched -= value;
32             }
33         }
34
35         /// <summary>
36         /// ApplicationTerminated event. This event is occurred when the application is terminated.
37         /// </summary>
38         static public event EventHandler<ApplicationChangedEventArgs> ApplicationTerminated
39         {
40             add
41             {
42                 ApplicationManagerImpl.Instance.ApplicationTerminated += value;
43             }
44             remove
45             {
46                 ApplicationManagerImpl.Instance.ApplicationTerminated -= value;
47             }
48         }
49
50         /// <summary>
51         /// GetInstalledAppsAsync asynchronous method.
52         /// </summary>
53         /// <returns>It returns the InstalledApplication informations asynchronously.</returns>
54         static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync()
55         {
56             return ApplicationManagerImpl.Instance.GetInstalledAppsAsync();
57         }
58
59         /// <summary>
60         /// GetInstalledAppsAsync asynchronous method.
61         /// </summary>
62         /// <param name="filter">Filter is a InstalledApplicationFilter type. It consisting of a key and value pairs.</param>
63         /// <returns>It returns the filtered InstalledApplication informations asynchronously.</returns>
64         static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync(InstalledApplicationFilter filter)
65         {
66             return ApplicationManagerImpl.Instance.GetInstalledAppsAsync(filter);
67         }
68
69         /// <summary>
70         /// GetInstalledAppsAsync asynchronous method.
71         /// </summary>
72         /// <param name="filter">Filter is a InstalledApplicationMetadataFilter type. It consisting of a key and value pairs.</param>
73         /// <returns>It returns the filtered InstalledApplication informations asynchronously.</returns>
74         static public Task<IEnumerable<InstalledApplication>> GetInstalledAppsAsync(InstalledApplicationMetadataFilter filter)
75         {
76             return ApplicationManagerImpl.Instance.GetInstalledAppsAsync(filter);
77         }
78
79         /// <summary>
80         /// GetRunningAppsAsync asynchronous method.
81         /// </summary>
82         /// <returns>It returns the RunningApplication informations asynchronously.</returns>
83         static public Task<IEnumerable<RunningApplication>> GetRunningAppsAsync()
84         {
85             return ApplicationManagerImpl.Instance.GetRunningAppsAsync();
86         }
87
88         /// <summary>
89         /// GetInstalledApp synchronous method.
90         /// </summary>
91         /// <param name="applicationId"> string application id.</param>
92         /// <returns>It returns the InstalledApplication information synchronously.</returns>
93         static public InstalledApplication GetInstalledApp(string applicationId)
94         {
95             return ApplicationManagerImpl.Instance.GetInstalledApp(applicationId);
96         }
97
98         /// <summary>
99         /// GetRunningApp synchronous method.
100         /// </summary>
101         /// <param name="applicationId">string application id.</param>
102         /// <returns>It returns the RunningApplication information synchronously.</returns>
103         static public RunningApplication GetRunningApp(string applicationId)
104         {
105             return ApplicationManagerImpl.Instance.GetRunningApp(applicationId);
106         }
107
108         /// <summary>
109         /// GetRunningApp synchronous method.
110         /// </summary>
111         /// <param name="processId">int process id.</param>
112         /// <returns>It returns the RunningApplication information synchronously.</returns>
113         static public RunningApplication GetRunningApp(int processId)
114         {
115             return ApplicationManagerImpl.Instance.GetRunningApp(processId);
116         }
117
118         /// <summary>
119         /// IsRunningApp synchronous method.
120         /// </summary>
121         /// <param name="applicationId">string application id.</param>
122         /// <returns>bool. If the application is running, true; otherwise, false.</returns>
123         static public bool IsRunningApp(string applicationId)
124         {
125             return ApplicationManagerImpl.Instance.IsRunningApp(applicationId);
126         }
127
128         /// <summary>
129         /// IsRunningApp synchronous method.
130         /// </summary>
131         /// <param name="processId">int process id.</param>
132         /// <returns>bool. If the application is running, true; otherwise, false.</returns>
133         static public bool IsRunningApp(int processId)
134         {
135             return ApplicationManagerImpl.Instance.IsRunningApp(processId);
136         }
137     }
138 }