单个文件中的Awesomium .Net- flash未加载

时间:2015-02-22 11:55:36

标签: .net flash awesomium

我正在尝试在awesomium的.NET版本中启用Flash。但该应用程序称它已被禁用。我无法在API中找到任何启​​用标志。我错过了什么

我拥有的插件是这样的: 文件夹/Users/daka/plugins/

中的 Flash Player.plugin

enter image description here

/********************************************************************************
 *    Project   : Awesomium.NET (MonoMac - SingleFileSample)
 *    File      : Main.cs
 *    Version   : 1.7.0.0 
 *    Date      : 6/5/2013
 *    Author    : Perikles C. Stephanidis (perikles@awesomium.com)
 *    Copyright : ©2013 Awesomium Technologies LLC
 *    
 *    This code is provided "AS IS" and for demonstration purposes only,
 *    without warranty of any kind.
 *    
 *-------------------------------------------------------------------------------
 *
 *    Notes     :
 *
 *    Single file sample that demonstrates creating a simple MonoMac
 *    application that uses Awesomium, using only code.
 *    
 *    
 ********************************************************************************/

using System;
using Awesomium.Mono.Mac;
using MonoMac.AppKit;
using MonoMac.Foundation;
using Awesomium.Core;
using System.IO;
using System.Drawing;

namespace SingleFileSample
{
    public class MainClass
    {
        static void Main( string [] args )
        {
            // Initialize an OSMApplication (NSApplication subclass). 
            // This will perform registrations, runtime and NSApplication 
            // initialization and other crucial operations. It should always 
            // be called before anything else in applications using Awesomium.
            OSMApplication.Init();

            // Get a path to store our log file.
            string logsPath = String.Format( 
                @"{0}/Library/Logs/",
                Environment.GetFolderPath( Environment.SpecialFolder.Personal ) );

            // Specify some WebCore configuration settings.
            WebConfig config = new WebConfig() { HomeURL = "http://play.MYURL.com".ToUri(),PluginsPath = "/Users/daka/plugins/" };

            if( Directory.Exists( logsPath ) )
            {
                // If we have a valid Logs path, set it as 
                // the target for Awesomium's log file.
                config.LogPath = logsPath + "awesomium.log";
                config.LogLevel = LogLevel.Verbose;
            }

            // Initialize the WebCore with our configuration settings.
            // This performs lazy initialization but it should be called
            // before we create any WebSession or views.
            WebCore.Initialize( config );
            // Create a WebSession with some custom preferences.
            // These apply to all views assigned to this session.
            using( WebSession session = WebCore.CreateWebSession( new WebPreferences() { SmoothScrolling = true } ) )
            {
                // Create our OSMWebView, and assign it to our session.
                using( OSMWebView webView = OSMWebView.Create( session ) )
                {
                    // Create the application's main window.
                    using( NSWindow window = new NSWindow( 
                        new RectangleF( 0, 0, 1100, 620 ), 
                        NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled, NSBackingStore.Buffered, 
                        false ) )

                    {
                        // Center window on screen.
                        window.Center();
                        // Bind the window's title to OSMWebView's title.
                        window.Bind( "title", webView, "title", null );
                        // Add our OSMWebView to the Window's content view.
                        // OSMWebView is set to automatically resize to fit
                        // the container (AutoresizingMask).
                        window.ContentView.AddSubview( webView );
                        // Activate the window.
                        window.MakeKeyAndOrderFront( null );
                        // Navigate to the specified Home URL.
                        webView.GoToHome();
                        // Create our application's delegate.
                        using ( AppDelegate @delegate = new AppDelegate() )
                        {
                            // Assign the delegate.
                            OSMApplication.SharedApplication.Delegate = @delegate;
                            // The point of no return. Execute the application.
                            OSMApplication.Main( args );
                        }
                    }
                }
            }
        }
    }

    [Register ("AppDelegate")]
    public class AppDelegate : NSApplicationDelegate
    {
        public override bool ApplicationShouldTerminateAfterLastWindowClosed( NSApplication sender )
        {
            return true;
        }

        public override void WillTerminate(NSNotification notification)
        {
            if( WebCore.IsInitialized )
                // Shutdown the WebCore when exiting the application.
                WebCore.Shutdown();
        }
    }
}

1 个答案:

答案 0 :(得分:0)

it's a bit late but I wanted to share my solution to the same question asked here:

I have an .SWF file running in WebControl through the following changes:

WebCore.Initialize(new WebConfig
{
  PluginsPath = @".\BrowserApp\bin\Debug\plugins"
});

And in this folder I've copied the dll: NPSWF32.dll that I've found somewhere on my system.