SettingsViewModel.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. using Avalonia.Collections;
  2. using Avalonia.Controls;
  3. using Avalonia.Threading;
  4. using DynamicData;
  5. using LibHac.Tools.FsSystem;
  6. using Ryujinx.Audio.Backends.OpenAL;
  7. using Ryujinx.Audio.Backends.SDL2;
  8. using Ryujinx.Audio.Backends.SoundIo;
  9. using Ryujinx.Ava.Common.Locale;
  10. using Ryujinx.Ava.UI.Helpers;
  11. using Ryujinx.Ava.UI.Windows;
  12. using Ryujinx.Common.Configuration;
  13. using Ryujinx.Common.Configuration.Hid;
  14. using Ryujinx.Common.GraphicsDriver;
  15. using Ryujinx.Common.Logging;
  16. using Ryujinx.Graphics.Vulkan;
  17. using Ryujinx.HLE.FileSystem;
  18. using Ryujinx.HLE.HOS.Services.Time.TimeZone;
  19. using Ryujinx.Ui.Common.Configuration;
  20. using Ryujinx.Ui.Common.Configuration.System;
  21. using System;
  22. using System.Collections.Generic;
  23. using System.Collections.ObjectModel;
  24. using System.Linq;
  25. using System.Runtime.InteropServices;
  26. using System.Net.NetworkInformation;
  27. using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
  28. using Silk.NET.Vulkan;
  29. namespace Ryujinx.Ava.UI.ViewModels
  30. {
  31. public class SettingsViewModel : BaseModel
  32. {
  33. private readonly VirtualFileSystem _virtualFileSystem;
  34. private readonly ContentManager _contentManager;
  35. private TimeZoneContentManager _timeZoneContentManager;
  36. private readonly List<string> _validTzRegions;
  37. private readonly Dictionary<string, string> _networkInterfaces;
  38. private float _customResolutionScale;
  39. private int _resolutionScale;
  40. private int _graphicsBackendMultithreadingIndex;
  41. private float _volume;
  42. private bool _isVulkanAvailable = true;
  43. private bool _directoryChanged;
  44. private List<string> _gpuIds = new();
  45. private KeyboardHotkeys _keyboardHotkeys;
  46. private int _graphicsBackendIndex;
  47. private string _customThemePath;
  48. private int _scalingFilter;
  49. private int _scalingFilterLevel;
  50. public event Action CloseWindow;
  51. public event Action SaveSettingsEvent;
  52. private int _networkInterfaceIndex;
  53. public int ResolutionScale
  54. {
  55. get => _resolutionScale;
  56. set
  57. {
  58. _resolutionScale = value;
  59. OnPropertyChanged(nameof(CustomResolutionScale));
  60. OnPropertyChanged(nameof(IsCustomResolutionScaleActive));
  61. }
  62. }
  63. public int GraphicsBackendMultithreadingIndex
  64. {
  65. get => _graphicsBackendMultithreadingIndex;
  66. set
  67. {
  68. _graphicsBackendMultithreadingIndex = value;
  69. if (_graphicsBackendMultithreadingIndex != (int)ConfigurationState.Instance.Graphics.BackendThreading.Value)
  70. {
  71. Dispatcher.UIThread.Post(async () =>
  72. {
  73. await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningMessage],
  74. "",
  75. "",
  76. LocaleManager.Instance[LocaleKeys.InputDialogOk],
  77. LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningTitle]);
  78. });
  79. }
  80. OnPropertyChanged();
  81. }
  82. }
  83. public float CustomResolutionScale
  84. {
  85. get => _customResolutionScale;
  86. set
  87. {
  88. _customResolutionScale = MathF.Round(value, 1);
  89. OnPropertyChanged();
  90. }
  91. }
  92. public bool IsVulkanAvailable
  93. {
  94. get => _isVulkanAvailable;
  95. set
  96. {
  97. _isVulkanAvailable = value;
  98. OnPropertyChanged();
  99. }
  100. }
  101. public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS();
  102. public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
  103. public bool DirectoryChanged
  104. {
  105. get => _directoryChanged;
  106. set
  107. {
  108. _directoryChanged = value;
  109. OnPropertyChanged();
  110. }
  111. }
  112. public bool IsMacOS => OperatingSystem.IsMacOS();
  113. public bool EnableDiscordIntegration { get; set; }
  114. public bool CheckUpdatesOnStart { get; set; }
  115. public bool ShowConfirmExit { get; set; }
  116. public int HideCursor { get; set; }
  117. public bool EnableDockedMode { get; set; }
  118. public bool EnableKeyboard { get; set; }
  119. public bool EnableMouse { get; set; }
  120. public bool EnableVsync { get; set; }
  121. public bool EnablePptc { get; set; }
  122. public bool EnableInternetAccess { get; set; }
  123. public bool EnableFsIntegrityChecks { get; set; }
  124. public bool IgnoreMissingServices { get; set; }
  125. public bool ExpandDramSize { get; set; }
  126. public bool EnableShaderCache { get; set; }
  127. public bool EnableTextureRecompression { get; set; }
  128. public bool EnableMacroHLE { get; set; }
  129. public bool EnableFileLog { get; set; }
  130. public bool EnableStub { get; set; }
  131. public bool EnableInfo { get; set; }
  132. public bool EnableWarn { get; set; }
  133. public bool EnableError { get; set; }
  134. public bool EnableTrace { get; set; }
  135. public bool EnableGuest { get; set; }
  136. public bool EnableFsAccessLog { get; set; }
  137. public bool EnableDebug { get; set; }
  138. public bool IsOpenAlEnabled { get; set; }
  139. public bool IsSoundIoEnabled { get; set; }
  140. public bool IsSDL2Enabled { get; set; }
  141. public bool EnableCustomTheme { get; set; }
  142. public bool IsCustomResolutionScaleActive => _resolutionScale == 4;
  143. public bool IsScalingFilterActive => _scalingFilter == (int)Ryujinx.Common.Configuration.ScalingFilter.Fsr;
  144. public bool IsVulkanSelected => GraphicsBackendIndex == 0;
  145. public bool UseHypervisor { get; set; }
  146. public string TimeZone { get; set; }
  147. public string ShaderDumpPath { get; set; }
  148. public string CustomThemePath
  149. {
  150. get
  151. {
  152. return _customThemePath;
  153. }
  154. set
  155. {
  156. _customThemePath = value;
  157. OnPropertyChanged();
  158. }
  159. }
  160. public int Language { get; set; }
  161. public int Region { get; set; }
  162. public int FsGlobalAccessLogMode { get; set; }
  163. public int AudioBackend { get; set; }
  164. public int MaxAnisotropy { get; set; }
  165. public int AspectRatio { get; set; }
  166. public int AntiAliasingEffect { get; set; }
  167. public string ScalingFilterLevelText => ScalingFilterLevel.ToString("0");
  168. public int ScalingFilterLevel
  169. {
  170. get => _scalingFilterLevel;
  171. set
  172. {
  173. _scalingFilterLevel = value;
  174. OnPropertyChanged();
  175. OnPropertyChanged(nameof(ScalingFilterLevelText));
  176. }
  177. }
  178. public int OpenglDebugLevel { get; set; }
  179. public int MemoryMode { get; set; }
  180. public int BaseStyleIndex { get; set; }
  181. public int GraphicsBackendIndex
  182. {
  183. get => _graphicsBackendIndex;
  184. set
  185. {
  186. _graphicsBackendIndex = value;
  187. OnPropertyChanged();
  188. OnPropertyChanged(nameof(IsVulkanSelected));
  189. }
  190. }
  191. public int ScalingFilter
  192. {
  193. get => _scalingFilter;
  194. set
  195. {
  196. _scalingFilter = value;
  197. OnPropertyChanged();
  198. OnPropertyChanged(nameof(IsScalingFilterActive));
  199. }
  200. }
  201. public int PreferredGpuIndex { get; set; }
  202. public float Volume
  203. {
  204. get => _volume;
  205. set
  206. {
  207. _volume = value;
  208. ConfigurationState.Instance.System.AudioVolume.Value = _volume / 100;
  209. OnPropertyChanged();
  210. }
  211. }
  212. public DateTimeOffset CurrentDate { get; set; }
  213. public TimeSpan CurrentTime { get; set; }
  214. internal AvaloniaList<TimeZone> TimeZones { get; set; }
  215. public AvaloniaList<string> GameDirectories { get; set; }
  216. public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; }
  217. public AvaloniaList<string> NetworkInterfaceList
  218. {
  219. get => new AvaloniaList<string>(_networkInterfaces.Keys);
  220. }
  221. public KeyboardHotkeys KeyboardHotkeys
  222. {
  223. get => _keyboardHotkeys;
  224. set
  225. {
  226. _keyboardHotkeys = value;
  227. OnPropertyChanged();
  228. }
  229. }
  230. public int NetworkInterfaceIndex
  231. {
  232. get => _networkInterfaceIndex;
  233. set
  234. {
  235. _networkInterfaceIndex = value != -1 ? value : 0;
  236. ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[_networkInterfaceIndex]];
  237. }
  238. }
  239. public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
  240. {
  241. _virtualFileSystem = virtualFileSystem;
  242. _contentManager = contentManager;
  243. if (Program.PreviewerDetached)
  244. {
  245. LoadTimeZones();
  246. }
  247. }
  248. public SettingsViewModel()
  249. {
  250. GameDirectories = new AvaloniaList<string>();
  251. TimeZones = new AvaloniaList<TimeZone>();
  252. AvailableGpus = new ObservableCollection<ComboBoxItem>();
  253. _validTzRegions = new List<string>();
  254. _networkInterfaces = new Dictionary<string, string>();
  255. CheckSoundBackends();
  256. PopulateNetworkInterfaces();
  257. if (Program.PreviewerDetached)
  258. {
  259. LoadAvailableGpus();
  260. LoadCurrentConfiguration();
  261. }
  262. }
  263. public void CheckSoundBackends()
  264. {
  265. IsOpenAlEnabled = OpenALHardwareDeviceDriver.IsSupported;
  266. IsSoundIoEnabled = SoundIoHardwareDeviceDriver.IsSupported;
  267. IsSDL2Enabled = SDL2HardwareDeviceDriver.IsSupported;
  268. }
  269. private void LoadAvailableGpus()
  270. {
  271. _gpuIds = new List<string>();
  272. List<string> names = new();
  273. var devices = VulkanRenderer.GetPhysicalDevices(Vk.GetApi());
  274. if (devices.Length == 0)
  275. {
  276. IsVulkanAvailable = false;
  277. GraphicsBackendIndex = 1;
  278. }
  279. else
  280. {
  281. foreach (var device in devices)
  282. {
  283. _gpuIds.Add(device.Id);
  284. names.Add($"{device.Name} {(device.IsDiscrete ? "(dGPU)" : "")}");
  285. }
  286. }
  287. AvailableGpus.Clear();
  288. AvailableGpus.AddRange(names.Select(x => new ComboBoxItem { Content = x }));
  289. }
  290. public void LoadTimeZones()
  291. {
  292. _timeZoneContentManager = new TimeZoneContentManager();
  293. _timeZoneContentManager.InitializeInstance(_virtualFileSystem, _contentManager, IntegrityCheckLevel.None);
  294. foreach ((int offset, string location, string abbr) in _timeZoneContentManager.ParseTzOffsets())
  295. {
  296. int hours = Math.DivRem(offset, 3600, out int seconds);
  297. int minutes = Math.Abs(seconds) / 60;
  298. string abbr2 = abbr.StartsWith('+') || abbr.StartsWith('-') ? string.Empty : abbr;
  299. TimeZones.Add(new TimeZone($"UTC{hours:+0#;-0#;+00}:{minutes:D2}", location, abbr2));
  300. _validTzRegions.Add(location);
  301. }
  302. }
  303. private void PopulateNetworkInterfaces()
  304. {
  305. _networkInterfaces.Clear();
  306. _networkInterfaces.Add(LocaleManager.Instance[LocaleKeys.NetworkInterfaceDefault], "0");
  307. foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces())
  308. {
  309. _networkInterfaces.Add(networkInterface.Name, networkInterface.Id);
  310. }
  311. }
  312. public void ValidateAndSetTimeZone(string location)
  313. {
  314. if (_validTzRegions.Contains(location))
  315. {
  316. TimeZone = location;
  317. }
  318. }
  319. public void LoadCurrentConfiguration()
  320. {
  321. ConfigurationState config = ConfigurationState.Instance;
  322. // User Interface
  323. EnableDiscordIntegration = config.EnableDiscordIntegration;
  324. CheckUpdatesOnStart = config.CheckUpdatesOnStart;
  325. ShowConfirmExit = config.ShowConfirmExit;
  326. HideCursor = (int)config.HideCursor.Value;
  327. GameDirectories.Clear();
  328. GameDirectories.AddRange(config.Ui.GameDirs.Value);
  329. EnableCustomTheme = config.Ui.EnableCustomTheme;
  330. CustomThemePath = config.Ui.CustomThemePath;
  331. BaseStyleIndex = config.Ui.BaseStyle == "Light" ? 0 : 1;
  332. // Input
  333. EnableDockedMode = config.System.EnableDockedMode;
  334. EnableKeyboard = config.Hid.EnableKeyboard;
  335. EnableMouse = config.Hid.EnableMouse;
  336. // Keyboard Hotkeys
  337. KeyboardHotkeys = config.Hid.Hotkeys.Value;
  338. // System
  339. Region = (int)config.System.Region.Value;
  340. Language = (int)config.System.Language.Value;
  341. TimeZone = config.System.TimeZone;
  342. DateTime currentDateTime = DateTime.Now;
  343. CurrentDate = currentDateTime.Date;
  344. CurrentTime = currentDateTime.TimeOfDay.Add(TimeSpan.FromSeconds(config.System.SystemTimeOffset));
  345. EnableVsync = config.Graphics.EnableVsync;
  346. EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks;
  347. ExpandDramSize = config.System.ExpandRam;
  348. IgnoreMissingServices = config.System.IgnoreMissingServices;
  349. // CPU
  350. EnablePptc = config.System.EnablePtc;
  351. MemoryMode = (int)config.System.MemoryManagerMode.Value;
  352. UseHypervisor = config.System.UseHypervisor;
  353. // Graphics
  354. GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value;
  355. PreferredGpuIndex = _gpuIds.Contains(config.Graphics.PreferredGpu) ? _gpuIds.IndexOf(config.Graphics.PreferredGpu) : 0;
  356. EnableShaderCache = config.Graphics.EnableShaderCache;
  357. EnableTextureRecompression = config.Graphics.EnableTextureRecompression;
  358. EnableMacroHLE = config.Graphics.EnableMacroHLE;
  359. ResolutionScale = config.Graphics.ResScale == -1 ? 4 : config.Graphics.ResScale - 1;
  360. CustomResolutionScale = config.Graphics.ResScaleCustom;
  361. MaxAnisotropy = config.Graphics.MaxAnisotropy == -1 ? 0 : (int)(MathF.Log2(config.Graphics.MaxAnisotropy));
  362. AspectRatio = (int)config.Graphics.AspectRatio.Value;
  363. GraphicsBackendMultithreadingIndex = (int)config.Graphics.BackendThreading.Value;
  364. ShaderDumpPath = config.Graphics.ShadersDumpPath;
  365. AntiAliasingEffect = (int)config.Graphics.AntiAliasing.Value;
  366. ScalingFilter = (int)config.Graphics.ScalingFilter.Value;
  367. ScalingFilterLevel = config.Graphics.ScalingFilterLevel.Value;
  368. // Audio
  369. AudioBackend = (int)config.System.AudioBackend.Value;
  370. Volume = config.System.AudioVolume * 100;
  371. // Network
  372. EnableInternetAccess = config.System.EnableInternetAccess;
  373. // Logging
  374. EnableFileLog = config.Logger.EnableFileLog;
  375. EnableStub = config.Logger.EnableStub;
  376. EnableInfo = config.Logger.EnableInfo;
  377. EnableWarn = config.Logger.EnableWarn;
  378. EnableError = config.Logger.EnableError;
  379. EnableTrace = config.Logger.EnableTrace;
  380. EnableGuest = config.Logger.EnableGuest;
  381. EnableDebug = config.Logger.EnableDebug;
  382. EnableFsAccessLog = config.Logger.EnableFsAccessLog;
  383. FsGlobalAccessLogMode = config.System.FsGlobalAccessLogMode;
  384. OpenglDebugLevel = (int)config.Logger.GraphicsDebugLevel.Value;
  385. NetworkInterfaceIndex = _networkInterfaces.Values.ToList().IndexOf(config.Multiplayer.LanInterfaceId.Value);
  386. }
  387. public void SaveSettings()
  388. {
  389. ConfigurationState config = ConfigurationState.Instance;
  390. // User Interface
  391. config.EnableDiscordIntegration.Value = EnableDiscordIntegration;
  392. config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart;
  393. config.ShowConfirmExit.Value = ShowConfirmExit;
  394. config.HideCursor.Value = (HideCursorMode)HideCursor;
  395. if (_directoryChanged)
  396. {
  397. List<string> gameDirs = new(GameDirectories);
  398. config.Ui.GameDirs.Value = gameDirs;
  399. }
  400. config.Ui.EnableCustomTheme.Value = EnableCustomTheme;
  401. config.Ui.CustomThemePath.Value = CustomThemePath;
  402. config.Ui.BaseStyle.Value = BaseStyleIndex == 0 ? "Light" : "Dark";
  403. // Input
  404. config.System.EnableDockedMode.Value = EnableDockedMode;
  405. config.Hid.EnableKeyboard.Value = EnableKeyboard;
  406. config.Hid.EnableMouse.Value = EnableMouse;
  407. // Keyboard Hotkeys
  408. config.Hid.Hotkeys.Value = KeyboardHotkeys;
  409. // System
  410. config.System.Region.Value = (Region)Region;
  411. config.System.Language.Value = (Language)Language;
  412. if (_validTzRegions.Contains(TimeZone))
  413. {
  414. config.System.TimeZone.Value = TimeZone;
  415. }
  416. config.System.SystemTimeOffset.Value = Convert.ToInt64((CurrentDate.ToUnixTimeSeconds() + CurrentTime.TotalSeconds) - DateTimeOffset.Now.ToUnixTimeSeconds());
  417. config.Graphics.EnableVsync.Value = EnableVsync;
  418. config.System.EnableFsIntegrityChecks.Value = EnableFsIntegrityChecks;
  419. config.System.ExpandRam.Value = ExpandDramSize;
  420. config.System.IgnoreMissingServices.Value = IgnoreMissingServices;
  421. // CPU
  422. config.System.EnablePtc.Value = EnablePptc;
  423. config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
  424. config.System.UseHypervisor.Value = UseHypervisor;
  425. // Graphics
  426. config.Graphics.GraphicsBackend.Value = (GraphicsBackend)GraphicsBackendIndex;
  427. config.Graphics.PreferredGpu.Value = _gpuIds.ElementAtOrDefault(PreferredGpuIndex);
  428. config.Graphics.EnableShaderCache.Value = EnableShaderCache;
  429. config.Graphics.EnableTextureRecompression.Value = EnableTextureRecompression;
  430. config.Graphics.EnableMacroHLE.Value = EnableMacroHLE;
  431. config.Graphics.ResScale.Value = ResolutionScale == 4 ? -1 : ResolutionScale + 1;
  432. config.Graphics.ResScaleCustom.Value = CustomResolutionScale;
  433. config.Graphics.MaxAnisotropy.Value = MaxAnisotropy == 0 ? -1 : MathF.Pow(2, MaxAnisotropy);
  434. config.Graphics.AspectRatio.Value = (AspectRatio)AspectRatio;
  435. config.Graphics.AntiAliasing.Value = (AntiAliasing)AntiAliasingEffect;
  436. config.Graphics.ScalingFilter.Value = (ScalingFilter)ScalingFilter;
  437. config.Graphics.ScalingFilterLevel.Value = ScalingFilterLevel;
  438. if (ConfigurationState.Instance.Graphics.BackendThreading != (BackendThreading)GraphicsBackendMultithreadingIndex)
  439. {
  440. DriverUtilities.ToggleOGLThreading(GraphicsBackendMultithreadingIndex == (int)BackendThreading.Off);
  441. }
  442. config.Graphics.BackendThreading.Value = (BackendThreading)GraphicsBackendMultithreadingIndex;
  443. config.Graphics.ShadersDumpPath.Value = ShaderDumpPath;
  444. // Audio
  445. AudioBackend audioBackend = (AudioBackend)AudioBackend;
  446. if (audioBackend != config.System.AudioBackend.Value)
  447. {
  448. config.System.AudioBackend.Value = audioBackend;
  449. Logger.Info?.Print(LogClass.Application, $"AudioBackend toggled to: {audioBackend}");
  450. }
  451. config.System.AudioVolume.Value = Volume / 100;
  452. // Network
  453. config.System.EnableInternetAccess.Value = EnableInternetAccess;
  454. // Logging
  455. config.Logger.EnableFileLog.Value = EnableFileLog;
  456. config.Logger.EnableStub.Value = EnableStub;
  457. config.Logger.EnableInfo.Value = EnableInfo;
  458. config.Logger.EnableWarn.Value = EnableWarn;
  459. config.Logger.EnableError.Value = EnableError;
  460. config.Logger.EnableTrace.Value = EnableTrace;
  461. config.Logger.EnableGuest.Value = EnableGuest;
  462. config.Logger.EnableDebug.Value = EnableDebug;
  463. config.Logger.EnableFsAccessLog.Value = EnableFsAccessLog;
  464. config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode;
  465. config.Logger.GraphicsDebugLevel.Value = (GraphicsDebugLevel)OpenglDebugLevel;
  466. config.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[NetworkInterfaceIndex]];
  467. config.ToFileFormat().SaveConfig(Program.ConfigurationPath);
  468. MainWindow.UpdateGraphicsConfig();
  469. SaveSettingsEvent?.Invoke();
  470. _directoryChanged = false;
  471. }
  472. public void RevertIfNotSaved()
  473. {
  474. Program.ReloadConfig();
  475. }
  476. public void ApplyButton()
  477. {
  478. SaveSettings();
  479. }
  480. public void OkButton()
  481. {
  482. SaveSettings();
  483. CloseWindow?.Invoke();
  484. }
  485. public void CancelButton()
  486. {
  487. RevertIfNotSaved();
  488. CloseWindow?.Invoke();
  489. }
  490. }
  491. }