public BrowserWindow(BrowserViewModel browserViewModel) { if (browserViewModel == null) { throw new ArgumentNullException("browserViewModel"); } ViewModel = browserViewModel; DataContext = ViewModel; InitializeComponent(); if (browserViewModel.Application != null) { if ((browserViewModel.Session != null) && (browserViewModel.Session.Cookies != null) && (browserViewModel.Session.Cookies.Count > 0) && !string.IsNullOrEmpty(browserViewModel.Application.UrlString)) { browser.StartUrl = browserViewModel.Application.UrlString; _firstTime = false; } if (!string.IsNullOrEmpty(browserViewModel.Application.Name)) { Title = browserViewModel.Application.Name; TitleTextBlock.Text = browserViewModel.Application.Name; } if (browserViewModel.Application.BrowserWidth > 0) { Width = browserViewModel.Application.BrowserWidth; } if (browserViewModel.Application.BrowserHeight > 0) { Height = browserViewModel.Application.BrowserHeight; } } }
public virtual IBrowserWindow GetOrCreateSessionlessWindow(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 (!_browserWindowsWithoutSession.ContainsKey(applicationId)) { var model = new BrowserViewModel() { Application = application, Session = Session }; _uiHelper.PerformInUiThread(() => { var browserWindow = _browserWindowsBuilder.CreateBrowserWindow(model); _browserWindowsWithoutSession[applicationId] = browserWindow; }); } return _browserWindowsWithoutSession[applicationId]; } }
public IBrowserWindow CreateBrowserWindow(BrowserViewModel model) { return(new BrowserWindow(model)); }
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); } }