passing logger down to BrowserWindow

This commit is contained in:
Jonas Sourlier 2022-05-03 08:59:22 +02:00
parent ef63a67aee
commit 91b15eeb98
5 changed files with 10 additions and 7 deletions

View file

@ -192,7 +192,7 @@ namespace SafeExamBrowser.Browser
internal void InitializeWindow()
{
window = uiFactory.CreateBrowserWindow(Control, settings, isMainWindow);
window = uiFactory.CreateBrowserWindow(Control, settings, isMainWindow, this.logger);
window.AddressChanged += Window_AddressChanged;
window.BackwardNavigationRequested += Window_BackwardNavigationRequested;
window.Closed += Window_Closed;

View file

@ -56,7 +56,7 @@ namespace SafeExamBrowser.UserInterface.Contracts
/// <summary>
/// Creates a new browser window loaded with the given browser control and settings.
/// </summary>
IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow);
IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow, ILogger logger);
/// <summary>
/// Creates an exam selection dialog for the given exams.

View file

@ -80,9 +80,9 @@ namespace SafeExamBrowser.UserInterface.Desktop
}
}
public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow)
public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow, ILogger logger)
{
return Application.Current.Dispatcher.Invoke(() => new BrowserWindow(control, settings, isMainWindow, text));
return Application.Current.Dispatcher.Invoke(() => new BrowserWindow(control, settings, isMainWindow, text, logger));
}
public IExamSelectionDialog CreateExamSelectionDialog(IEnumerable<Exam> exams)

View file

@ -80,9 +80,9 @@ namespace SafeExamBrowser.UserInterface.Mobile
}
}
public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow)
public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings, bool isMainWindow, ILogger logger)
{
return Application.Current.Dispatcher.Invoke(() => new BrowserWindow(control, settings, isMainWindow, text));
return Application.Current.Dispatcher.Invoke(() => new BrowserWindow(control, settings, isMainWindow, text, logger));
}
public IExamSelectionDialog CreateExamSelectionDialog(IEnumerable<Exam> exams)

View file

@ -17,6 +17,7 @@ using System.Windows.Media.Imaging;
using SafeExamBrowser.Browser.Contracts.Events;
using SafeExamBrowser.Core.Contracts.Resources.Icons;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Browser;
@ -37,6 +38,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
private WindowClosedEventHandler closed;
private WindowClosingEventHandler closing;
private ILogger logger;
private WindowSettings WindowSettings
{
@ -71,11 +73,12 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
remove { closing -= value; }
}
internal BrowserWindow(IBrowserControl browserControl, BrowserSettings settings, bool isMainWindow, IText text)
internal BrowserWindow(IBrowserControl browserControl, BrowserSettings settings, bool isMainWindow, IText text, ILogger logger)
{
this.isMainWindow = isMainWindow;
this.settings = settings;
this.text = text;
this.logger = logger;
InitializeComponent();
InitializeBrowserWindow(browserControl);