mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-01 11:18:21 +03:00
26 lines
647 B
C#
26 lines
647 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Media.Imaging;
|
|
|
|
namespace v2rayN.Desktop.Views
|
|
{
|
|
public partial class QrcodeView : Window
|
|
{
|
|
public QrcodeView(string? url)
|
|
{
|
|
InitializeComponent();
|
|
|
|
txtContent.Text = url;
|
|
imgQrcode.Source = GetQRCode(url);
|
|
|
|
btnCancel.Click += (s, e) => this.Close();
|
|
}
|
|
|
|
private Bitmap? GetQRCode(string? url)
|
|
{
|
|
var qrCodeImage = QRCodeHelper.GenQRCode(url);
|
|
if (qrCodeImage is null) return null;
|
|
var ms = new MemoryStream(qrCodeImage);
|
|
return new Bitmap(ms);
|
|
}
|
|
}
|
|
} |