-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPresentationAgent.cs
61 lines (56 loc) · 1.72 KB
/
PresentationAgent.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using MouseNet.Logophi.Thesaurus;
using MouseNet.Logophi.Views;
using MouseNet.Logophi.Views.Presentation;
namespace MouseNet.Logophi
{
/// <inheritdoc />
/// <summary>
/// Manages presentation objects.
/// </summary>
internal class PresentationAgent : IDisposable
{
public PresentationAgent
(Browser browser,
Action exitAction,
Action showBookmarksAction,
Action showPreferencesAction,
Action showAboutAction,
Action deleteCacheAction,
Action deleteHistoryAction)
{
var main = new MainFormPresenter(
browser,
exitAction,
showBookmarksAction,
showPreferencesAction,
showAboutAction);
Main = main;
Bookmarks =
new BookmarksFormPresenter(browser, main.Search);
Preferences =
new PreferencesDialogPresenter(
deleteCacheAction,
deleteHistoryAction);
}
public IViewPresenter<IMainFormView> Main { get; }
public IViewPresenter<IBookmarksFormView> Bookmarks { get; }
public IViewPresenter<IPreferencesDialogView> Preferences {
get;
}
/// <inheritdoc />
public void Dispose()
{
Main.Dispose();
Bookmarks.Dispose();
Preferences.Dispose();
}
private void InvokePreferencesSaved
(object sender,
EventArgs args)
{
PreferencesSaved?.Invoke(sender, args);
}
public event EventHandler PreferencesSaved;
}
}