// // ViewExtensions.cs // // Author: // Stephane Delcroix // // Copyright (c) 2013 Mobile Inception // Copyright (c) 2013 Xamarin, Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Reflection; using System.ComponentModel; using Tizen.NUI.Binding; namespace Tizen.NUI.Xaml { /// /// Extension class for View defining Tizen.NUI.Xaml.Extensions.LoadFromXaml{TView} method. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class Extensions { /// /// Returns an initialized view by loading the specified xaml. /// /// The type of view to initialize with state from XAML. /// The view on which this method operates. /// The type of the caller. /// A TXaml with the properties that are defined in the application manifest for callingType. /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static TXaml LoadFromXaml(this TXaml view, Type callingType) { XamlLoader.Load(view, callingType); return view; } /// /// Returns a TXaml with the properties that are defined in the application manifest for callingType. /// /// The type of view to initialize with state from XAML. /// The view on which this method operates. /// The XAML that encodes the view state. /// A TXaml with the properties that are defined in the application manifest for callingType. /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static TXaml LoadFromXaml(this TXaml view, string xaml) { XamlLoader.Load(view, xaml); return view; } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static T LoadObject(string path) { return XamlLoader.LoadObject(path); } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static TXaml LoadFromXamlFile(this TXaml view, string nameOfXamlFile) { NUILog.Debug($"LoadFromXamlFile(nameOfXamlFile={nameOfXamlFile})"); string xamlScript = XamlLoader.GetXamlForName(nameOfXamlFile); XamlLoader.Load(view, xamlScript); return view; } } }