mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
Compare commits
2 commits
d1e6898290
...
c3e56e84f1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c3e56e84f1 | ||
![]() |
f1ef5a1f51 |
11 changed files with 44 additions and 15 deletions
2
.github/workflows/build-linux.yml
vendored
2
.github/workflows/build-linux.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
|
||||
- name: Setup
|
||||
uses: actions/setup-dotnet@v4.3.0
|
||||
uses: actions/setup-dotnet@v4.3.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
|
|
2
.github/workflows/build-osx.yml
vendored
2
.github/workflows/build-osx.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
|
||||
- name: Setup
|
||||
uses: actions/setup-dotnet@v4.3.0
|
||||
uses: actions/setup-dotnet@v4.3.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
|
|
2
.github/workflows/build-windows-desktop.yml
vendored
2
.github/workflows/build-windows-desktop.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
|||
fetch-depth: '0'
|
||||
|
||||
- name: Setup
|
||||
uses: actions/setup-dotnet@v4.3.0
|
||||
uses: actions/setup-dotnet@v4.3.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
|
|
2
.github/workflows/build-windows.yml
vendored
2
.github/workflows/build-windows.yml
vendored
|
@ -30,7 +30,7 @@ jobs:
|
|||
uses: actions/checkout@v4.2.2
|
||||
|
||||
- name: Setup
|
||||
uses: actions/setup-dotnet@v4.3.0
|
||||
uses: actions/setup-dotnet@v4.3.1
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ public partial class App : Application
|
|||
if (desktop.MainWindow != null)
|
||||
{
|
||||
var clipboardData = await AvaUtils.GetClipboardData(desktop.MainWindow);
|
||||
if (clipboardData.IsNullOrEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,10 @@ namespace v2rayN.Desktop.Common
|
|||
{
|
||||
var clipboard = TopLevel.GetTopLevel(owner)?.Clipboard;
|
||||
if (clipboard == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return await clipboard.GetTextAsync();
|
||||
}
|
||||
catch
|
||||
|
|
|
@ -247,7 +247,7 @@ namespace v2rayN.Desktop.Views
|
|||
|
||||
case EViewAction.AddServerViaClipboard:
|
||||
var clipboardData = await AvaUtils.GetClipboardData(this);
|
||||
if (ViewModel != null)
|
||||
if (clipboardData.IsNotEmpty() && ViewModel != null)
|
||||
{
|
||||
await ViewModel.AddServerViaClipboardAsync(clipboardData);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ namespace v2rayN.Desktop.Views
|
|||
{
|
||||
case Key.V:
|
||||
var clipboardData = await AvaUtils.GetClipboardData(this);
|
||||
if (ViewModel != null)
|
||||
if (clipboardData.IsNotEmpty() && ViewModel != null)
|
||||
{
|
||||
await ViewModel.AddServerViaClipboardAsync(clipboardData);
|
||||
}
|
||||
|
|
|
@ -109,13 +109,20 @@ namespace v2rayN.Desktop.Views
|
|||
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
await AvaUtils.SetClipboardData(this, (string)obj);
|
||||
break;
|
||||
|
||||
case EViewAction.ImportRulesFromClipboard:
|
||||
var clipboardData = await AvaUtils.GetClipboardData(this);
|
||||
ViewModel?.ImportRulesFromClipboardAsync(clipboardData);
|
||||
if (clipboardData.IsNotEmpty())
|
||||
{
|
||||
ViewModel?.ImportRulesFromClipboardAsync(clipboardData);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ namespace v2rayN
|
|||
/// <returns></returns>
|
||||
public static string? GetClipboardData()
|
||||
{
|
||||
string? strData = string.Empty;
|
||||
var strData = string.Empty;
|
||||
try
|
||||
{
|
||||
IDataObject data = Clipboard.GetDataObject();
|
||||
if (data.GetDataPresent(DataFormats.UnicodeText))
|
||||
var data = Clipboard.GetDataObject();
|
||||
if (data?.GetDataPresent(DataFormats.UnicodeText) == true)
|
||||
{
|
||||
strData = data.GetData(DataFormats.UnicodeText)?.ToString();
|
||||
}
|
||||
|
|
|
@ -232,7 +232,10 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.AddServerViaClipboard:
|
||||
var clipboardData = WindowsUtils.GetClipboardData();
|
||||
ViewModel?.AddServerViaClipboardAsync(clipboardData);
|
||||
if (clipboardData.IsNotEmpty())
|
||||
{
|
||||
ViewModel?.AddServerViaClipboardAsync(clipboardData);
|
||||
}
|
||||
break;
|
||||
|
||||
case EViewAction.AdjustMainLvColWidth:
|
||||
|
@ -284,11 +287,20 @@ namespace v2rayN.Views
|
|||
{
|
||||
case Key.V:
|
||||
if (Keyboard.FocusedElement is TextBox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboardData = WindowsUtils.GetClipboardData();
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
_ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
if (clipboardData.IsNotEmpty())
|
||||
{
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
{
|
||||
_ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Key.S:
|
||||
|
|
|
@ -110,7 +110,10 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.ImportRulesFromClipboard:
|
||||
var clipboardData = WindowsUtils.GetClipboardData();
|
||||
ViewModel?.ImportRulesFromClipboardAsync(clipboardData);
|
||||
if (clipboardData.IsNotEmpty())
|
||||
{
|
||||
ViewModel?.ImportRulesFromClipboardAsync(clipboardData);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue