Skip to content

Commit

Permalink
修复搜索崩溃的问题 (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy authored Jan 6, 2024
1 parent 093915c commit 7c0d248
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/App/Controls/Base/CardPanel/CardPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HostContainer" Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Path=DisabledBorderBrush, RelativeSource={RelativeSource Mode=TemplatedParent}, UpdateSourceTrigger=PropertyChanged}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextFillColorDisabledBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState.Storyboard>
</VisualState>
Expand Down
1 change: 1 addition & 0 deletions src/App/Controls/Modules/SearchNavListModule.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<base:CardPanel
Click="OnModuleItemClick"
DataContext="{x:Bind}"
DisabledBackground="Transparent"
IsChecked="{x:Bind IsSelected, Mode=OneWay}"
IsEnableCheck="False"
IsEnabled="{x:Bind IsEnabled, Mode=OneWay}">
Expand Down
5 changes: 4 additions & 1 deletion src/App/Forms/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ private void OnRequestSearch(object sender, string e)

if (OverlayFrame.Content is not SearchPage)
{
_ = OverlayFrame.Navigate(typeof(SearchPage), _appViewModel.Search);
var vm = new SearchDetailViewModel();
vm.SetKeyword(e);
vm.InitializeCommand.Execute(default);
_ = OverlayFrame.Navigate(typeof(SearchPage), vm);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public sealed partial class AppViewModel
[ObservableProperty]
private bool _isOverlayShown;

[ObservableProperty]
private SearchDetailViewModel _search;

[ObservableProperty]
private MessageDetailViewModel _message;

Expand Down
3 changes: 0 additions & 3 deletions src/ViewModels/Components/AppViewModel/AppViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ private AppViewModel()
_dispatcherQueue = DispatcherQueue.GetForCurrentThread();
NavigateItems = new ObservableCollection<NavigateItemViewModel>();
DisplayWindows = new List<Window>();
Search = new SearchDetailViewModel();
Message = MessageDetailViewModel.Instance;
Fans = new FansDetailViewModel();
Follows = MyFollowsDetailViewModel.Instance;
Expand Down Expand Up @@ -185,8 +184,6 @@ private void OpenPlaylist(List<VideoInformation> playlist)
private void SearchContent(string text)
{
IsOverlayShown = true;
Search.SetKeyword(text);
Search.InitializeCommand.Execute(default);
RequestSearch?.Invoke(this, text);
}

Expand Down

0 comments on commit 7c0d248

Please sign in to comment.