Esempio n. 1
0
        private static bool TryGetRuntimeInfoValue <T>(RuntimeInfoKey key, out T value)
        {
            value = default(T);

            if (!RuntimeInfo.Is <T>(key))
            {
                Log.Error(InformationErrorFactory.LogTag, "Invalid return type");
                return(false);
            }

            return(RuntimeInfo.TryGetValue <T>(key, out value));
        }
Esempio n. 2
0
        /// <summary>
        /// Unregisters a change event callback for given runtime feature key.
        /// </summary>
        /// <remarks>
        /// This function is only for runtime feature.
        /// </remarks>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="key">The name of runtime feature which wants to unregister callback.</param>
        /// <param name="callback">The callback function to unsubscribe.</param>
        /// <exception cref="ArgumentException">Thrown when the <paramref name="key"/> is invalid.</exception>
        /// <exception cref="NotSupportedException">Thrown when the feature related <paramref name="key"/> is not supported.</exception>
        public static void UnsetCallback(string key, EventHandler <RuntimeFeatureStatusChangedEventArgs> callback)
        {
            RuntimeInfoKey runtimeFeature;

            if (!ConvertStringToRuntimeInfoKey(key, out runtimeFeature))
            {
                Log.Error(InformationErrorFactory.LogTag, "Invalid key");
                InformationErrorFactory.ThrowException(InformationError.InvalidParameter);
            }

            RuntimeInfo.UnsetCallback(runtimeFeature, callback);
        }