mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
Notes: -Uses a copy of VirtualizingStackPanel (to include fixes done after preview6) + fix another issue in lists -Fixes memory leaks when closing windows (by setting DataContext to null, etc.)
70 lines
1.4 KiB
C#
70 lines
1.4 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Threading;
|
|
using DataBoxControl;
|
|
using Mesen.Debugger.Controls;
|
|
using Mesen.Debugger.Utilities;
|
|
using Mesen.Debugger.ViewModels;
|
|
using Mesen.Interop;
|
|
using System;
|
|
using System.ComponentModel;
|
|
|
|
namespace Mesen.Debugger.Windows
|
|
{
|
|
public class MemorySearchWindow : MesenWindow, INotificationHandler
|
|
{
|
|
private MemorySearchViewModel _model;
|
|
|
|
public MemorySearchWindow()
|
|
{
|
|
_model = new MemorySearchViewModel();
|
|
DataContext = _model;
|
|
|
|
InitializeComponent();
|
|
#if DEBUG
|
|
this.AttachDevTools();
|
|
#endif
|
|
|
|
if(Design.IsDesignMode) {
|
|
return;
|
|
}
|
|
|
|
_model.Config.LoadWindowSettings(this);
|
|
}
|
|
|
|
protected override void OnClosing(WindowClosingEventArgs e)
|
|
{
|
|
base.OnClosing(e);
|
|
_model.Config.SaveWindowSettings(this);
|
|
}
|
|
|
|
public void ProcessNotification(NotificationEventArgs e)
|
|
{
|
|
switch(e.NotificationType) {
|
|
case ConsoleNotificationType.GameLoaded:
|
|
Dispatcher.UIThread.Post(() => {
|
|
_model.OnGameLoaded();
|
|
});
|
|
break;
|
|
|
|
case ConsoleNotificationType.PpuFrameDone:
|
|
if(!ToolRefreshHelper.LimitFps(this, 30)) {
|
|
_model.RefreshData(false);
|
|
}
|
|
break;
|
|
|
|
case ConsoleNotificationType.CodeBreak:
|
|
_model.RefreshData(true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
}
|
|
}
|