Skip to content

Commit 9b5fbee

Browse files
committed
update documentation in Result
1 parent be72c14 commit 9b5fbee

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

Flow.Launcher.Plugin/Result.cs

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Flow.Launcher.Plugin
99
{
1010
/// <summary>
11-
/// Describes the result of a plugin
11+
/// Describes a result of a <see cref="Query"/> executed by a plugin
1212
/// </summary>
1313
public class Result
1414
{
@@ -17,6 +17,8 @@ public class Result
1717

1818
private string _icoPath;
1919

20+
private string _copyText = string.Empty;
21+
2022
/// <summary>
2123
/// The title of the result. This is always required.
2224
/// </summary>
@@ -28,13 +30,13 @@ public class Result
2830
public string SubTitle { get; set; } = string.Empty;
2931

3032
/// <summary>
31-
/// This holds the action keyword that triggered the result.
33+
/// This holds the action keyword that triggered the result.
3234
/// If result is triggered by global keyword: *, this should be empty.
3335
/// </summary>
3436
public string ActionKeywordAssigned { get; set; }
3537

3638
/// <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
3840
/// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path
3941
/// flow will copy the actual file/folder instead of just the path text.
4042
/// </summary>
@@ -46,16 +48,17 @@ public string CopyText
4648

4749
/// <summary>
4850
/// 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
5052
/// the default constructed autocomplete text (result's Title), or the text provided here if not empty.
5153
/// </summary>
54+
/// <remarks>When a value is not set, the <see cref="Title"/> will be used.</remarks>
5255
public string AutoCompleteText { get; set; }
5356

5457
/// <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.
5859
/// </summary>
60+
/// <value>Can be a local file path or a URL.</value>
61+
/// <remarks>GlyphInfo is prioritized if not null</remarks>
5962
public string IcoPath
6063
{
6164
get { return _icoPath; }
@@ -76,22 +79,22 @@ public string IcoPath
7679
}
7780
}
7881
}
82+
7983
/// <summary>
8084
/// Determines if Icon has a border radius
8185
/// </summary>
8286
public bool RoundedIcon { get; set; } = false;
8387

8488
/// <summary>
85-
/// Delegate function, see <see cref="Icon"/>
89+
/// Delegate function that produces an <see cref="ImageSource"/>
8690
/// </summary>
8791
/// <returns></returns>
8892
public delegate ImageSource IconDelegate();
8993

9094
/// <summary>
91-
/// Delegate to Get Image Source
95+
/// Delegate to load an icon for this result.
9296
/// </summary>
9397
public IconDelegate Icon;
94-
private string _copyText = string.Empty;
9598

9699
/// <summary>
97100
/// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons)
@@ -100,25 +103,29 @@ public string IcoPath
100103

101104

102105
/// <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.
107107
/// </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>
108113
public Func<ActionContext, bool> Action { get; set; }
109114

110115
/// <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.
115117
/// </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>
116123
public Func<ActionContext, ValueTask<bool>> AsyncAction { get; set; }
117124

118125
/// <summary>
119126
/// Priority of the current result
120-
/// <value>default: 0</value>
121127
/// </summary>
128+
/// <value>default: 0</value>
122129
public int Score { get; set; }
123130

124131
/// <summary>
@@ -183,10 +190,10 @@ public override string ToString()
183190

184191
/// <summary>
185192
/// Additional data associated with this result
193+
/// </summary>
186194
/// <example>
187195
/// As external information for ContextMenu
188196
/// </example>
189-
/// </summary>
190197
public object ContextData { get; set; }
191198

192199
/// <summary>
@@ -230,24 +237,42 @@ public ValueTask<bool> ExecuteAsync(ActionContext context)
230237
/// <default>#26a0da (blue)</default>
231238
public string ProgressBarColor { get; set; } = "#26a0da";
232239

240+
/// <summary>
241+
/// Contains data used to populate the the preview section of this result.
242+
/// </summary>
233243
public PreviewInfo Preview { get; set; } = PreviewInfo.Default;
234244

235245
/// <summary>
236-
/// Info of the preview image.
246+
/// Info of the preview section of a <see cref="Result"/>
237247
/// </summary>
238248
public record PreviewInfo
239249
{
240250
/// <summary>
241251
/// Full image used for preview panel
242252
/// </summary>
243253
public string PreviewImagePath { get; set; }
254+
244255
/// <summary>
245256
/// Determines if the preview image should occupy the full width of the preview panel.
246257
/// </summary>
247258
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>
248266
public string Description { get; set; }
267+
268+
/// <summary>
269+
/// Delegate to get the preview panel's image
270+
/// </summary>
249271
public IconDelegate PreviewDelegate { get; set; }
250272

273+
/// <summary>
274+
/// Default instance of <see cref="PreviewInfo"/>
275+
/// </summary>
251276
public static PreviewInfo Default { get; } = new()
252277
{
253278
PreviewImagePath = null,

0 commit comments

Comments
 (0)