1 /// Copyright 2016 by Samsung Electronics, Inc.,
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.
10 using System.Collections.Generic;
12 namespace Tizen.Applications
15 /// InstalledApplicationFilter class. This class is a parameter of InstallerApplicationAppsAsync method.
17 public class InstalledApplicationFilter : IDisposable
20 /// Keys class. This class is a possible key to use in the InstalledApplicationFilter.
22 public static class Keys
27 public const string Id = "PACKAGE_INFO_PROP_APP_ID";
31 public const string Type = "PACKAGE_INFO_PROP_APP_TYPE";
35 public const string Category = "PACKAGE_INFO_PROP_APP_CATEGORY";
39 public const string NoDisplay = "PACKAGE_INFO_PROP_APP_NODISPLAY";
43 public const string TaskManage = "PACKAGE_INFO_PROP_APP_TASKMANAGE";
46 private IntPtr _handle;
47 private bool disposed = false;
49 public InstalledApplicationFilter(IDictionary<string, string> filter)
51 Interop.ApplicationManager.AppInfoFilterCreate(out _handle);
52 foreach (var item in filter)
54 if ((item.Key == Keys.Id) || (item.Key == Keys.Type) || (item.Key == Keys.Category))
56 Interop.ApplicationManager.AppInfoFilterAddString(_handle, item.Key, item.Value);
58 else if ((item.Key == Keys.NoDisplay) || (item.Key == Keys.TaskManage))
60 Interop.ApplicationManager.AppInfoFilterAddBool(_handle, item.Key, Convert.ToBoolean(item.Value));
65 Console.WriteLine(item.Key + " is NOT supported for the InstalledApplicationFilter");
70 internal IntPtr Handle
78 ~InstalledApplicationFilter()
86 GC.SuppressFinalize(this);
89 private void Dispose(bool disposing)
95 // to be used if there are any other disposable objects
97 if (_handle != IntPtr.Zero)
99 Interop.ApplicationManager.AppInfoFilterDestroy(_handle);
106 /// InstalledApplicationMetadataFilter class. This class is a parameter of InstallerApplicationAppsAsync method.
108 public class InstalledApplicationMetadataFilter : IDisposable
110 private IntPtr _handle;
111 private bool disposed = false;
113 public InstalledApplicationMetadataFilter(IDictionary<string, string> filter)
115 Interop.ApplicationManager.AppInfoMetadataFilterCreate(out _handle);
116 foreach (var item in filter)
118 Interop.ApplicationManager.AppInfoMetadataFilterAdd(_handle, item.Key, item.Value);
122 internal IntPtr Handle
130 ~InstalledApplicationMetadataFilter()
135 public void Dispose()
138 GC.SuppressFinalize(this);
141 private void Dispose(bool disposing)
147 // to be used if there are any other disposable objects
149 if (_handle != IntPtr.Zero)
151 Interop.ApplicationManager.AppInfoMetadataFilterDestroy(_handle);