Пример #1
0
        public TimelineControl()
        {
            InitializeComponent();

            if (DesignMode)
            {
                this.BackColor = Color.Black;
            }
            else
            {

                InitializeCef();

                webBrowser = new ChromiumWebBrowser(path)
                {
                    Dock = DockStyle.Fill
                };
                this.Controls.Add(webBrowser);
                webBrowser.SendToBack();

                webBrowser.MenuHandler = new ChromiumBrowserHandlers.MenuHandler();
                var keyboardHandler = new ChromiumBrowserHandlers.KeyboardHandler();
                keyboardHandler.KeyCommand += webBrowser_KeyCommand;
                webBrowser.KeyboardHandler = keyboardHandler;

                webBrowser.ConsoleMessage += webBrowser_ConsoleMessage;
                webBrowser.LoadError += webBrowser_LoadError;

                webBrowser.BrowserSettings.JavaScriptAccessClipboardDisabled = false;
                webBrowser.BrowserSettings.JavaScriptCloseWindowsDisabled = true;
                webBrowser.BrowserSettings.JavaScriptOpenWindowsDisabled = true;

                scriptObj = new TimelineScriptingObject(null);
                scriptObj.DOMReady += scriptObj_DOMReady;
                scriptObj.ModelUpdated += new EventHandler(scriptObj_ModelUpdated);
                scriptObj.BeginPlayback += new EventHandler(scriptObj_BeginPlayback);
                scriptObj.PausePlayback += new EventHandler(scriptObj_PausePlayback);
                scriptObj.StopPlayback += new EventHandler(scriptObj_StopPlayback);

                webBrowser.RegisterJsObject("external", scriptObj);
            }
        }
Пример #2
0
        public TimelineControl()
        {
            InitializeComponent();

            if (DesignMode)
            {
                this.BackColor = Color.Black;
            }
            else
            {
                InitializeCef();

                webBrowser = new ChromiumWebBrowser(path)
                {
                    Dock = DockStyle.Fill
                };
                this.Controls.Add(webBrowser);
                webBrowser.SendToBack();

                webBrowser.MenuHandler = new ChromiumBrowserHandlers.MenuHandler();
                var keyboardHandler = new ChromiumBrowserHandlers.KeyboardHandler();
                keyboardHandler.KeyCommand += webBrowser_KeyCommand;
                webBrowser.KeyboardHandler  = keyboardHandler;

                webBrowser.ConsoleMessage += webBrowser_ConsoleMessage;
                webBrowser.LoadError      += webBrowser_LoadError;

                webBrowser.BrowserSettings.JavaScriptAccessClipboardDisabled = false;
                webBrowser.BrowserSettings.JavaScriptCloseWindowsDisabled    = true;
                webBrowser.BrowserSettings.JavaScriptOpenWindowsDisabled     = true;

                scriptObj                = new TimelineScriptingObject(null);
                scriptObj.DOMReady      += scriptObj_DOMReady;
                scriptObj.ModelUpdated  += new EventHandler(scriptObj_ModelUpdated);
                scriptObj.BeginPlayback += new EventHandler(scriptObj_BeginPlayback);
                scriptObj.PausePlayback += new EventHandler(scriptObj_PausePlayback);
                scriptObj.StopPlayback  += new EventHandler(scriptObj_StopPlayback);

                webBrowser.RegisterJsObject("external", scriptObj);
            }
        }