[NUI] Remove unused property of Transition
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Theme / TizenExternalTheme.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.Diagnostics.CodeAnalysis;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// This is a wrapper to express tizen-theme-manager's theme.
25     /// </summary>
26     internal class TizenExternalTheme : IExternalTheme
27     {
28         private const string prefix = "/theme/";
29         private readonly Tizen.Applications.ThemeManager.Theme theme;
30
31         internal TizenExternalTheme(Tizen.Applications.ThemeManager.Theme theme)
32         {
33             this.theme = theme;
34         }
35
36         public string Id
37         {
38             get => theme.Id;
39         }
40
41         public string Version
42         {
43             get => theme.Version;
44         }
45
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)
48         {
49             string themeKey = prefix + key;
50             string extracted = null;
51
52             try
53             {
54                 if (theme.HasKey(themeKey))
55                 {
56                     extracted = theme.GetString(themeKey);
57                 }
58             }
59             catch (Exception e)
60             {
61                 Tizen.Log.Error("NUI", $"{e.GetType().Name} occurred while getting value from {theme.GetType().FullName}: {e.Message}");
62             }
63
64             return extracted;
65         }
66     }
67 }