Skip to content

Commit

Permalink
Merge pull request #10 from kctekn/master
Browse files Browse the repository at this point in the history
双击粘贴剪贴板的分享地址,和扩大的“解析链接”按钮:避免被提示气泡遮挡。
  • Loading branch information
K12f authored Dec 17, 2024
2 parents 823fffc + 9a8307c commit 60f6fca
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 39 deletions.
50 changes: 24 additions & 26 deletions src/BlueCatKoKo.Ui/BlueCatKoKo.Ui.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
Expand All @@ -8,7 +8,7 @@
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>BlueCatKoKo</AssemblyName>
<AssemblyVersion>1.5.0</AssemblyVersion>
<AssemblyVersion>1.5.1</AssemblyVersion>
<UseWPF>true</UseWPF>
<MvvmToolkitEnableINotifyPropertyChangingSupport>false</MvvmToolkitEnableINotifyPropertyChangingSupport>

Expand Down Expand Up @@ -49,23 +49,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2"/>
<PackageReference Include="Downloader" Version="3.1.2"/>
<PackageReference Include="HandyControl" Version="3.5.1"/>
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.4.5"/>
<PackageReference Include="RestSharp" Version="112.1.0"/>
<PackageReference Include="Serilog" Version="4.0.1"/>
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0"/>
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0"/>
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0"/>
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.20"/>
<PackageReference Include="WPF-UI" Version="3.0.5"/>
<PackageReference Include="WPF-UI.Tray" Version="3.0.5"/>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Downloader" Version="3.1.2" />
<PackageReference Include="HandyControl" Version="3.5.1" />
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.4.5" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.20" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
</ItemGroup>

<PropertyGroup>
Expand All @@ -79,19 +79,17 @@
</ItemGroup>

<ItemGroup>
<None Include="$(ProjectDir)Assets\**"
CopyToOutputDirectory="PreserveNewest"
LinkBase="Assets\"/>
<None Include="$(ProjectDir)Assets\**" CopyToOutputDirectory="PreserveNewest" LinkBase="Assets\" />
</ItemGroup>

<ItemGroup>
<None Remove="applicationicon.ico"/>
<Resource Include="applicationicon.ico"/>
<None Remove="applicationicon.ico" />
<Resource Include="applicationicon.ico" />
</ItemGroup>

<ItemGroup>
<None Remove="Assets\applicationicon.jpg"/>
<Resource Include="Assets\applicationicon.jpg"/>
<None Remove="Assets\applicationicon.jpg" />
<Resource Include="Assets\applicationicon.jpg" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions src/BlueCatKoKo.Ui/Models/VideoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class VideoModel
// 作者
public string? AuthorName { get; set; }

// Unique Id
public string? UniqueId { get; set; }

// 头像
public string? AuthorAvatar { get; set; }

Expand Down
1 change: 1 addition & 0 deletions src/BlueCatKoKo.Ui/Services/DouYinShortVideoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public async Task<VideoModel> ExtractVideoDataAsync(string url)
Platform = ShortVideoPlatformEnum.DouYin,
VideoId = videoInfoData.AwemeId,
AuthorName = videoInfoData.Author.Nickname,
UniqueId = videoInfoData.Author.UniqueId,
AuthorAvatar = videoInfoData.Author.AvatarThumb.UrlList.First().ToString(),
Title = videoInfoData.Author.Signature,
Cover = videoInfoData.Video.Cover.UrlList.Last().ToString(),
Expand Down
2 changes: 1 addition & 1 deletion src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private async Task DownloadAll()
}

var filepath = _appConfig.Value.DownloadPath;
var filename = Data.Desc + ".mp4";
var filename = "#" + Data.AuthorName + "#" + Data.UniqueId + "# "+ Data.Desc + ".mp4";

var replaceFilename = filename.ReplaceInvalidCharacters();

Expand Down
26 changes: 14 additions & 12 deletions src/BlueCatKoKo.Ui/Views/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@
d:DesignWidth="1366">
<Grid>
<StackPanel Margin="10">
<hc:Row Margin="0,0,0,0">
<hc:Col Span="20">
<TextBox Text="{Binding ViewModel.DownloadUrlText}"
<hc:Row Margin="0,0,0,0">
<hc:Col Span="20">
<TextBox Text="{Binding ViewModel.DownloadUrlText}"
hc:InfoElement.Placeholder="请粘贴抖音 分享链接"
Style="{StaticResource TextBoxExtend}" />
</hc:Col>
<hc:Col Span="4">
<Button Style="{StaticResource ButtonPrimary}" Content="解析链接" Command="{Binding ViewModel.ParseCommand}"
IsEnabled="{Binding ViewModel.IsDisableParsingBtn}" Margin="5" />
</hc:Col>
</hc:Row>
<hc:Row>
<hc:Col Span="20">
Style="{StaticResource TextBoxExtend}" MouseDoubleClick="clearContent"/>
</hc:Col>
</hc:Row>
<hc:Row Margin="0,0,0,0">
<hc:Col Span="20" Margin="0,0,0,0">
<Button Style="{StaticResource ButtonPrimary}" Content="解析链接" Command="{Binding ViewModel.ParseCommand}"
IsEnabled="{Binding ViewModel.IsDisableParsingBtn}" Margin="5" HorizontalAlignment="Stretch" />
</hc:Col>
</hc:Row>
<hc:Row>
<hc:Col Span="20">
<hc:UniformSpacingPanel Orientation="Vertical">
<ProgressBar Style="{StaticResource ProgressBarInfo}" Visibility="{Binding ViewModel.IsDownload}"
Value="{Binding ViewModel.DownloadProcess}" Maximum="100" />
Expand Down
21 changes: 21 additions & 0 deletions src/BlueCatKoKo.Ui/Views/Pages/HomePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using BlueCatKoKo.Ui.ViewModels.Pages;
Expand All @@ -14,5 +15,25 @@ public HomePage(HomeViewModel viewModel)
InitializeComponent();
ViewModel = viewModel;
DataContext = this;
}

private void clearContent(object sender, MouseButtonEventArgs e)
{
// 将 sender 转换为 TextBox 对象
TextBox textBox = sender as TextBox;

// 清空 TextBox 的内容
//if (textBox != null)
//{
// textBox.Text = ""; // 清空文本框内容
//}

// 如果 sender 是一个 TextBox,并且剪贴板包含文本
if (textBox != null && Clipboard.ContainsText())
{
// 将剪贴板中的文本设置为 TextBox 的内容
textBox.Text = Clipboard.GetText();
}
}

}

0 comments on commit 60f6fca

Please sign in to comment.