コード例 #1
0
ファイル: Toolkit.cs プロジェクト: inorton/xwt
        internal static Toolkit Load(string fullTypeName, bool isGuest)
        {
            Toolkit t = new Toolkit();

            if (!string.IsNullOrEmpty(fullTypeName))
            {
                t.LoadBackend(fullTypeName, isGuest, true);
                return(t);
            }

            if (t.LoadBackend(GetBackendType(ToolkitType.Gtk), isGuest, false))
            {
                return(t);
            }

            if (t.LoadBackend(GetBackendType(ToolkitType.Cocoa), isGuest, false))
            {
                return(t);
            }

            if (t.LoadBackend(GetBackendType(ToolkitType.Wpf), isGuest, false))
            {
                return(t);
            }

            throw new InvalidOperationException("Xwt engine not found");
        }
コード例 #2
0
ファイル: Toolkit.cs プロジェクト: wwwK/dotdevelop-xwt
        /// <summary>
        /// Load toolkit identified by its full type name.
        /// </summary>
        /// <param name="fullTypeName">The <see cref="Type.FullName"/> of the toolkit type.</param>
        /// <param name="isGuest">If set to <c>true</c> the toolkit is loaded as guest of another toolkit.</param>
        internal static Toolkit Load(string fullTypeName, bool isGuest)
        {
            Toolkit t = new Toolkit();

            if (!string.IsNullOrEmpty(fullTypeName))
            {
                t.LoadBackend(fullTypeName, isGuest, true);
                var bk = knownBackends.FirstOrDefault(tk => fullTypeName.StartsWith(tk.TypeName));
                if (bk != null)
                {
                    t.Type = bk.Type;
                }
                return(t);
            }

            foreach (var bk in knownBackends)
            {
                if (t.LoadBackend(bk.FullTypeName, isGuest, false))
                {
                    t.Type = bk.Type;
                    return(t);
                }
            }

            throw new InvalidOperationException("Xwt engine not found");
        }
コード例 #3
0
ファイル: Toolkit.cs プロジェクト: git-thinh/limada
		/// <summary>
		/// Load a toolkit of a specified type.
		/// </summary>
		/// <param name="type">The toolkit type.</param>
		public static Toolkit Load (ToolkitType type)
		{
			var et = toolkits.Values.FirstOrDefault (tk => tk.toolkitType == type);
			if (et != null)
				return et;

			Toolkit t = new Toolkit ();
			t.toolkitType = type;
			t.LoadBackend (GetBackendType (type), true, true);
			return t;
		}
コード例 #4
0
ファイル: Toolkit.cs プロジェクト: git-thinh/limada
		/// <summary>
		/// Tries to load a toolkit
		/// </summary>
		/// <returns><c>true</c>, the toolkit has been loaded, <c>false</c> otherwise.</returns>
		/// <param name="type">Toolkit type</param>
		/// <param name="toolkit">The loaded toolkit</param>
		public static bool TryLoad (ToolkitType type, out Toolkit toolkit)
		{
			var et = toolkits.Values.FirstOrDefault (tk => tk.toolkitType == type);
			if (et != null) {
				toolkit = et;
				return true;
			}

			Toolkit t = new Toolkit ();
			t.toolkitType = type;
			if (t.LoadBackend (GetBackendType (type), true, false)) {
				toolkit = t;
				return true;
			}
			toolkit = null;
			return false;
		}