2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Diagnostics.CodeAnalysis;
24 /// This is a wrapper to express tizen-theme-manager's theme.
26 internal class TizenExternalTheme : IExternalTheme
28 private const string prefix = "/theme/";
29 private readonly Tizen.Applications.ThemeManager.Theme theme;
31 internal TizenExternalTheme(Tizen.Applications.ThemeManager.Theme theme)
46 [SuppressMessage("Microsoft.Design", "CA1031: Do not catch general exception types", Justification = "This method is to handle external resources that may throw an exception but ignorable. This method should not interrupt the main stream.")]
47 public string GetValue(string key)
49 string themeKey = prefix + key;
50 string extracted = null;
54 if (theme.HasKey(themeKey))
56 extracted = theme.GetString(themeKey);
61 Tizen.Log.Error("NUI", $"{e.GetType().Name} occurred while getting value from {theme.GetType().FullName}: {e.Message}");