From 9b5fbeef9b5986c306b21da45900757bfeacb3c1 Mon Sep 17 00:00:00 2001 From: Ioannis G Date: Sun, 18 Jun 2023 21:59:03 +0300 Subject: [PATCH] update documentation in Result --- Flow.Launcher.Plugin/Result.cs | 67 +++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 1c4467762..6810a6d47 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -8,7 +8,7 @@ using System.Windows.Media; namespace Flow.Launcher.Plugin { /// - /// Describes the result of a plugin + /// Describes a result of a executed by a plugin /// public class Result { @@ -17,6 +17,8 @@ namespace Flow.Launcher.Plugin private string _icoPath; + private string _copyText = string.Empty; + /// /// The title of the result. This is always required. /// @@ -28,13 +30,13 @@ namespace Flow.Launcher.Plugin public string SubTitle { get; set; } = string.Empty; /// - /// This holds the action keyword that triggered the result. + /// This holds the action keyword that triggered the result. /// If result is triggered by global keyword: *, this should be empty. /// public string ActionKeywordAssigned { get; set; } /// - /// This holds the text which can be provided by plugin to be copied to the + /// This holds the text which can be provided by plugin to be copied to the /// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path /// flow will copy the actual file/folder instead of just the path text. /// @@ -46,16 +48,17 @@ namespace Flow.Launcher.Plugin /// /// This holds the text which can be provided by plugin to help Flow autocomplete text - /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have + /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have /// the default constructed autocomplete text (result's Title), or the text provided here if not empty. /// + /// When a value is not set, the will be used. public string AutoCompleteText { get; set; } /// - /// Image Displayed on the result - /// Relative Path to the Image File - /// GlyphInfo is prioritized if not null + /// The image to be displayed for the result. /// + /// Can be a local file path or a URL. + /// GlyphInfo is prioritized if not null public string IcoPath { get { return _icoPath; } @@ -76,22 +79,22 @@ namespace Flow.Launcher.Plugin } } } + /// /// Determines if Icon has a border radius /// public bool RoundedIcon { get; set; } = false; /// - /// Delegate function, see + /// Delegate function that produces an /// /// public delegate ImageSource IconDelegate(); /// - /// Delegate to Get Image Source + /// Delegate to load an icon for this result. /// public IconDelegate Icon; - private string _copyText = string.Empty; /// /// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons) @@ -100,25 +103,29 @@ namespace Flow.Launcher.Plugin /// - /// Delegate. An action to take in the form of a function call when the result has been selected - /// - /// true to hide flowlauncher after select result - /// + /// An action to take in the form of a function call when the result has been selected. /// + /// + /// The function is invoked with an as the only parameter. + /// Its result determines what happens to Flow Launcher's query form: + /// when true, the form will be hidden; when false, it will stay in focus. + /// public Func Action { get; set; } /// - /// Delegate. An Async action to take in the form of a function call when the result has been selected - /// - /// true to hide flowlauncher after select result - /// + /// An async action to take in the form of a function call when the result has been selected. /// + /// + /// The function is invoked with an as the only parameter and awaited. + /// Its result determines what happens to Flow Launcher's query form: + /// when true, the form will be hidden; when false, it will stay in focus. + /// public Func> AsyncAction { get; set; } /// /// Priority of the current result - /// default: 0 /// + /// default: 0 public int Score { get; set; } /// @@ -183,10 +190,10 @@ namespace Flow.Launcher.Plugin /// /// Additional data associated with this result + /// /// /// As external information for ContextMenu /// - /// public object ContextData { get; set; } /// @@ -230,10 +237,13 @@ namespace Flow.Launcher.Plugin /// #26a0da (blue) public string ProgressBarColor { get; set; } = "#26a0da"; + /// + /// Contains data used to populate the the preview section of this result. + /// public PreviewInfo Preview { get; set; } = PreviewInfo.Default; /// - /// Info of the preview image. + /// Info of the preview section of a /// public record PreviewInfo { @@ -241,13 +251,28 @@ namespace Flow.Launcher.Plugin /// Full image used for preview panel /// public string PreviewImagePath { get; set; } + /// /// Determines if the preview image should occupy the full width of the preview panel. /// public bool IsMedia { get; set; } + + /// + /// Result description text that is shown at the bottom of the preview panel. + /// + /// + /// When a value is not set, the will be used. + /// public string Description { get; set; } + + /// + /// Delegate to get the preview panel's image + /// public IconDelegate PreviewDelegate { get; set; } + /// + /// Default instance of + /// public static PreviewInfo Default { get; } = new() { PreviewImagePath = null,