예제 #1
0
        public virtual IBrowserWindow GetOrCreateBrowserWindow(IApplication application)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }

            var applicationId = application.Id;

            if (string.IsNullOrEmpty(applicationId))
            {
                throw new ArgumentNullException("application.Id");
            }

            lock (_lockObject)
            {
                if (!_browserWindows.ContainsKey(applicationId))
                {
                    var model = new BrowserViewModel()
                    {
                        Application = application, Session = Session
                    };

                    _uiHelper.PerformInUiThread(() =>
                    {
                        var browserWindow = _browserWindowsBuilder.CreateBrowserWindow(model);
                        _browserWindows[applicationId] = browserWindow;
                    });
                }

                return(_browserWindows[applicationId]);
            }
        }
예제 #2
0
        public void DisplayApplication(IApplication application)
        {
            var browserWindow = _browserWindowsManager.GetOrCreateBrowserWindow(application);

            _uiHelper.PerformInUiThread(() =>
            {
                browserWindow.Display();
            });
        }
예제 #3
0
 protected override void OnCursorChange(CefBrowser browser, IntPtr cursorHandle, CefCursorType type, CefCursorInfo customCursorInfo)
 {
     _uiHelper.PerformInUiThread(() =>
     {
         //Cursor cursor = CursorInteropHelper.Create(new SafeFileHandle(cursorHandle, false));
         //_owner.Cursor = cursor;
     });
 }
예제 #4
0
 protected override void OnCursorChange(CefBrowser browser, IntPtr cursorHandle)
 {
     _uiHelper.PerformInUiThread(() =>
     {
         Cursor cursor = CursorInteropHelper.Create(new SafeFileHandle(cursorHandle, false));
         _owner.Cursor = cursor;
     });
 }
예제 #5
0
        private void ReloadSessions()
        {
            var session = _mainAppClient.GetSession();

            if ((session == null) || (session.Cookies.Count <= 0))
            {
                return;
            }

            _browserWindowsManager.Session = session;

            var apps = _mainAppClient.GetMyApps();

            _browserWindowsManager.Applications = apps;

            _uiHelper.PerformInUiThread(() =>
            {
                foreach (var app in apps)
                {
                    if ((app == null) || string.IsNullOrEmpty(app.UrlString) || _browserWindows.ContainsKey(app.Id))
                    {
                        continue;
                    }

                    var model = new BrowserViewModel()
                    {
                        Application = app, Session = session
                    };

                    var browserWindow       = _browserWindowsBuilder.CreateBrowserWindow(model);
                    _browserWindows[app.Id] = browserWindow;
                }
            });

            foreach (var browserWindow in _browserWindows.Values)
            {
                browserWindow.SetSession(session);
            }
        }
예제 #6
0
 public static void PerformInUiThread(Action action)
 {
     UiHelper.PerformInUiThread(action);
 }