-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPluginResultWindow.axaml.cs
More file actions
51 lines (45 loc) · 1.34 KB
/
PluginResultWindow.axaml.cs
File metadata and controls
51 lines (45 loc) · 1.34 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
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using System;
namespace ShowWrite
{
public partial class PluginResultWindow : Window
{
public PluginResultWindow()
{
InitializeComponent();
}
public void SetResult(string result, bool isUrl)
{
ResultText.Text = result;
TypeText.Text = isUrl ? "类型: 链接" : "类型: 文本";
}
public void AddButton(string text, Action onClick)
{
var button = new Button
{
Content = text,
Background = new SolidColorBrush(Color.FromRgb(0, 120, 212)),
Foreground = Brushes.White,
Padding = new Thickness(16, 8),
CornerRadius = new CornerRadius(6),
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center,
IsEnabled = true,
IsVisible = true,
Focusable = true
};
button.Click += (s, e) =>
{
onClick();
Close();
};
ButtonPanel.Children.Add(button);
}
public void ClearButtons()
{
ButtonPanel.Children.Clear();
}
}
}