8
8
namespace Flow . Launcher . Plugin
9
9
{
10
10
/// <summary>
11
- /// Describes the result of a plugin
11
+ /// Describes a result of a <see cref="Query"/> executed by a plugin
12
12
/// </summary>
13
13
public class Result
14
14
{
@@ -17,6 +17,8 @@ public class Result
17
17
18
18
private string _icoPath ;
19
19
20
+ private string _copyText = string . Empty ;
21
+
20
22
/// <summary>
21
23
/// The title of the result. This is always required.
22
24
/// </summary>
@@ -28,13 +30,13 @@ public class Result
28
30
public string SubTitle { get ; set ; } = string . Empty ;
29
31
30
32
/// <summary>
31
- /// This holds the action keyword that triggered the result.
33
+ /// This holds the action keyword that triggered the result.
32
34
/// If result is triggered by global keyword: *, this should be empty.
33
35
/// </summary>
34
36
public string ActionKeywordAssigned { get ; set ; }
35
37
36
38
/// <summary>
37
- /// This holds the text which can be provided by plugin to be copied to the
39
+ /// This holds the text which can be provided by plugin to be copied to the
38
40
/// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path
39
41
/// flow will copy the actual file/folder instead of just the path text.
40
42
/// </summary>
@@ -46,16 +48,17 @@ public string CopyText
46
48
47
49
/// <summary>
48
50
/// This holds the text which can be provided by plugin to help Flow autocomplete text
49
- /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have
51
+ /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have
50
52
/// the default constructed autocomplete text (result's Title), or the text provided here if not empty.
51
53
/// </summary>
54
+ /// <remarks>When a value is not set, the <see cref="Title"/> will be used.</remarks>
52
55
public string AutoCompleteText { get ; set ; }
53
56
54
57
/// <summary>
55
- /// Image Displayed on the result
56
- /// <value>Relative Path to the Image File</value>
57
- /// <remarks>GlyphInfo is prioritized if not null</remarks>
58
+ /// The image to be displayed for the result.
58
59
/// </summary>
60
+ /// <value>Can be a local file path or a URL.</value>
61
+ /// <remarks>GlyphInfo is prioritized if not null</remarks>
59
62
public string IcoPath
60
63
{
61
64
get { return _icoPath ; }
@@ -76,22 +79,22 @@ public string IcoPath
76
79
}
77
80
}
78
81
}
82
+
79
83
/// <summary>
80
84
/// Determines if Icon has a border radius
81
85
/// </summary>
82
86
public bool RoundedIcon { get ; set ; } = false ;
83
87
84
88
/// <summary>
85
- /// Delegate function, see <see cref="Icon "/>
89
+ /// Delegate function that produces an <see cref="ImageSource "/>
86
90
/// </summary>
87
91
/// <returns></returns>
88
92
public delegate ImageSource IconDelegate ( ) ;
89
93
90
94
/// <summary>
91
- /// Delegate to Get Image Source
95
+ /// Delegate to load an icon for this result.
92
96
/// </summary>
93
97
public IconDelegate Icon ;
94
- private string _copyText = string . Empty ;
95
98
96
99
/// <summary>
97
100
/// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons)
@@ -100,25 +103,29 @@ public string IcoPath
100
103
101
104
102
105
/// <summary>
103
- /// Delegate. An action to take in the form of a function call when the result has been selected
104
- /// <returns>
105
- /// true to hide flowlauncher after select result
106
- /// </returns>
106
+ /// An action to take in the form of a function call when the result has been selected.
107
107
/// </summary>
108
+ /// <remarks>
109
+ /// The function is invoked with an <see cref="ActionContext"/> as the only parameter.
110
+ /// Its result determines what happens to Flow Launcher's query form:
111
+ /// when true, the form will be hidden; when false, it will stay in focus.
112
+ /// </remarks>
108
113
public Func < ActionContext , bool > Action { get ; set ; }
109
114
110
115
/// <summary>
111
- /// Delegate. An Async action to take in the form of a function call when the result has been selected
112
- /// <returns>
113
- /// true to hide flowlauncher after select result
114
- /// </returns>
116
+ /// An async action to take in the form of a function call when the result has been selected.
115
117
/// </summary>
118
+ /// <remarks>
119
+ /// The function is invoked with an <see cref="ActionContext"/> as the only parameter and awaited.
120
+ /// Its result determines what happens to Flow Launcher's query form:
121
+ /// when true, the form will be hidden; when false, it will stay in focus.
122
+ /// </remarks>
116
123
public Func < ActionContext , ValueTask < bool > > AsyncAction { get ; set ; }
117
124
118
125
/// <summary>
119
126
/// Priority of the current result
120
- /// <value>default: 0</value>
121
127
/// </summary>
128
+ /// <value>default: 0</value>
122
129
public int Score { get ; set ; }
123
130
124
131
/// <summary>
@@ -183,10 +190,10 @@ public override string ToString()
183
190
184
191
/// <summary>
185
192
/// Additional data associated with this result
193
+ /// </summary>
186
194
/// <example>
187
195
/// As external information for ContextMenu
188
196
/// </example>
189
- /// </summary>
190
197
public object ContextData { get ; set ; }
191
198
192
199
/// <summary>
@@ -230,24 +237,42 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
230
237
/// <default>#26a0da (blue)</default>
231
238
public string ProgressBarColor { get ; set ; } = "#26a0da" ;
232
239
240
+ /// <summary>
241
+ /// Contains data used to populate the the preview section of this result.
242
+ /// </summary>
233
243
public PreviewInfo Preview { get ; set ; } = PreviewInfo . Default ;
234
244
235
245
/// <summary>
236
- /// Info of the preview image.
246
+ /// Info of the preview section of a <see cref="Result"/>
237
247
/// </summary>
238
248
public record PreviewInfo
239
249
{
240
250
/// <summary>
241
251
/// Full image used for preview panel
242
252
/// </summary>
243
253
public string PreviewImagePath { get ; set ; }
254
+
244
255
/// <summary>
245
256
/// Determines if the preview image should occupy the full width of the preview panel.
246
257
/// </summary>
247
258
public bool IsMedia { get ; set ; }
259
+
260
+ /// <summary>
261
+ /// Result description text that is shown at the bottom of the preview panel.
262
+ /// </summary>
263
+ /// <remarks>
264
+ /// When a value is not set, the <see cref="SubTitle"/> will be used.
265
+ /// </remarks>
248
266
public string Description { get ; set ; }
267
+
268
+ /// <summary>
269
+ /// Delegate to get the preview panel's image
270
+ /// </summary>
249
271
public IconDelegate PreviewDelegate { get ; set ; }
250
272
273
+ /// <summary>
274
+ /// Default instance of <see cref="PreviewInfo"/>
275
+ /// </summary>
251
276
public static PreviewInfo Default { get ; } = new ( )
252
277
{
253
278
PreviewImagePath = null ,
0 commit comments