Minor refactoring (renamed UI factory).

This commit is contained in:
dbuechel 2017-07-27 14:45:54 +02:00
parent 8c32d3bc4a
commit 9125b41361
13 changed files with 24 additions and 24 deletions

View file

@ -21,9 +21,9 @@ namespace SafeExamBrowser.Browser
private ITaskbarButton button;
private IList<IApplicationInstance> instances = new List<IApplicationInstance>();
private ISettings settings;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
public BrowserApplicationController(ISettings settings, IUiElementFactory uiFactory)
public BrowserApplicationController(ISettings settings, IUserInterfaceFactory uiFactory)
{
this.settings = settings;
this.uiFactory = uiFactory;

View file

@ -92,7 +92,7 @@
<Compile Include="I18n\ITextResource.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserInterface\ITaskbarButton.cs" />
<Compile Include="UserInterface\IUiElementFactory.cs" />
<Compile Include="UserInterface\IUserInterfaceFactory.cs" />
<Compile Include="UserInterface\IWindow.cs" />
<Compile Include="UserInterface\MessageBoxAction.cs" />
<Compile Include="UserInterface\MessageBoxIcon.cs" />

View file

@ -11,7 +11,7 @@ using SafeExamBrowser.Contracts.I18n;
namespace SafeExamBrowser.Contracts.UserInterface
{
public interface IUiElementFactory : IMessageBox
public interface IUserInterfaceFactory : IMessageBox
{
/// <summary>
/// Creates a taskbar button, initialized with the given application information.

View file

@ -24,7 +24,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour
private Mock<ILogger> loggerMock;
private Mock<ISettings> settingsMock;
private Mock<IText> textMock;
private Mock<IUiElementFactory> uiFactoryMock;
private Mock<IUserInterfaceFactory> uiFactoryMock;
private IShutdownController sut;
@ -34,7 +34,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour
loggerMock = new Mock<ILogger>();
settingsMock = new Mock<ISettings>();
textMock = new Mock<IText>();
uiFactoryMock = new Mock<IUiElementFactory>();
uiFactoryMock = new Mock<IUserInterfaceFactory>();
uiFactoryMock.Setup(f => f.CreateSplashScreen(settingsMock.Object, textMock.Object)).Returns(new Mock<ISplashScreen>().Object);

View file

@ -25,7 +25,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour
private Mock<ILogger> loggerMock;
private Mock<ISettings> settingsMock;
private Mock<IText> textMock;
private Mock<IUiElementFactory> uiFactoryMock;
private Mock<IUserInterfaceFactory> uiFactoryMock;
private IStartupController sut;
@ -35,7 +35,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour
loggerMock = new Mock<ILogger>();
settingsMock = new Mock<ISettings>();
textMock = new Mock<IText>();
uiFactoryMock = new Mock<IUiElementFactory>();
uiFactoryMock = new Mock<IUserInterfaceFactory>();
uiFactoryMock.Setup(f => f.CreateSplashScreen(settingsMock.Object, textMock.Object)).Returns(new Mock<ISplashScreen>().Object);

View file

@ -20,7 +20,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations
private IApplicationInfo browserInfo;
private ILogger logger;
private ITaskbar taskbar;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
public ISplashScreen SplashScreen { private get; set; }
@ -29,7 +29,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations
IApplicationInfo browserInfo,
ILogger logger,
ITaskbar taskbar,
IUiElementFactory uiFactory)
IUserInterfaceFactory uiFactory)
{
this.browserController = browserController;
this.browserInfo = browserInfo;

View file

@ -18,12 +18,12 @@ namespace SafeExamBrowser.Core.Behaviour.Operations
{
private ILogger logger;
private ITaskbar taskbar;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
private INotificationInfo aboutInfo;
public ISplashScreen SplashScreen { private get; set; }
public TaskbarOperation(ILogger logger, INotificationInfo aboutInfo, ITaskbar taskbar, IUiElementFactory uiFactory)
public TaskbarOperation(ILogger logger, INotificationInfo aboutInfo, ITaskbar taskbar, IUserInterfaceFactory uiFactory)
{
this.logger = logger;
this.aboutInfo = aboutInfo;

View file

@ -23,9 +23,9 @@ namespace SafeExamBrowser.Core.Behaviour
private ISettings settings;
private ISplashScreen splashScreen;
private IText text;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
public ShutdownController(ILogger logger, ISettings settings, IText text, IUiElementFactory uiFactory)
public ShutdownController(ILogger logger, ISettings settings, IText text, IUserInterfaceFactory uiFactory)
{
this.logger = logger;
this.settings = settings;

View file

@ -24,11 +24,11 @@ namespace SafeExamBrowser.Core.Behaviour
private ISettings settings;
private ISplashScreen splashScreen;
private IText text;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
private Stack<IOperation> stack = new Stack<IOperation>();
public StartupController(ILogger logger, ISettings settings, IText text, IUiElementFactory uiFactory)
public StartupController(ILogger logger, ISettings settings, IText text, IUserInterfaceFactory uiFactory)
{
this.logger = logger;
this.settings = settings;

View file

@ -104,7 +104,7 @@
<Compile Include="Taskbar.xaml.cs">
<DependentUpon>Taskbar.xaml</DependentUpon>
</Compile>
<Compile Include="UiElementFactory.cs" />
<Compile Include="UserInterfaceFactory.cs" />
<Compile Include="Utilities\IconResourceLoader.cs" />
<Compile Include="ViewModels\DateTimeViewModel.cs" />
<Compile Include="ViewModels\SplashScreenViewModel.cs" />

View file

@ -15,7 +15,7 @@ using SafeExamBrowser.UserInterface.Controls;
namespace SafeExamBrowser.UserInterface
{
public class UiElementFactory : IUiElementFactory
public class UserInterfaceFactory : IUserInterfaceFactory
{
public ITaskbarButton CreateApplicationButton(IApplicationInfo info)
{

View file

@ -128,8 +128,8 @@ namespace SafeExamBrowser.WindowsApi
var handle = User32.SetWinEventHook(Constant.EVENT_SYSTEM_FOREGROUND, Constant.EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, eventProc, 0, 0, Constant.WINEVENT_OUTOFCONTEXT);
// IMORTANT:
// Ensures that the callback does not get garbage collected prematurely, as it will be passed to unmanaged code!
// Not doing so will result in a <c>CallbackOnCollectedDelegate</c> error and subsequent application crash.
// Ensures that the callback does not get garbage collected prematurely, as it will be passed to unmanaged code.
// Not doing so will result in a <c>CallbackOnCollectedDelegate</c> error and subsequent application crash!
EventDelegates[handle] = eventProc;
return handle;
@ -145,8 +145,8 @@ namespace SafeExamBrowser.WindowsApi
var handle = User32.SetWinEventHook(Constant.EVENT_SYSTEM_CAPTURESTART, Constant.EVENT_SYSTEM_CAPTURESTART, IntPtr.Zero, eventProc, 0, 0, Constant.WINEVENT_OUTOFCONTEXT);
// IMORTANT:
// Ensures that the callback does not get garbage collected prematurely, as it will be passed to unmanaged code!
// Not doing so will result in a <c>CallbackOnCollectedDelegate</c> error and subsequent application crash.
// Ensures that the callback does not get garbage collected prematurely, as it will be passed to unmanaged code.
// Not doing so will result in a <c>CallbackOnCollectedDelegate</c> error and subsequent application crash!
EventDelegates[handle] = eventProc;
return handle;

View file

@ -39,7 +39,7 @@ namespace SafeExamBrowser
private ISettings settings;
private IText text;
private ITextResource textResource;
private IUiElementFactory uiFactory;
private IUserInterfaceFactory uiFactory;
private IWindowMonitor windowMonitor;
private IWorkingArea workingArea;
@ -56,7 +56,7 @@ namespace SafeExamBrowser
settings = new Settings();
Taskbar = new Taskbar();
textResource = new XmlTextResource();
uiFactory = new UiElementFactory();
uiFactory = new UserInterfaceFactory();
logger.Subscribe(new LogFileWriter(settings));