mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-10 11:11:32 -10:00
Also fixes DX11.0 support (for Win7 PCs that aren't fully updated), which stopped working after the recent variable refresh rate changes
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Controls.Selection;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Mesen.Debugger.Integration;
|
|
using Mesen.Debugger.Utilities;
|
|
using Mesen.Interop;
|
|
using Mesen.Utilities;
|
|
using Mesen.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Mesen.Debugger.ViewModels;
|
|
|
|
public partial class GoToAllViewModel : DisposableViewModel
|
|
{
|
|
[ObservableProperty] public partial string SearchString { get; set; } = "";
|
|
[ObservableProperty] public partial List<SearchResultInfo> SearchResults { get; set; } = new();
|
|
[ObservableProperty] public partial SearchResultInfo? SelectedItem { get; set; } = null;
|
|
[ObservableProperty] public partial bool CanSelect { get; set; } = false;
|
|
|
|
public SelectionModel<SearchResultInfo?> SelectionModel { get; private set; } = new();
|
|
|
|
[Obsolete("For designer only")]
|
|
public GoToAllViewModel() : this(CpuType.Snes, GoToAllOptions.None) { }
|
|
|
|
public GoToAllViewModel(CpuType cpuType, GoToAllOptions options, ISymbolProvider? symbolProvider = null)
|
|
{
|
|
AddDisposable(this.ObserveProp(nameof(SearchString), () => {
|
|
SearchResults = SearchHelper.GetGoToAllResults(cpuType, SearchString, options, symbolProvider);
|
|
if(SearchResults.Count > 0) {
|
|
SelectionModel.SelectedIndex = 0;
|
|
}
|
|
}));
|
|
|
|
AddDisposable(SelectionModel.ObserveProp(nameof(SelectionModel.SelectedItem), () => {
|
|
CanSelect = SelectionModel.SelectedItem?.Disabled == false;
|
|
}));
|
|
}
|
|
}
|