-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAspen.cs
More file actions
79 lines (70 loc) · 2.99 KB
/
Aspen.cs
File metadata and controls
79 lines (70 loc) · 2.99 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
namespace ASPEN
{
/// <summary>
/// All Software Projects Eventually Need...
/// </summary>
public class Aspen
{
/// <summary>
/// Model for i18n string formatting
/// </summary>
public static AspenUserMessages Text { get; set; }
/// <summary>
/// shorthand for <see cref="Text"/>, <see cref="AspenUserMessages.Formatted(object, object[])"/>
/// </summary>
/// <param name="key"></param>
/// <param name="formatArgs"></param>
/// <returns></returns>
public static string Format(object key, params object[] formatArgs)
{
return Text.Formatted(key, formatArgs);
}
/// <summary>
/// Business-driven generally-hidden-from-user tracking of errors, warnings, application usage, and other progress.
/// </summary>
public static AspenLogging Log { get; set; }
/// <summary>
/// Model for user settings e.g. content limitation, algorithm choice, confirmation bypass
/// Usage: e.g. settings dialog
/// View potentially uses this with view-specific keys as storage for preferences like window layout, sort order, visual theme customization
/// Usage: possibly implicit (window layout), else settings dialog
/// </summary>
public static AspenUserSettings Option { get; set; }
/// <summary>
/// Model for Read-only, externally defined configuration for e.g. application directory, server address, application mode
/// Can load from combination of launch args, .ini, config file, etc. Ultimate default is hard-coded.
/// </summary>
public static AspenConfiguration Config { get; set; }
/// <summary>
/// shorthand for <see cref="Config"/>, <see cref="AspenConfiguration.Get{T}(object)"/>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public static T Get<T>(object key)
{
return Config.Get<T>(key);
}
/// <summary>
/// Usecase-driven focused user notifications, questions, and inputs required as a step in a process or event.
/// implemented by view, could do logging as a side effect,
/// </summary>
public static AspenUserInteraction Show { get; set; }
/// <summary>
/// Tracks context of active (hierarchy of) application processes, steps, and events.
/// Not an obvious ASPEN concept, but valuable to automatically inform logging categories and dialog headings as well as command usage history.
/// </summary>
public static AspenContextTracking Track { get; set; }
/// <summary>
/// shorthand for <see cref="Track"/>, <see cref="AspenContextTracking.ForCommand(string, Action, Action{Exception})"/>
/// </summary>
/// <param name="contextName"></param>
/// <param name="command"></param>
/// <param name="exceptionHandler"></param>
public static void Do(string contextName, Action command, Action<Exception> exceptionHandler)
{
Track.ForCommand(contextName, command, exceptionHandler);
}
}
}