using BPASmartClient.Helper; using Microsoft.Toolkit.Mvvm.ComponentModel; using Model; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.MilkWithTea.ViewModel { public class MainWindowVeiwModel : ObservableObject { public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } public MainWindowVeiwModel() { init(); } private void init() { string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes"); //判断文件夹是否存在,如果不存在就创建file文件夹 if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } GLobal.recipePath = Path.Combine(path, "LocalRecipes.json"); GLobal.posionPath = Path.Combine(path, "MaterialPosion.json"); GLobal.MaterialRecipes = GLobal.GetJsonToT(GLobal.recipePath); } } }