コード例 #1
0
        internal static T GetNativeObject <T>(object obj, string objName)
            where T : class
        {
            if (typeof(T) != typeof(UIViewController) && obj == null)
            {
                return(null);
            }

            return(TargetFactory.GetNativeObject(obj, objName, typeof(T)) as T);
        }
コード例 #2
0
ファイル: WpfFactory.cs プロジェクト: chencai01/iFactr-WPF
        internal static T GetNativeObject <T>(object obj, string objName, bool allowNull)
            where T : class
        {
            if (allowNull && obj == null)
            {
                return(null);
            }

            obj = TargetFactory.GetNativeObject(obj, objName, typeof(T), typeof(ISealedElement));
            var seal = obj as ISealedElement;

            if (seal != null)
            {
                return(seal.Element as T);
            }
            return(obj as T);
        }