Renamed events and event handlers according to C# naming convention.

This commit is contained in:
dbuechel 2017-08-02 08:31:12 +02:00
parent 7c3fddd060
commit 75f104f136
18 changed files with 51 additions and 51 deletions

View file

@ -52,7 +52,7 @@ namespace SafeExamBrowser.Browser
public void RegisterApplicationButton(ITaskbarButton button) public void RegisterApplicationButton(ITaskbarButton button)
{ {
this.button = button; this.button = button;
this.button.OnClick += Button_OnClick; this.button.Clicked += Button_OnClick;
} }
public void Terminate() public void Terminate()

View file

@ -23,7 +23,7 @@ namespace SafeExamBrowser.Browser
public string Name { get; private set; } public string Name { get; private set; }
public IWindow Window { get { return window; } } public IWindow Window { get { return window; } }
public event TerminationEventHandler Terminated; public event TerminatedEventHandler Terminated;
public event NameChangedEventHandler NameChanged; public event NameChangedEventHandler NameChanged;
public BrowserApplicationInstance(IBrowserSettings settings, IText text, IUserInterfaceFactory uiFactory, bool isMainInstance) public BrowserApplicationInstance(IBrowserSettings settings, IText text, IUserInterfaceFactory uiFactory, bool isMainInstance)

View file

@ -16,18 +16,18 @@ namespace SafeExamBrowser.Browser
{ {
class BrowserControl : ChromiumWebBrowser, IBrowserControl class BrowserControl : ChromiumWebBrowser, IBrowserControl
{ {
private AddressChangedHandler addressChanged; private AddressChangedEventHandler addressChanged;
private IBrowserSettings settings; private IBrowserSettings settings;
private TitleChangedHandler titleChanged; private TitleChangedEventHandler titleChanged;
private IText text; private IText text;
event AddressChangedHandler IBrowserControl.AddressChanged event AddressChangedEventHandler IBrowserControl.AddressChanged
{ {
add { addressChanged += value; } add { addressChanged += value; }
remove { addressChanged -= value; } remove { addressChanged -= value; }
} }
event TitleChangedHandler IBrowserControl.TitleChanged event TitleChangedEventHandler IBrowserControl.TitleChanged
{ {
add { titleChanged += value; } add { titleChanged += value; }
remove { titleChanged -= value; } remove { titleChanged -= value; }

View file

@ -11,7 +11,7 @@ using SafeExamBrowser.Contracts.UserInterface;
namespace SafeExamBrowser.Contracts.Configuration namespace SafeExamBrowser.Contracts.Configuration
{ {
public delegate void TerminationEventHandler(Guid id); public delegate void TerminatedEventHandler(Guid id);
public delegate void NameChangedEventHandler(string name); public delegate void NameChangedEventHandler(string name);
public interface IApplicationInstance public interface IApplicationInstance
@ -29,7 +29,7 @@ namespace SafeExamBrowser.Contracts.Configuration
/// <summary> /// <summary>
/// Event fired when the application instance has been terminated. /// Event fired when the application instance has been terminated.
/// </summary> /// </summary>
event TerminationEventHandler Terminated; event TerminatedEventHandler Terminated;
/// <summary> /// <summary>
/// Event fired when the name or (document) title of the application instance has changed. /// Event fired when the name or (document) title of the application instance has changed.

View file

@ -10,7 +10,7 @@ using System;
namespace SafeExamBrowser.Contracts.Monitoring namespace SafeExamBrowser.Contracts.Monitoring
{ {
public delegate void ExplorerStartedHandler(); public delegate void ExplorerStartedEventHandler();
public interface IProcessMonitor public interface IProcessMonitor
{ {
@ -18,7 +18,7 @@ namespace SafeExamBrowser.Contracts.Monitoring
/// Event fired when the process monitor observes that a new instance of /// Event fired when the process monitor observes that a new instance of
/// the Windows explorer has been started. /// the Windows explorer has been started.
/// </summary> /// </summary>
event ExplorerStartedHandler ExplorerStarted; event ExplorerStartedEventHandler ExplorerStarted;
/// <summary> /// <summary>
/// Performs a check whether the process associated to the given window is allowed. /// Performs a check whether the process associated to the given window is allowed.

View file

@ -10,14 +10,14 @@ using System;
namespace SafeExamBrowser.Contracts.Monitoring namespace SafeExamBrowser.Contracts.Monitoring
{ {
public delegate void WindowChangedHandler(IntPtr window); public delegate void WindowChangedEventHandler(IntPtr window);
public interface IWindowMonitor public interface IWindowMonitor
{ {
/// <summary> /// <summary>
/// Event fired when the window monitor observes that the foreground window has changed. /// Event fired when the window monitor observes that the foreground window has changed.
/// </summary> /// </summary>
event WindowChangedHandler WindowChanged; event WindowChangedEventHandler WindowChanged;
/// <summary> /// <summary>
/// Forcefully closes the specified window. /// Forcefully closes the specified window.

View file

@ -8,20 +8,20 @@
namespace SafeExamBrowser.Contracts.UserInterface namespace SafeExamBrowser.Contracts.UserInterface
{ {
public delegate void AddressChangedHandler(string address); public delegate void AddressChangedEventHandler(string address);
public delegate void TitleChangedHandler(string title); public delegate void TitleChangedEventHandler(string title);
public interface IBrowserControl public interface IBrowserControl
{ {
/// <summary> /// <summary>
/// Event fired when the address of the browser control changes. /// Event fired when the address of the browser control changes.
/// </summary> /// </summary>
event AddressChangedHandler AddressChanged; event AddressChangedEventHandler AddressChanged;
/// <summary> /// <summary>
/// Event fired when the current page (and thus the title) of the browser control changes. /// Event fired when the current page (and thus the title) of the browser control changes.
/// </summary> /// </summary>
event TitleChangedHandler TitleChanged; event TitleChangedEventHandler TitleChanged;
/// <summary> /// <summary>
/// Navigates to the previous page in the browser control history. /// Navigates to the previous page in the browser control history.

View file

@ -8,29 +8,29 @@
namespace SafeExamBrowser.Contracts.UserInterface namespace SafeExamBrowser.Contracts.UserInterface
{ {
public delegate void ActionRequestedHandler(); public delegate void ActionRequestedEventHandler();
public interface IBrowserWindow : IWindow public interface IBrowserWindow : IWindow
{ {
/// <summary> /// <summary>
/// Event fired when the user changed the URL. /// Event fired when the user changed the URL.
/// </summary> /// </summary>
event AddressChangedHandler AddressChanged; event AddressChangedEventHandler AddressChanged;
/// <summary> /// <summary>
/// Event fired when the user would like to navigate backwards. /// Event fired when the user would like to navigate backwards.
/// </summary> /// </summary>
event ActionRequestedHandler BackwardNavigationRequested; event ActionRequestedEventHandler BackwardNavigationRequested;
/// <summary> /// <summary>
/// Event fired when the user would like to navigate forwards. /// Event fired when the user would like to navigate forwards.
/// </summary> /// </summary>
event ActionRequestedHandler ForwardNavigationRequested; event ActionRequestedEventHandler ForwardNavigationRequested;
/// <summary> /// <summary>
/// Event fired when the user would like to reload the current page. /// Event fired when the user would like to reload the current page.
/// </summary> /// </summary>
event ActionRequestedHandler ReloadRequested; event ActionRequestedEventHandler ReloadRequested;
/// <summary> /// <summary>
/// Determines whether this window is the main browser window. /// Determines whether this window is the main browser window.

View file

@ -18,8 +18,7 @@ namespace SafeExamBrowser.Contracts.UserInterface
/// <summary> /// <summary>
/// Adds the given notification button to the taskbar. /// Adds the given notification button to the taskbar.
/// </summary> /// </summary>
/// <param name="button"></param> void AddNotification(ITaskbarNotification notification);
void AddNotification(ITaskbarNotification button);
/// <summary> /// <summary>
/// Returns the absolute height of the taskbar (i.e. in physical pixels). /// Returns the absolute height of the taskbar (i.e. in physical pixels).

View file

@ -11,18 +11,18 @@ using SafeExamBrowser.Contracts.Configuration;
namespace SafeExamBrowser.Contracts.UserInterface namespace SafeExamBrowser.Contracts.UserInterface
{ {
public delegate void TaskbarButtonClickHandler(Guid? instanceId = null); public delegate void TaskbarButtonClickedEventHandler(Guid? instanceId = null);
public interface ITaskbarButton public interface ITaskbarButton
{ {
/// <summary> /// <summary>
/// OnClick handler, executed when the user clicks on the application button. If multiple instances of /// Event fired when the user clicked on the application button. If multiple instances of an application
/// an application are active, the handler is only executed when the user selects one of the instances. /// are active, the handler is only executed when the user selects one of the instances.
/// </summary> /// </summary>
event TaskbarButtonClickHandler OnClick; event TaskbarButtonClickedEventHandler Clicked;
/// <summary> /// <summary>
/// Registers a new instance of an application, to be displayed if the user clicks the taskbar button. /// Registers a new instance of an application, to be started / displayed if the user clicked the taskbar button.
/// </summary> /// </summary>
void RegisterInstance(IApplicationInstance instance); void RegisterInstance(IApplicationInstance instance);
} }

View file

@ -8,13 +8,13 @@
namespace SafeExamBrowser.Contracts.UserInterface namespace SafeExamBrowser.Contracts.UserInterface
{ {
public delegate void TaskbarNotificationClickHandler(); public delegate void TaskbarNotificationClickedEventHandler();
public interface ITaskbarNotification public interface ITaskbarNotification
{ {
/// <summary> /// <summary>
/// OnClick handler, executed when the user clicks on the notification icon. /// Event fired when the user clicked on the notification icon.
/// </summary> /// </summary>
event TaskbarNotificationClickHandler OnClick; event TaskbarNotificationClickedEventHandler Clicked;
} }
} }

View file

@ -8,14 +8,14 @@
namespace SafeExamBrowser.Contracts.UserInterface namespace SafeExamBrowser.Contracts.UserInterface
{ {
public delegate void WindowClosingHandler(); public delegate void WindowClosingEventHandler();
public interface IWindow public interface IWindow
{ {
/// <summary> /// <summary>
/// Event fired when the window is closing. /// Event fired when the window is closing.
/// </summary> /// </summary>
event WindowClosingHandler Closing; event WindowClosingEventHandler Closing;
/// <summary> /// <summary>
/// Brings the window to the foreground. /// Brings the window to the foreground.

View file

@ -24,7 +24,7 @@ namespace SafeExamBrowser.Monitoring.Processes
private INativeMethods nativeMethods; private INativeMethods nativeMethods;
private ManagementEventWatcher explorerWatcher; private ManagementEventWatcher explorerWatcher;
public event ExplorerStartedHandler ExplorerStarted; public event ExplorerStartedEventHandler ExplorerStarted;
public ProcessMonitor(ILogger logger, INativeMethods nativeMethods) public ProcessMonitor(ILogger logger, INativeMethods nativeMethods)
{ {

View file

@ -22,7 +22,7 @@ namespace SafeExamBrowser.Monitoring.Windows
private IList<Window> minimizedWindows = new List<Window>(); private IList<Window> minimizedWindows = new List<Window>();
private INativeMethods nativeMethods; private INativeMethods nativeMethods;
public event WindowChangedHandler WindowChanged; public event WindowChangedEventHandler WindowChanged;
public WindowMonitor(ILogger logger, INativeMethods nativeMethods) public WindowMonitor(ILogger logger, INativeMethods nativeMethods)
{ {

View file

@ -17,7 +17,7 @@ namespace SafeExamBrowser.UserInterface
{ {
private bool isMainWindow; private bool isMainWindow;
private IBrowserSettings settings; private IBrowserSettings settings;
public WindowClosingHandler closing; public WindowClosingEventHandler closing;
public bool IsMainWindow public bool IsMainWindow
{ {
@ -32,12 +32,12 @@ namespace SafeExamBrowser.UserInterface
} }
} }
public event AddressChangedHandler AddressChanged; public event AddressChangedEventHandler AddressChanged;
public event ActionRequestedHandler BackwardNavigationRequested; public event ActionRequestedEventHandler BackwardNavigationRequested;
public event ActionRequestedHandler ForwardNavigationRequested; public event ActionRequestedEventHandler ForwardNavigationRequested;
public event ActionRequestedHandler ReloadRequested; public event ActionRequestedEventHandler ReloadRequested;
event WindowClosingHandler IWindow.Closing event WindowClosingEventHandler IWindow.Closing
{ {
add { closing += value; } add { closing += value; }
remove { closing -= value; } remove { closing -= value; }

View file

@ -23,7 +23,7 @@ namespace SafeExamBrowser.UserInterface.Controls
private IApplicationInfo info; private IApplicationInfo info;
private IList<IApplicationInstance> instances = new List<IApplicationInstance>(); private IList<IApplicationInstance> instances = new List<IApplicationInstance>();
public event TaskbarButtonClickHandler OnClick; public event TaskbarButtonClickedEventHandler Clicked;
public ApplicationButton(IApplicationInfo info) public ApplicationButton(IApplicationInfo info)
{ {
@ -37,7 +37,7 @@ namespace SafeExamBrowser.UserInterface.Controls
{ {
var instanceButton = new ApplicationInstanceButton(instance, info); var instanceButton = new ApplicationInstanceButton(instance, info);
instanceButton.Click += (id) => OnClick?.Invoke(id); instanceButton.Clicked += (id) => Clicked?.Invoke(id);
instance.Terminated += (id) => Instance_OnTerminated(id, instanceButton); instance.Terminated += (id) => Instance_OnTerminated(id, instanceButton);
instances.Add(instance); instances.Add(instance);
@ -81,7 +81,7 @@ namespace SafeExamBrowser.UserInterface.Controls
{ {
if (instances.Count <= 1) if (instances.Count <= 1)
{ {
OnClick?.Invoke(instances.FirstOrDefault()?.Id); Clicked?.Invoke(instances.FirstOrDefault()?.Id);
} }
else else
{ {

View file

@ -14,14 +14,14 @@ using SafeExamBrowser.UserInterface.Utilities;
namespace SafeExamBrowser.UserInterface.Controls namespace SafeExamBrowser.UserInterface.Controls
{ {
internal delegate void InstanceButtonClickedEventHandler(Guid instanceId);
public partial class ApplicationInstanceButton : UserControl public partial class ApplicationInstanceButton : UserControl
{ {
private IApplicationInfo info; private IApplicationInfo info;
private IApplicationInstance instance; private IApplicationInstance instance;
public delegate void OnClickHandler(Guid instanceId); internal event InstanceButtonClickedEventHandler Clicked;
public event OnClickHandler Click;
public ApplicationInstanceButton(IApplicationInstance instance, IApplicationInfo info) public ApplicationInstanceButton(IApplicationInstance instance, IApplicationInfo info)
{ {
@ -50,7 +50,7 @@ namespace SafeExamBrowser.UserInterface.Controls
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
Click?.Invoke(instance.Id); Clicked?.Invoke(instance.Id);
} }
} }
} }

View file

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using SafeExamBrowser.Contracts.Configuration; using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.UserInterface; using SafeExamBrowser.Contracts.UserInterface;
@ -15,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Controls
{ {
public partial class NotificationIcon : UserControl, ITaskbarNotification public partial class NotificationIcon : UserControl, ITaskbarNotification
{ {
public event TaskbarNotificationClickHandler OnClick; public event TaskbarNotificationClickedEventHandler Clicked;
public NotificationIcon(INotificationInfo info) public NotificationIcon(INotificationInfo info)
{ {
@ -23,9 +24,9 @@ namespace SafeExamBrowser.UserInterface.Controls
InitializeNotificationIcon(info); InitializeNotificationIcon(info);
} }
private void Icon_Click(object sender, System.Windows.RoutedEventArgs e) private void Icon_Click(object sender, RoutedEventArgs e)
{ {
OnClick?.Invoke(); Clicked?.Invoke();
} }
private void InitializeNotificationIcon(INotificationInfo info) private void InitializeNotificationIcon(INotificationInfo info)