Skip to content

Commit

Permalink
â� actor: 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
K12f committed Aug 27, 2024
1 parent dec845b commit e87cf54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/BlueCatKoKo.Ui/ViewModels/Pages/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ [ObservableProperty] [Required(ErrorMessage = "缺少分享链接")]
[ObservableProperty] private string _isDownload;

// 解析按钮状态,正在解析/下载时,禁止点击
[ObservableProperty] private bool _parsingBtnStatus;
[ObservableProperty] private bool _isDisableParsingBtn;

// 是否下载音频,默认false
[ObservableProperty] private bool _isDownloadAudio;
Expand All @@ -66,7 +66,7 @@ public HomeViewModel(IMessenger messenger, ILogger logger, DouyinDownloaderServi
IsDownloadVideo = true;

IsDownload = "Hidden";
ParsingBtnStatus = true;
IsDisableParsingBtn = true;


_logger = logger;
Expand All @@ -90,7 +90,7 @@ public HomeViewModel(IMessenger messenger, ILogger logger, DouyinDownloaderServi
private async Task Parse()
{
ValidateAllProperties();
ParsingBtnStatus = false;
IsDisableParsingBtn = false;
string message = "解析成功~";
DownloaderEnum type = DownloaderEnum.Success;

Expand Down Expand Up @@ -151,7 +151,7 @@ private async Task Parse()
}
finally
{
ParsingBtnStatus = true;
IsDisableParsingBtn = true;
IsParsed = "Visible";
DownloaderMessage downloadMessage = new(type, message, DownloadUrlText);
Messenger.Send(new ValueChangedMessage<DownloaderMessage>(downloadMessage));
Expand All @@ -162,7 +162,7 @@ private async Task Parse()
private async Task DownloadAll()
{
IsDownload = "Visible";
ParsingBtnStatus = false;
IsDisableParsingBtn = false;

string message = "下载中...";
DownloaderEnum type = DownloaderEnum.Success;
Expand Down Expand Up @@ -199,7 +199,7 @@ await _douyinDownloaderService.Download(Data.VideoUrl, _appConfig.Value.Download
finally
{
IsDownload = "hidden";
ParsingBtnStatus = true;
IsDisableParsingBtn = true;
DownloaderMessage downloadMessage = new(type, message, DownloadUrlText);
Messenger.Send(new ValueChangedMessage<DownloaderMessage>(downloadMessage));
}
Expand Down
2 changes: 1 addition & 1 deletion src/BlueCatKoKo.Ui/Views/Pages/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</hc:Col>
<hc:Col Span="4">
<Button Style="{StaticResource ButtonPrimary}" Content="解析链接" Command="{Binding ViewModel.ParseCommand}"
IsEnabled="{Binding ViewModel.ParsingBtnStatus}" Margin="5" />
IsEnabled="{Binding ViewModel.IsDisableParsingBtn}" Margin="5" />
</hc:Col>
</hc:Row>
<hc:Row>
Expand Down

0 comments on commit e87cf54

Please sign in to comment.