/// <summary>
        /// Loads a new XNA asset file into the ModelViewerControl.
        /// </summary>
        public AssetType LoadFile(string fileName, XnaBuildProperties buildProperties)
        {
            if (!_loaded)
            {
                return(AssetType.None);
            }

            // Unload any existing content.
            graphicsDeviceControl.AssetRenderer = null;
            AssetHandler assetHandler = _assetHandlers.GetAssetHandler(fileName);

            assetHandler.ResetRenderer();

            windowsFormsHost.Visibility = Visibility.Collapsed;
            txtInfo.Text       = "Loading...";
            txtInfo.Visibility = Visibility.Visible;

            // Load asynchronously.
            var           ui       = TaskScheduler.FromCurrentSynchronizationContext();
            Task <string> loadTask = new Task <string>(() =>
            {
                _contentManager.Unload();

                // Tell the ContentBuilder what to build.
                _contentBuilder.Clear();
                _contentBuilder.SetReferences(buildProperties.ProjectReferences);

                string assetName = fileName;
                foreach (char c in Path.GetInvalidFileNameChars())
                {
                    assetName = assetName.Replace(c.ToString(), string.Empty);
                }
                assetName = Path.GetFileNameWithoutExtension(assetName);
                _contentBuilder.Add(fileName, assetName, buildProperties.Importer,
                                    buildProperties.Processor ?? assetHandler.ProcessorName,
                                    buildProperties.ProcessorParameters);

                // Build this new model data.
                string buildErrorInternal = _contentBuilder.Build();

                if (string.IsNullOrEmpty(buildErrorInternal))
                {
                    // If the build succeeded, use the ContentManager to
                    // load the temporary .xnb file that we just created.
                    assetHandler.LoadContent(assetName);

                    graphicsDeviceControl.AssetRenderer = assetHandler.Renderer;
                }

                return(buildErrorInternal);
            });

            loadTask.ContinueWith(t =>
            {
                string buildError = t.Result;
                if (!string.IsNullOrEmpty(buildError))
                {
                    // If the build failed, display an error message.
                    txtInfo.Text = "Uh-oh. Something went wrong. Check the Output window for details.";
                    XBuilderWindowPane.WriteLine(buildError);
                }
                else
                {
                    windowsFormsHost.Visibility = Visibility.Visible;
                    txtInfo.Visibility          = Visibility.Hidden;
                }
            }, ui);

            loadTask.Start();

            return(_assetHandlers.GetAssetType(fileName));
        }