Skip to content

Commit 41fbfc0

Browse files
committed
feat(Avalonia): add Paste_ee uploader settings
1 parent 452f662 commit 41fbfc0

3 files changed

Lines changed: 73 additions & 1 deletion

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<UserControl
2+
x:Class="SnapX.Avalonia.Views.Settings.Views.TextUploaders.PasteeUploaderSettingsView"
3+
x:DataType="txt:Paste_ee"
4+
xmlns="https://github.com/avaloniaui"
5+
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
6+
xmlns:txt="clr-namespace:SnapX.Core.Upload.Text;assembly=SnapX.Core"
7+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
8+
9+
<StackPanel Spacing="4">
10+
<controls:SettingsExpander
11+
Description="Enter your unique user key"
12+
Header="Account Authentication"
13+
IconSource="Contact"
14+
IsExpanded="True">
15+
<controls:SettingsExpanderItem Content="Don't have a key?">
16+
<controls:SettingsExpanderItem.Footer>
17+
<Button
18+
Classes="accent"
19+
Click="UserKeyButton_OnClick"
20+
Content="Get user key online"
21+
x:Name="UserKeyButton" />
22+
</controls:SettingsExpanderItem.Footer>
23+
</controls:SettingsExpanderItem>
24+
<controls:SettingsExpanderItem Content="User Key">
25+
<controls:SettingsExpanderItem.Footer>
26+
<TextBox
27+
PasswordChar="*"
28+
VerticalAlignment="Center"
29+
Watermark="Paste your key here..."
30+
Width="250"
31+
x:Name="PasswordTextBox" />
32+
</controls:SettingsExpanderItem.Footer>
33+
</controls:SettingsExpanderItem>
34+
35+
</controls:SettingsExpander>
36+
37+
</StackPanel>
38+
</UserControl>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Avalonia.Controls;
2+
using Avalonia.Interactivity;
3+
using SnapX.Core.Upload;
4+
using SnapX.Core.Upload.Text;
5+
using SnapX.Core.Utils;
6+
7+
namespace SnapX.Avalonia.Views.Settings.Views.TextUploaders;
8+
9+
public partial class PasteeUploaderSettingsView : UserControl
10+
{
11+
public PasteeUploaderSettingsView()
12+
{
13+
InitializeComponent();
14+
}
15+
16+
protected override void OnDataContextChanged(EventArgs e)
17+
{
18+
base.OnDataContextChanged(e);
19+
20+
if (DataContext is not Paste_ee) return;
21+
var config = SnapX.Core.SnapXL.UploadersConfig;
22+
23+
PasswordTextBox.Text = config.Paste_eeUserKey;
24+
PasswordTextBox.TextChanged += (s, ev) =>
25+
{
26+
config.Paste_eeUserKey = PasswordTextBox.Text;
27+
};
28+
29+
}
30+
31+
private void UserKeyButton_OnClick(object? Sender, RoutedEventArgs E)
32+
{
33+
URLHelpers.OpenURL($"https://paste.ee/account/api/authorize/{APIKeys.Paste_eeApplicationKey}");
34+
}
35+
}

SnapX.Core/Upload/Text/Paste_ee.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44

55
using System.Collections.Specialized;
6-
using System.Diagnostics.CodeAnalysis;
76
using System.Text.Json;
87
using System.Text.Json.Serialization;
98
using SnapX.Core.Upload.BaseServices;

0 commit comments

Comments
 (0)