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.Managers
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 private const string LogTag = "Tizen.Applications.Managers";
52 public InstalledApplicationFilter(IDictionary<string, string> filter)
54 ret = Interop.ApplicationManager.AppInfoFilterCreate(out _handle);
57 ApplicationManagerErrorFactory.ExceptionChecker(ret, _handle, "InstalledApplicationFilter creation failed.");
59 foreach (var item in filter)
61 if ((item.Key == Keys.Id) || (item.Key == Keys.Type) || (item.Key == Keys.Category))
63 ret = Interop.ApplicationManager.AppInfoFilterAddString(_handle, item.Key, item.Value);
66 ApplicationManagerErrorFactory.ExceptionChecker(ret, _handle, "InstalledApplicationFilter item add failed.");
69 else if ((item.Key == Keys.NoDisplay) || (item.Key == Keys.TaskManage))
71 ret = Interop.ApplicationManager.AppInfoFilterAddBool(_handle, item.Key, Convert.ToBoolean(item.Value));
74 ApplicationManagerErrorFactory.ExceptionChecker(ret, _handle, "InstalledApplicationFilter item add failed.");
79 Log.Warn(LogTag, "InstalledApplicationFilter is NOT supported " + item.Key + " key.");
84 internal IntPtr Handle
92 ~InstalledApplicationFilter()
100 GC.SuppressFinalize(this);
103 private void Dispose(bool disposing)
109 // to be used if there are any other disposable objects
111 if (_handle != IntPtr.Zero)
113 Interop.ApplicationManager.AppInfoFilterDestroy(_handle);