Example #1
0
        /// <summary>
        /// Try to get the preferred token for a category
        /// </summary>
        private static ObjectToken GetPreference(string category, string defaultLocation)
        {
            ObjectToken token = null;

            using (ObjectTokenCategory tokenCategory = ObjectTokenCategory.Create(category))
            {
                if (tokenCategory != null)
                {
                    string sToken;
                    if (tokenCategory.TryGetString(defaultLocation, out sToken))
                    {
                        token = tokenCategory.OpenToken(sToken);
                    }
                }
            }
            return(token);
        }
Example #2
0
        private static ObjectToken GetPreference(string category, string defaultLocation)
        {
            ObjectToken result = null;

            using (ObjectTokenCategory objectTokenCategory = ObjectTokenCategory.Create(category))
            {
                if (objectTokenCategory == null)
                {
                    return(result);
                }
                string value;
                if (objectTokenCategory.TryGetString(defaultLocation, out value))
                {
                    return(objectTokenCategory.OpenToken(value));
                }
                return(result);
            }
        }