예제 #1
0
        public MainViewImpl(DemoApp application, MenuItem[] menuItems)
        {
            _pUIThread = WindowsFormsSynchronizationContext.Current;

            _application = application;
            CreateMenu(menuItems);

            _applicationTitle = _application.Name + " (Windows Forms)";
            Text = _applicationTitle;
            Size = new Size(_application.DefaultWidth, _application.DefaultHeight);

            Padding = new Padding(0, 0, 0, 0);

            _tabs        = new TabControl();
            _tabs.Parent = this;
            _tabs.Margin = new Padding(10, 10, 10, 10);
            _tabs.Dock   = DockStyle.Fill;

            _tabs.Appearance = TabAppearance.Normal;
            _tabs.Padding    = new Point(6, 6);

            if (MainMenuStrip != null)
            {
                Controls.Add(MainMenuStrip);
            }

            Visible = true;
        }
예제 #2
0
        public MainViewImpl(DemoApp application, MenuItem[] menuItems)
            : base(WindowType.Toplevel)
        {
            _application = application;
            var menuBar = CreateMenu(menuItems);

            _applicationTitle = _application.Name + " (GtkSharp)";
            Title = _applicationTitle;
            Resize(_application.DefaultWidth, _application.DefaultHeight);

            Destroyed += MainViewImpl_Destroyed;

            var vbox = new VBox(false, 0);
            Add(vbox);

            vbox.PackStart(menuBar, false, false, 2);

            _tabs = new Notebook();
            vbox.PackEnd(_tabs, true, true, 2);

            ShowAll();
        }
예제 #3
0
        public MainViewImpl(DemoApp application, MenuItem[] menuItems)
            : base(WindowType.Toplevel)
        {
            _application = application;
            var menuBar = CreateMenu(menuItems);

            _applicationTitle = _application.Name + " (GtkSharp)";
            Title             = _applicationTitle;
            Resize(_application.DefaultWidth, _application.DefaultHeight);

            Destroyed += MainViewImpl_Destroyed;

            var vbox = new VBox(false, 0);

            Add(vbox);

            vbox.PackStart(menuBar, false, false, 2);

            _tabs = new Notebook();
            vbox.PackEnd(_tabs, true, true, 2);

            ShowAll();
        }
예제 #4
0
        public MainViewImpl(DemoApp application, MenuItem[] menuItems)
        {
            _pUIThread = WindowsFormsSynchronizationContext.Current;

            _application = application;
            CreateMenu(menuItems);

            _applicationTitle = _application.Name + " (Windows Forms)";
            Text = _applicationTitle;
            Size = new Size(_application.DefaultWidth, _application.DefaultHeight);

            Padding = new Padding(0, 0, 0, 0);

            _tabs = new TabControl();
            _tabs.Parent = this;
            _tabs.Margin = new Padding(10, 10, 10, 10);
            _tabs.Dock = DockStyle.Fill;

            _tabs.Appearance = TabAppearance.Normal;
            _tabs.Padding = new Point(6, 6);

            Visible = true;
        }
예제 #5
0
        private void Load(string[] args)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                Debug.LogException(ex);
                return;
            }
            catch (CefRuntimeException ex)
            {
                Debug.LogException(ex);
                return;
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                return;
            }

            var mainArgs = new CefMainArgs(args);
            var app      = new DemoApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, app, IntPtr.Zero);

            if (exitCode != -1)
            {
                Debug.LogErrorFormat("ExitCode={0}", exitCode);
                return;
            }

            string codeBase = Assembly.GetExecutingAssembly().CodeBase;

            Debug.LogFormat("codeBase: {0}", codeBase);

            string localFolder = Path.GetDirectoryName(new Uri(codeBase).LocalPath);

            Debug.LogFormat("localFolder: {0}", localFolder);

            string browserProcessPath = CombinePaths(localFolder, "..", "..", "..",
                                                     "CefGlue.Demo.WinForms", "bin", "Release", "Xilium.CefGlue.Demo.WinForms.exe");

            Debug.LogFormat("browserProcessPath: {0}", browserProcessPath);

            CefSettings settings = new CefSettings
            {
                BrowserSubprocessPath    = browserProcessPath,
                SingleProcess            = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Disable,
                LogFile     = "CefGlue.log",
            };

            CefRuntime.Initialize(mainArgs, settings, app, IntPtr.Zero);

            if (!settings.MultiThreadedMessageLoop)
            {
                _mDoUpdates = true;
            }

            string url = "https://www.youtube.com/watch?v=qjb1oZk3mNM";

            _mCore          = new WebBrowser(this, new CefBrowserSettings(), url);
            _mCore.Created += new EventHandler(BrowserCreated);
            _mCore.StartUrl = url;

            var windowInfo = CefWindowInfo.Create();

            windowInfo.Name = url;
            _mCore.Create(windowInfo);

            Debug.Log("Load: Done");
        }