Ejemplo n.º 1
0
        /// <summary>
        /// Performs the given <see cref="IPreviewQuery"/>
        /// </summary>
        /// <param name="query">The query to perform</param>
        public static void GetPreview(IPreviewQuery query)
        {
            if (DualityApp.ExecContext == DualityApp.ExecutionContext.Terminated)
            {
                return;
            }
            if (query == null)
            {
                return;
            }

            // Query all IPreviewGenerator instances that match the specified query
            var generators = (
                from g in previewGenerators
                orderby query.SourceFits(g.ObjectType) descending, g.Priority descending
                select g).ToArray();

            // Iterate over available generators until one can handle the preview query
            foreach (IPreviewGenerator gen in generators)
            {
                if (!query.TransformSource(gen.ObjectType))
                {
                    continue;
                }

                gen.Perform(query);

                if (query.Result != null)
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
		public static void GetPreview(IPreviewQuery query)
		{
			if (DualityApp.ExecContext == DualityApp.ExecutionContext.Terminated) return;
			if (query == null) return;

			// Query all IPreviewGenerator instances that match the specified query
			var generators = (
				from g in previewGenerators
				orderby query.SourceFits(g.ObjectType) descending, g.Priority descending
				select g).ToArray();

			// Iterate over available generators until one can handle the preview query
			foreach (IPreviewGenerator gen in generators)
			{
				if (!query.TransformSource(gen.ObjectType)) continue;

				gen.Perform(query);

				if (query.Result != null) break;
			}
		}
Ejemplo n.º 3
0
        public static void GetPreview(IPreviewQuery query)
        {
            if (DualityApp.ExecContext == DualityApp.ExecutionContext.Terminated)
            {
                return;
            }
            if (query == null)
            {
                return;
            }

            //System.Diagnostics.Stopwatch w = new System.Diagnostics.Stopwatch();
            //w.Restart();

            var generators = (
                from g in CorePluginRegistry.GetPreviewGenerators()
                orderby query.SourceFits(g.ObjectType) descending, g.Priority descending
                select g).ToArray();

            foreach (IPreviewGenerator gen in generators)
            {
                if (!query.TransformSource(gen.ObjectType))
                {
                    continue;
                }

                gen.Perform(query);

                if (query.Result != null)
                {
                    break;
                }
            }

            //Log.Editor.Write("Generating preview for {0} / {1} took {2:F} ms", query.OriginalSource, query.GetType().Name, w.Elapsed.TotalMilliseconds);
        }