Code clean

This commit is contained in:
2dust
2025-01-30 17:10:05 +08:00
parent 253219dd16
commit 45264005a4
103 changed files with 639 additions and 498 deletions
+6 -4
View File
@@ -1,4 +1,4 @@
using Avalonia;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media.Imaging;
@@ -13,7 +13,8 @@ namespace v2rayN.Desktop.Common
try
{
var clipboard = TopLevel.GetTopLevel(owner)?.Clipboard;
if (clipboard == null) return null;
if (clipboard == null)
return null;
return await clipboard.GetTextAsync();
}
catch
@@ -27,7 +28,8 @@ namespace v2rayN.Desktop.Common
try
{
var clipboard = TopLevel.GetTopLevel(visual)?.Clipboard;
if (clipboard == null) return;
if (clipboard == null)
return;
var dataObject = new DataObject();
dataObject.Set(DataFormats.Text, strData);
await clipboard.SetDataObjectAsync(dataObject);
@@ -51,4 +53,4 @@ namespace v2rayN.Desktop.Common
return new(bitmap);
}
}
}
}
+7 -5
View File
@@ -1,4 +1,4 @@
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Platform.Storage;
using MsBox.Avalonia;
using MsBox.Avalonia.Enums;
@@ -18,8 +18,9 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter)
{
var sp = GetStorageProvider(owner);
if (sp is null) return null;
if (sp is null)
return null;
// Start async operation to open the dialog.
var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions
{
@@ -33,7 +34,8 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> SaveFileDialog(Window owner, string filter)
{
var sp = GetStorageProvider(owner);
if (sp is null) return null;
if (sp is null)
return null;
// Start async operation to open the dialog.
var files = await sp.SaveFilePickerAsync(new FilePickerSaveOptions
@@ -49,4 +51,4 @@ namespace v2rayN.Desktop.Common
return topLevel?.StorageProvider;
}
}
}
}