mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-29 10:09:49 +08:00
80 lines
2.1 KiB
C#
80 lines
2.1 KiB
C#
using BetterGenshinImpact.Core.Config;
|
|
using BetterGenshinImpact.GameTask;
|
|
using BetterGenshinImpact.GameTask.Model.Enum;
|
|
using BetterGenshinImpact.Service.Interface;
|
|
using BetterGenshinImpact.View.Pages;
|
|
using BetterGenshinImpact.View.Windows;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
using CommunityToolkit.Mvvm.Messaging.Messages;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using Wpf.Ui;
|
|
using Wpf.Ui.Controls;
|
|
|
|
namespace BetterGenshinImpact.ViewModel.Pages;
|
|
|
|
public partial class CommonSettingsPageViewModel : ObservableObject, INavigationAware, IViewModel
|
|
{
|
|
public AllConfig Config { get; set; }
|
|
|
|
private readonly INavigationService _navigationService;
|
|
|
|
public CommonSettingsPageViewModel(IConfigService configService, INavigationService navigationService)
|
|
{
|
|
Config = configService.Get();
|
|
_navigationService = navigationService;
|
|
}
|
|
|
|
public void OnNavigatedTo()
|
|
{
|
|
}
|
|
|
|
public void OnNavigatedFrom()
|
|
{
|
|
}
|
|
|
|
[RelayCommand]
|
|
public void OnRefreshMaskSettings()
|
|
{
|
|
WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(this, "RefreshSettings", new object(), "重新计算控件位置"));
|
|
}
|
|
|
|
[RelayCommand]
|
|
public void OnGoToHotKeyPage()
|
|
{
|
|
_navigationService.Navigate(typeof(HotKeyPage));
|
|
}
|
|
|
|
[RelayCommand]
|
|
public void OnSwitchTakenScreenshotEnabled()
|
|
{
|
|
if (Config.CommonConfig.ScreenshotEnabled)
|
|
{
|
|
if (TaskTriggerDispatcher.Instance().GetCacheCaptureMode() == DispatcherCaptureModeEnum.NormalTrigger)
|
|
{
|
|
TaskTriggerDispatcher.Instance().SetCacheCaptureMode(DispatcherCaptureModeEnum.CacheCaptureWithTrigger);
|
|
}
|
|
}
|
|
}
|
|
|
|
[RelayCommand]
|
|
public void OnGoToFolder()
|
|
{
|
|
var path = Global.Absolute(@"log\screenshot\");
|
|
if (!Directory.Exists(path))
|
|
{
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
|
|
Process.Start("explorer.exe", path);
|
|
}
|
|
|
|
[RelayCommand]
|
|
public void OnOpenMapViewer()
|
|
{
|
|
new MapViewer().Show();
|
|
}
|
|
}
|