Skip to content

Commit

Permalink
按钮增加图标
Browse files Browse the repository at this point in the history
  • Loading branch information
hupo376787 committed Oct 23, 2024
1 parent c1a0473 commit 53ce8c4
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 15 deletions.
Binary file added WeiboAlbumDownloader/Assets/cloud-computing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WeiboAlbumDownloader/Assets/cookie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WeiboAlbumDownloader/Assets/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WeiboAlbumDownloader/Assets/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 49 additions & 14 deletions WeiboAlbumDownloader/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
xmlns:local="clr-namespace:WeiboAlbumDownloader"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mica="clr-namespace:MicaWPF.Controls;assembly=MicaWPF"
Title="微博相册下载"
Title="微博相册/视频/LivePhoto下载"
Width="1024"
Height="618"
FontFamily="宋体"
FontFamily="微软雅黑"
Icon="/weibo.ico"
SizeChanged="MicaWindow_SizeChanged"
SystemBackdropType="Acrylic"
Expand Down Expand Up @@ -42,40 +42,75 @@
<ComboBox
x:Name="ComboBox_DataSource"
Margin="8"
SelectionChanged="ComboBox_DataSource_SelectionChanged" />
SelectionChanged="ComboBox_DataSource_SelectionChanged"
ToolTip="不懂的话选择默认即可" />
<mica:Button
Width="160"
Height="32"
Margin="8,0"
Background="LightYellow"
Click="GetCookie"
Content="扫码获取Cookie" />
ToolTip="打开手机版微博,扫描二维码确认登陆">
<StackPanel Orientation="Horizontal">
<Image Width="18" Source="/Assets/cookie.png" />
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="扫码获取Cookie" />
</StackPanel>
</mica:Button>
<mica:TextBox
x:Name="TextBox_WeiboId"
Width="140"
Height="32"
Margin="8,0"
KeyUp="TextBox_WeiboId_KeyUp"
ToolTip="填写uid单用户下载或者uidList.txt进行批量下载"
ToolTip="填写uid进行单用户下载或者uidList.txt进行批量下载"
Watermark="uid" />
<mica:Button
Width="160"
Height="32"
Margin="8,0"
Click="StartDownLoad"
Content="开始下载" />
<mica:Button
ToolTip="开始/停止下载,停止下载的时候可能有延后,因为需要等待分页任务下载完才能停">
<StackPanel Orientation="Horizontal">
<Image Width="18" Source="/Assets/cloud-computing.png" />
<TextBlock
x:Name="tbDownload"
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="开始下载" />
</StackPanel>
</mica:Button>
<!--<mica:Button
Width="140"
Height="32"
Margin="8,0"
Click="StopDownLoad"
Content="停止下载" />
Content="停止下载" />-->
<mica:Button
Width="140"
Height="32"
Margin="8,0"
Click="OpenDir"
Content="打开下载目录" />
Click="OpenDir">
<StackPanel Orientation="Horizontal">
<Image Width="18" Source="/Assets/download.png" />
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="打开下载目录" />
</StackPanel>
</mica:Button>
<mica:Button
Width="64"
Height="32"
Margin="8,0"
Click="OpenGithub"
ToolTip="Fork me on Github">
<StackPanel Orientation="Horizontal">
<Image Width="24" Source="/Assets/github.png" />
</StackPanel>
</mica:Button>
</StackPanel>

<TextBlock
Expand Down Expand Up @@ -118,7 +153,7 @@
BorderThickness="0"
FontSize="22"
FontWeight="Bold"
Foreground="#FFBF00" />
Foreground="Gray" />
<TextBox
x:Name="TextBlock_NickName"
Width="256"
Expand All @@ -128,15 +163,15 @@
d:Text="昵称"
Background="Transparent"
BorderThickness="0"
FontSize="36"
FontSize="32"
FontWeight="Bold"
Foreground="#FFBF00" />
Foreground="Gray" />
<TextBlock
x:Name="TextBlock_WeiboDesc"
HorizontalAlignment="Center"
d:Text="微博[888] 关注[274] 粉丝[7.9万] 分组[1]"
FontSize="16"
Foreground="#EBB000" />
Foreground="Gray" />
</StackPanel>
<ListView
x:Name="ListView_Messages"
Expand Down
16 changes: 15 additions & 1 deletion WeiboAlbumDownloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,16 @@ private void InitData()
#region UI操作
private async void StartDownLoad(object sender, RoutedEventArgs e)
{
await Start(TextBox_WeiboId.Text.Trim());
if (tbDownload.Text == "开始下载")
{
tbDownload.Text = "停止下载";
await Start(TextBox_WeiboId.Text.Trim());
}
else
{
tbDownload.Text = "开始下载";
cancellationTokenSource?.Cancel();
}
}

private void StopDownLoad(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -1134,5 +1143,10 @@ private async void TextBox_WeiboId_KeyUp(object sender, System.Windows.Input.Key
if (e.Key == System.Windows.Input.Key.Enter)
await Start(TextBox_WeiboId.Text.Trim());
}

private void OpenGithub(object sender, RoutedEventArgs e)
{
Process.Start(new ProcessStartInfo("https://github.com/hupo376787/WeiboAlbumDownloader") { UseShellExecute = true });
}
}
}
14 changes: 14 additions & 0 deletions WeiboAlbumDownloader/WeiboAlbumDownloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Assets\cloud-computing.png" />
<None Remove="Assets\cookie.png" />
<None Remove="Assets\download.png" />
<None Remove="Assets\github.png" />
</ItemGroup>

<ItemGroup>
<Resource Include="Assets\github.png" />
</ItemGroup>

<ItemGroup>
<Resource Include="Assets\cloud-computing.png" />
<Resource Include="Assets\cookie.png" />
<Resource Include="Assets\download.png" />
<Resource Include="weibo.ico" />
</ItemGroup>

Expand Down

0 comments on commit 53ce8c4

Please sign in to comment.