Lovely/MainWindowViewModel.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Lovely.Common;
using Lovely.Models;
using Lovely.Views;
using Newtonsoft.Json;
using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Shapes;
using XiaFControl.Controls;

namespace Lovely
{
    public class MainWindowViewModel : BindableBase
    {
        IContainerProvider provider;
        public MainWindowViewModel(IContainerProvider _provider)
        {
            provider = _provider;
            PalyCommand = new DelegateCommand<string>(Play);
            SetConfigCommand = new DelegateCommand(SetConfig);
            AboutCommand = new DelegateCommand(About);

            if (File.Exists(StaticInfo.ConfigPath))
            {
                string jsondata = File.ReadAllText(StaticInfo.ConfigPath);
                if (!string.IsNullOrEmpty(jsondata))
                    StaticInfo.configModel = JsonConvert.DeserializeObject<ConfigModel>(jsondata);
            }
        }
        public DelegateCommand AboutCommand { get; set; }
        public DelegateCommand SetConfigCommand { get; set; }
        private void SetConfig()
        {
            var ConfigView = provider.Resolve<ConfigView>("ConfigView");
            ConfigView.Owner = Application.Current.MainWindow;
            ConfigView.ShowDialog();
        }
        private void About()
        {
            var AboutView = provider.Resolve<AboutView>("AboutView");
            AboutView.Owner = Application.Current.MainWindow;
            AboutView.ShowDialog();
        }
        public DelegateCommand<string> PalyCommand { get; set; }
        private void Play(string key)
        {
            switch (key)
            {
                case "录屏":
                    var RecordView = provider.Resolve<RecordView>("RecordView");
                    RecordView.Owner = Application.Current.MainWindow;
后面还有 19 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。