Skip to content

Commit 0509d2b

Browse files
committed
ready 1.1.4
2 parents f0a14e3 + 8aa450f commit 0509d2b

File tree

68 files changed

+5651
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5651
-378
lines changed

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<Project>
2+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
3+
<DebugType>none</DebugType>
4+
<DebugSymbols>false</DebugSymbols>
5+
</PropertyGroup>
26
<PropertyGroup>
37
<LangVersion>9.0</LangVersion>
48
<Nullable>enable</Nullable>

README.en.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ English | [简体中文](./README.md)
2626
5. Some game tools
2727
- Currently there is a forced game borderless windowing, CSGO fix VAC shield.
2828

29+
<!--Prerequisites Microsoft Visual C++ 2015-2019 Redistributable [64 bit](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 bit](https://aka.ms/vs/16/release/vc_redist.x86.exe)-->
2930
## 🖥 Operating Environment
3031
- Windows 10 1607+
3132
- Windows 8.1 / Windows Server 2012 R2
32-
- Prerequisites
33-
- Microsoft Visual C++ 2015-2019 Redistributable [64 bit](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 bit](https://aka.ms/vs/16/release/vc_redist.x86.exe)
3433
- Windows 7 SP1 [ESU](https://docs.microsoft.com/troubleshoot/windows-client/windows-7-eos-faq/windows-7-extended-security-updates-faq)
3534
- Prerequisites
36-
- Microsoft Visual C++ 2015-2019 Redistributable [64 bit](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 bit](https://aka.ms/vs/16/release/vc_redist.x86.exe)
3735
- KB3063858 [64 bit](https://www.microsoft.com/download/details.aspx?id=47442) / [32 bit](https://www.microsoft.com/download/details.aspx?id=47409)
3836
- ~~macOS 10.13 High Sierra Or Higher~~
3937
<!--
@@ -47,7 +45,7 @@ English | [简体中文](./README.md)
4745
- ~~SUSE Enterprise Linux (SLES) 12 SP2+~~
4846
- ~~Ubuntu 20.10, 20.04, 18.04, 16.04~~
4947
- ~~Android 5.0+~~
50-
- ~~iOS 8.0+~~
48+
- ~~iOS 10.0+~~
5149
-->
5250

5351
## 🌎 Roadmap

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
</div>
1515

16+
<div align="center"><img src="./resources/screenshots.jpg" /></div>
17+
1618
[English](./README.en.md) | 简体中文
1719

1820
## ✨ 功能
@@ -33,14 +35,13 @@
3335
5. 其他游戏工具
3436
- 目前已有强制游戏无边框窗口化,CSGO 修复 VAC 屏蔽
3537

38+
<!--发布配置SelfContained=true时会自动打包VC++相关程序集-->
39+
<!--先决条件 Microsoft Visual C++ 2015-2019 Redistributable [64 位](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 位](https://aka.ms/vs/16/release/vc_redist.x86.exe)-->
3640
## 🖥 系统要求
3741
- Windows 10 1607+
3842
- Windows 8.1 / Windows Server 2012 R2
39-
- 先决条件
40-
- Microsoft Visual C++ 2015-2019 Redistributable [64 位](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 位](https://aka.ms/vs/16/release/vc_redist.x86.exe)
4143
- Windows 7 SP1 [ESU](https://docs.microsoft.com/zh-cn/troubleshoot/windows-client/windows-7-eos-faq/windows-7-extended-security-updates-faq)
4244
- 先决条件
43-
- Microsoft Visual C++ 2015-2019 Redistributable [64 位](https://aka.ms/vs/16/release/vc_redist.x64.exe) / [32 位](https://aka.ms/vs/16/release/vc_redist.x86.exe)
4445
- KB3063858 [64 位](https://www.microsoft.com/zh-cn/download/details.aspx?id=47442) / [32 位](https://www.microsoft.com/zh-cn/download/details.aspx?id=47409)
4546
- ~~macOS 10.13 High Sierra 或更高版本~~
4647
<!--
@@ -54,7 +55,7 @@
5455
- ~~SUSE Enterprise Linux (SLES) 12 SP2+~~
5556
- ~~Ubuntu 20.10, 20.04, 18.04, 16.04~~
5657
- ~~Android 5.0+~~
57-
- ~~iOS 8.0+~~
58+
- ~~iOS 10.0+~~
5859
-->
5960

6061
## 🌎 路线图

SteamToolsV1.2+.sln

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Common.ClientLib", "
99
EndProject
1010
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Common.CoreLib", "System.Common.CoreLib\System.Common.CoreLib.csproj", "{E7468FDD-75F7-4B08-BA47-B715BBCFCC11}"
1111
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Common.DesktopLib", "System.Common.DesktopLib\System.Common.DesktopLib.csproj", "{F37D23AA-4EA9-4E07-9B3D-F966ABED046F}"
13-
EndProject
1412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Common.ClientLib.Droid", "System.Common.ClientLib.Droid\System.Common.ClientLib.Droid.csproj", "{7C8D906E-426B-49AB-9072-178555370F62}"
1513
EndProject
1614
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Common.ClientLib.iOS", "System.Common.ClientLib.iOS\System.Common.ClientLib.iOS.csproj", "{F8F6973C-5831-43D1-89C2-1AD543CE7408}"
@@ -59,6 +57,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
5957
EndProject
6058
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Application.SteamTools.Client.Desktop.Avalonia", "System.Application.SteamTools.Client.Desktop.Avalonia\System.Application.SteamTools.Client.Desktop.Avalonia.csproj", "{4F09B6D1-3F83-45A0-AEC8-0F243E7CD263}"
6159
EndProject
60+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Application.SteamTools.Client.Desktop.Platform", "System.Application.SteamTools.Client.Desktop.Platform\System.Application.SteamTools.Client.Desktop.Platform.csproj", "{DD2973AE-D1FC-4307-AFE2-EE2945183D3D}"
61+
EndProject
62+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Application.SteamTools.Client.Desktop.Platform.Linux", "System.Application.SteamTools.Client.Desktop.Platform.Linux\System.Application.SteamTools.Client.Desktop.Platform.Linux.csproj", "{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82}"
63+
EndProject
64+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Application.SteamTools.Client.Desktop.Platform.Mac", "System.Application.SteamTools.Client.Desktop.Platform.Mac\System.Application.SteamTools.Client.Desktop.Platform.Mac.csproj", "{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4}"
65+
EndProject
66+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Application.SteamTools.Client.Desktop.Platform.Windows", "System.Application.SteamTools.Client.Desktop.Platform.Windows\System.Application.SteamTools.Client.Desktop.Platform.Windows.csproj", "{141532E1-540E-4E50-8723-96936C191281}"
67+
EndProject
68+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win7Troubleshoot", "Win7Troubleshoot\Win7Troubleshoot.csproj", "{60530AF8-4790-4A85-BCE2-C5673E9C601B}"
69+
EndProject
6270
Global
6371
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6472
Debug|Any CPU = Debug|Any CPU
@@ -77,10 +85,6 @@ Global
7785
{E7468FDD-75F7-4B08-BA47-B715BBCFCC11}.Debug|Any CPU.Build.0 = Debug|Any CPU
7886
{E7468FDD-75F7-4B08-BA47-B715BBCFCC11}.Release|Any CPU.ActiveCfg = Release|Any CPU
7987
{E7468FDD-75F7-4B08-BA47-B715BBCFCC11}.Release|Any CPU.Build.0 = Release|Any CPU
80-
{F37D23AA-4EA9-4E07-9B3D-F966ABED046F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81-
{F37D23AA-4EA9-4E07-9B3D-F966ABED046F}.Debug|Any CPU.Build.0 = Debug|Any CPU
82-
{F37D23AA-4EA9-4E07-9B3D-F966ABED046F}.Release|Any CPU.ActiveCfg = Release|Any CPU
83-
{F37D23AA-4EA9-4E07-9B3D-F966ABED046F}.Release|Any CPU.Build.0 = Release|Any CPU
8488
{7C8D906E-426B-49AB-9072-178555370F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8589
{7C8D906E-426B-49AB-9072-178555370F62}.Debug|Any CPU.Build.0 = Debug|Any CPU
8690
{7C8D906E-426B-49AB-9072-178555370F62}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -131,6 +135,26 @@ Global
131135
{4F09B6D1-3F83-45A0-AEC8-0F243E7CD263}.Debug|Any CPU.Build.0 = Debug|Any CPU
132136
{4F09B6D1-3F83-45A0-AEC8-0F243E7CD263}.Release|Any CPU.ActiveCfg = Release|Any CPU
133137
{4F09B6D1-3F83-45A0-AEC8-0F243E7CD263}.Release|Any CPU.Build.0 = Release|Any CPU
138+
{DD2973AE-D1FC-4307-AFE2-EE2945183D3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
139+
{DD2973AE-D1FC-4307-AFE2-EE2945183D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
140+
{DD2973AE-D1FC-4307-AFE2-EE2945183D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
141+
{DD2973AE-D1FC-4307-AFE2-EE2945183D3D}.Release|Any CPU.Build.0 = Release|Any CPU
142+
{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
143+
{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82}.Debug|Any CPU.Build.0 = Debug|Any CPU
144+
{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82}.Release|Any CPU.ActiveCfg = Release|Any CPU
145+
{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82}.Release|Any CPU.Build.0 = Release|Any CPU
146+
{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
147+
{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
148+
{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
149+
{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4}.Release|Any CPU.Build.0 = Release|Any CPU
150+
{141532E1-540E-4E50-8723-96936C191281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
151+
{141532E1-540E-4E50-8723-96936C191281}.Debug|Any CPU.Build.0 = Debug|Any CPU
152+
{141532E1-540E-4E50-8723-96936C191281}.Release|Any CPU.ActiveCfg = Release|Any CPU
153+
{141532E1-540E-4E50-8723-96936C191281}.Release|Any CPU.Build.0 = Release|Any CPU
154+
{60530AF8-4790-4A85-BCE2-C5673E9C601B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
155+
{60530AF8-4790-4A85-BCE2-C5673E9C601B}.Debug|Any CPU.Build.0 = Debug|Any CPU
156+
{60530AF8-4790-4A85-BCE2-C5673E9C601B}.Release|Any CPU.ActiveCfg = Release|Any CPU
157+
{60530AF8-4790-4A85-BCE2-C5673E9C601B}.Release|Any CPU.Build.0 = Release|Any CPU
134158
EndGlobalSection
135159
GlobalSection(SolutionProperties) = preSolution
136160
HideSolutionNode = FALSE
@@ -139,7 +163,6 @@ Global
139163
{512B0511-41AB-444D-BAD8-E19B7D3B52CB} = {DA8EFCA8-5396-48C7-8DC0-CB28A09488D9}
140164
{8B9F2E93-B31B-4BA7-920D-732695A473E6} = {9AF522B5-8923-41E6-8A0A-FAE8E8F83439}
141165
{E7468FDD-75F7-4B08-BA47-B715BBCFCC11} = {D40853F1-B3C5-418A-B1D3-E0FB70B2F394}
142-
{F37D23AA-4EA9-4E07-9B3D-F966ABED046F} = {9AF522B5-8923-41E6-8A0A-FAE8E8F83439}
143166
{7C8D906E-426B-49AB-9072-178555370F62} = {9AF522B5-8923-41E6-8A0A-FAE8E8F83439}
144167
{F8F6973C-5831-43D1-89C2-1AD543CE7408} = {9AF522B5-8923-41E6-8A0A-FAE8E8F83439}
145168
{D40853F1-B3C5-418A-B1D3-E0FB70B2F394} = {2D44BDCF-B70C-4C02-BDC8-4F1DD5066A75}
@@ -158,6 +181,11 @@ Global
158181
{D1F15D97-802E-4AA3-A4A5-B890ABE32897} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
159182
{2FFA5BCE-B3C3-46EA-8830-838C938BF814} = {1460800B-D9ED-4147-B1E7-ABF502BEF59A}
160183
{4F09B6D1-3F83-45A0-AEC8-0F243E7CD263} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
184+
{DD2973AE-D1FC-4307-AFE2-EE2945183D3D} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
185+
{D4CF08F5-8EAB-48FB-AAA3-1A221F7B2A82} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
186+
{948C1EA8-12DB-4F8A-A190-8615DFBD9FE4} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
187+
{141532E1-540E-4E50-8723-96936C191281} = {B43459A1-709B-4623-9677-AAC2FEE4FBA3}
188+
{60530AF8-4790-4A85-BCE2-C5673E9C601B} = {1460800B-D9ED-4147-B1E7-ABF502BEF59A}
161189
EndGlobalSection
162190
GlobalSection(ExtensibilityGlobals) = postSolution
163191
SolutionGuid = {3833E7C5-69BC-4CB3-92CE-A8854AA35D8A}

System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/linux-x64.pubxml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
66
<PropertyGroup>
7+
<DefineConstants>PUBLISH;$(DefineConstants)</DefineConstants>
78
<Configuration>Release</Configuration>
89
<Platform>Any CPU</Platform>
9-
<PublishDir>bin\Release\Publish</PublishDir>
10+
<PublishDir>bin\Release\Publish\linux-x64</PublishDir>
1011
<PublishProtocol>FileSystem</PublishProtocol>
1112
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
1213
<SelfContained>true</SelfContained>
13-
<PublishSingleFile>True</PublishSingleFile>
14+
<PublishSingleFile>true</PublishSingleFile>
1415
<PublishTrimmed>True</PublishTrimmed>
1516
<TrimMode>link</TrimMode>
1617
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>

System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/osx-x64.pubxml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
66
<PropertyGroup>
7+
<DefineConstants>PUBLISH;$(DefineConstants)</DefineConstants>
78
<Configuration>Release</Configuration>
89
<Platform>Any CPU</Platform>
9-
<PublishDir>bin\Release\Publish</PublishDir>
10+
<PublishDir>bin\Release\Publish\osx-x64</PublishDir>
1011
<PublishProtocol>FileSystem</PublishProtocol>
1112
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
1213
<SelfContained>true</SelfContained>
13-
<PublishSingleFile>True</PublishSingleFile>
14+
<PublishSingleFile>true</PublishSingleFile>
1415
<PublishTrimmed>True</PublishTrimmed>
1516
<TrimMode>link</TrimMode>
1617
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>

System.Application.SteamTools.Client.Desktop.Avalonia.App/Properties/PublishProfiles/win-x64.pubxml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
66
<PropertyGroup>
7+
<DefineConstants>PUBLISH;$(DefineConstants)</DefineConstants>
78
<Configuration>Release</Configuration>
89
<Platform>Any CPU</Platform>
9-
<PublishDir>bin\Release\Publish</PublishDir>
10+
<PublishDir>bin\Release\Publish\win-x64</PublishDir>
1011
<PublishProtocol>FileSystem</PublishProtocol>
1112
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1213
<SelfContained>true</SelfContained>
13-
<PublishSingleFile>True</PublishSingleFile>
14+
<PublishSingleFile>true</PublishSingleFile>
15+
<PublishReadyToRun>true</PublishReadyToRun>
16+
<!--可以通过将应用程序集编译为 ReadyToRun (R2R) 格式来改进 .NET Core 应用程序的启动时间和延迟。 R2R 是一种预先 (AOT) 编译形式 https://docs.microsoft.com/zh-cn/dotnet/core/deploying/ready-to-run-->
1417
<PublishTrimmed>True</PublishTrimmed>
1518
<TrimMode>link</TrimMode>
19+
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
20+
<!--剪裁框架库功能 https://docs.microsoft.com/zh-cn/dotnet/core/deploying/trimming-options#trimming-framework-library-features-->
21+
<DebuggerSupport>false</DebuggerSupport>
22+
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
23+
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
1624
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
25+
<EventSourceSupport>false</EventSourceSupport>
26+
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
27+
<UseSystemResourceKeys>true</UseSystemResourceKeys>
1728
<DebugType>none</DebugType>
1829
<DebugSymbols>false</DebugSymbols>
1930
</PropertyGroup>

System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,24 @@
1919

2020
<ItemGroup>
2121
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop.Avalonia\System.Application.SteamTools.Client.Desktop.Avalonia.csproj" />
22+
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop.Platform\System.Application.SteamTools.Client.Desktop.Platform.csproj" />
2223
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop\System.Application.SteamTools.Client.Desktop.csproj" />
2324
<ProjectReference Include="..\System.Common.CoreLib\System.Common.CoreLib.csproj" />
24-
<ProjectReference Include="..\System.Common.DesktopLib\System.Common.DesktopLib.csproj" />
25+
</ItemGroup>
26+
27+
<ItemGroup Condition=" $(RuntimeIdentifier.Contains(`win`)) Or ('$(OS)' == 'Windows_NT' And !$(DefineConstants.Contains(`PUBLISH`))) ">
28+
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop.Platform.Windows\System.Application.SteamTools.Client.Desktop.Platform.Windows.csproj" />
29+
</ItemGroup>
30+
31+
<ItemGroup Condition=" $(RuntimeIdentifier.Contains(`osx`)) Or ('$(OS)' == 'OSX' And !$(DefineConstants.Contains(`PUBLISH`))) ">
32+
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop.Platform.Mac\System.Application.SteamTools.Client.Desktop.Platform.Mac.csproj" />
33+
</ItemGroup>
34+
35+
<ItemGroup Condition=" $(RuntimeIdentifier.Contains(`linux`)) Or ('$(OS)' == 'Unix' And !$(DefineConstants.Contains(`PUBLISH`))) ">
36+
<ProjectReference Include="..\System.Application.SteamTools.Client.Desktop.Platform.Linux\System.Application.SteamTools.Client.Desktop.Platform.Linux.csproj" />
2537
</ItemGroup>
2638

2739
<ItemGroup>
28-
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
2940
<PackageReference Include="MessageBox.Avalonia" Version="1.0.5">
3041
<Aliases>MessageBox_Avalonia</Aliases>
3142
</PackageReference>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
using Avalonia.Input;
2+
using System.Collections.Generic;
3+
4+
namespace System.Application.UI
5+
{
6+
/// <summary>
7+
/// 拖拽功能工具类
8+
/// https://github.com/AvaloniaUI/Avalonia/blob/0.10.0-preview6/samples/ControlCatalog/Pages/DragAndDropPage.xaml.cs
9+
/// </summary>
10+
public static class DragDropUtil
11+
{
12+
public static void InitDragDrop(this IOnDragDropListener listener,
13+
InputElement element)
14+
{
15+
element.PointerPressed += async (_, e)
16+
=> await DragDrop.DoDragDrop(e, new DataObject(), DragDropEffects.Copy);
17+
element.AddHandler(DragDrop.DropEvent, Drop);
18+
element.AddHandler(DragDrop.DragOverEvent, DragOver);
19+
20+
void DragOver(object? s, DragEventArgs? e)
21+
{
22+
if (e?.Data == null) return;
23+
listener.DragOver(s is InputElement el ? el : element, e);
24+
}
25+
26+
void Drop(object? s, DragEventArgs? e)
27+
{
28+
if (e?.Data == null) return;
29+
listener.Drop(s is InputElement el ? el : element, e);
30+
}
31+
}
32+
33+
public static void InitDragDrop(this IOnDragDropListener listener,
34+
IEnumerable<InputElement> elements)
35+
{
36+
foreach (var element in elements)
37+
{
38+
listener.InitDragDrop(element);
39+
}
40+
}
41+
42+
public static void InitDragDrop(this IOnDragDropListener listener,
43+
params InputElement[] elements)
44+
{
45+
IEnumerable<InputElement> elements_ = elements;
46+
listener.InitDragDrop(elements_);
47+
}
48+
49+
public interface IOnDragDropListener
50+
{
51+
void DragOver(InputElement sender, DragEventArgs e)
52+
{
53+
// Only allow Copy or Link as Drop Operations.
54+
e.DragEffects &= (DragDropEffects.Copy | DragDropEffects.Link);
55+
56+
// Only allow if the dragged data contains text or filenames.
57+
if (!e.Data.Contains(DataFormats.Text)
58+
&& !e.Data.Contains(DataFormats.FileNames))
59+
e.DragEffects = DragDropEffects.None;
60+
}
61+
62+
void Drop(InputElement sender, DragEventArgs e)
63+
{
64+
if (e.Data.Contains(DataFormats.Text))
65+
{
66+
var text = e.Data.GetText();
67+
if (text != null)
68+
{
69+
DropText(sender, text);
70+
}
71+
}
72+
else if (e.Data.Contains(DataFormats.FileNames))
73+
{
74+
var fileNames = e.Data.GetFileNames();
75+
if (fileNames != null)
76+
{
77+
DropFileNames(sender, fileNames);
78+
}
79+
}
80+
}
81+
82+
/// <summary>
83+
/// 拖拽文本
84+
/// </summary>
85+
/// <param name="sender"></param>
86+
/// <param name="text"></param>
87+
void DropText(InputElement sender, string text);
88+
89+
/// <summary>
90+
/// 拖拽路径,路径可能是文件也可能是文件夹
91+
/// </summary>
92+
/// <param name="sender"></param>
93+
/// <param name="fileNames"></param>
94+
void DropFileNames(InputElement sender, IEnumerable<string> fileNames);
95+
}
96+
}
97+
}

0 commit comments

Comments
 (0)