Repository navigation
Expand file tree
/
Copy pathNavigationManager.cs
More file actions
45 lines (39 loc) · 1.53 KB
/
Copy pathNavigationManager.cs
File metadata and controls
45 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using NETworkManager.Models;
using System;
namespace NETworkManager;
/// <summary>
/// Navigation between the applications (tools) and the settings. The main window handles the requests.
/// </summary>
public static class NavigationManager
{
/// <summary>
/// Occurs when an application should be opened, see <see cref="Open" />.
/// </summary>
public static event EventHandler<ApplicationRequest> ApplicationRequested;
/// <summary>
/// Occurs when the settings should be opened, see <see cref="OpenSettings" />.
/// </summary>
public static event EventHandler SettingsRequested;
/// <summary>
/// Opens an application and passes the request (target, profile, options) to it. The target is prepared for
/// the application (see <see cref="ApplicationManager.GetHostForApplication" />), e.g. "gateway." from a PTR
/// record -> "gateway" for Remote Desktop.
/// </summary>
/// <param name="request">Request with the application to open.</param>
public static void Open(ApplicationRequest request)
{
if (request.Target != null)
request = request with
{
Target = ApplicationManager.GetHostForApplication(request.Application, request.Target)
};
ApplicationRequested?.Invoke(null, request);
}
/// <summary>
/// Opens the settings of the current application.
/// </summary>
public static void OpenSettings()
{
SettingsRequested?.Invoke(null, EventArgs.Empty);
}
}