src/Carnac/UI/PreferencesViewModel.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Windows.Input;
using System.Windows.Media;
using Carnac.Logic;
using Carnac.Logic.Enums;
using Carnac.Logic.Models;
using Carnac.Logic.Native;
using SettingsProviderNet;
namespace Carnac.UI
{
public class PreferencesViewModel : NotifyPropertyChanged
{
readonly ISettingsProvider settingsProvider;
public PreferencesViewModel(ISettingsProvider settingsProvider, IScreenManager screenManager)
{
this.settingsProvider = settingsProvider;
Screens = new ObservableCollection<DetailedScreen>(screenManager.GetScreens());
Settings = settingsProvider.GetSettings<PopupSettings>();
PlaceScreen();
AvailableColors = new ObservableCollection<AvailableColor>();
var properties = typeof(Colors).GetProperties(BindingFlags.Static | BindingFlags.Public);
foreach (var prop in properties)
{
var name = prop.Name;
var value = (Color)prop.GetValue(null, null);
var availableColor = new AvailableColor(name, value);
if (Settings.FontColor == name)
FontColor = availableColor;
if (Settings.ItemBackgroundColor == name)
ItemBackgroundColor = availableColor;
AvailableColors.Add(availableColor);
}
SaveCommand = new DelegateCommand(SaveSettings);
ResetToDefaultsCommand = new DelegateCommand(() => settingsProvider.ResetToDefaults<PopupSettings>());
VisitCommand = new DelegateCommand(Visit);
}
public ICommand VisitCommand { get; private set; }
public ICommand ResetToDefaultsCommand { get; private set; }
public ICommand SaveCommand { get; private set; }
public ObservableCollection<AvailableColor> AvailableColors { get; private set; }
public ObservableCollection<DetailedScreen> Screens { get; set; }
后面还有 115 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。