Example #1
0
 public PreviewPresenter()
 {
     m_view = new PreviewView();
     m_view.SaveClicked += SaveClicked;
     m_view.SizeNormalClicked += m_view_SizeNormalClicked;
     m_view.SizeZoomClicked += m_view_SizeZoomClicked;
 }
Example #2
0
        /// <summary>
        /// Initializes the preview of an asset. This method will invoke the protected virtual method <see cref="Initialize()"/>.
        /// </summary>
        /// <param name="asset">The view model of the asset to preview.</param>
        /// <param name="builder">The preview builder that is initializing this preview.</param>
        /// <returns>A task returning an object that is the view associated to the preview.</returns>
        public async Task <object> Initialize(AssetViewModel asset, IPreviewBuilder builder)
        {
            IsRunning      = true;
            AssetViewModel = asset;
            AssetItem      = asset.AssetItem;
            Builder        = builder;
            Game           = builder.PreviewGame;

            // Copy ColorSpace to Game
            // TODO: Move this code this method and find a better pluggable way to do this.

            var gameSettings = AssetItem.Package.GetGameSettingsAssetOrDefault();

            Game.GraphicsDeviceManager.PreferredColorSpace = DetermineColorSpace();
            Game.GraphicsDeviceManager.ApplyChanges();

            RenderingMode = gameSettings.GetOrCreate <EditorSettings>().RenderingMode;

            await Initialize();

            PreviewViewModel = await ProvideViewModel();

            previewView = await ProvideView();

            FinalizeInitialization();
            return(previewView);
        }
 public PreviewController(BaconModel model, IPreviewView view)
 {
     _model = model;
     _view = view;
 }