Skip to content

Commit 27016c4

Browse files
committed
Add hyperlink layout
1 parent ba3ed35 commit 27016c4

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

Flow.Launcher.Core/Plugin/JsonRPCConfigurationModel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23

34
namespace Flow.Launcher.Core.Plugin
45
{
@@ -26,6 +27,8 @@ public class FieldAttributes
2627
public string Name { get; set; }
2728
public string Label { get; set; }
2829
public string Description { get; set; }
30+
public string urlLabel { get; set; }
31+
public Uri url { get; set; }
2932
public bool Validation { get; set; }
3033
public List<string> Options { get; set; }
3134
public string DefaultValue { get; set; }
@@ -40,4 +43,4 @@ public void Deconstruct(out string Name, out string Label, out string Descriptio
4043
DefaultValue = this.DefaultValue;
4144
}
4245
}
43-
}
46+
}

Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
using Orientation = System.Windows.Controls.Orientation;
2323
using TextBox = System.Windows.Controls.TextBox;
2424
using UserControl = System.Windows.Controls.UserControl;
25+
using System.Windows.Documents;
26+
using static System.Windows.Forms.LinkLabel;
27+
using Droplex;
2528

2629
namespace Flow.Launcher.Core.Plugin
2730
{
@@ -33,7 +36,6 @@ internal abstract class JsonRPCPlugin : IAsyncPlugin, IContextMenu, ISettingProv
3336
{
3437
protected PluginInitContext context;
3538
public const string JsonRPC = "JsonRPC";
36-
3739
/// <summary>
3840
/// The language this JsonRPCPlugin support
3941
/// </summary>
@@ -552,6 +554,28 @@ public Control CreateSettingPanel()
552554
Grid.SetColumn(sep, 0);
553555
Grid.SetColumnSpan(sep, 2);
554556
break;
557+
case "hyperlink":
558+
var hyperlink = new Hyperlink
559+
{
560+
ToolTip = attribute.Description,
561+
NavigateUri = attribute.url
562+
};
563+
var linkbtn = new Button
564+
{
565+
HorizontalAlignment = HorizontalAlignment.Right,
566+
Margin = settingControlMargin
567+
};
568+
linkbtn.Content = attribute.urlLabel;
569+
570+
contentControl = linkbtn;
571+
Grid.SetColumn(contentControl, 1);
572+
Grid.SetRow(contentControl, rowCount);
573+
if (rowCount != 0)
574+
mainPanel.Children.Add(sep);
575+
Grid.SetRow(sep, rowCount);
576+
Grid.SetColumn(sep, 0);
577+
Grid.SetColumnSpan(sep, 2);
578+
break;
555579
default:
556580
continue;
557581
}

0 commit comments

Comments
 (0)