using Aitex.Core.UI.MVVM; using Prism.Mvvm; using Prism.Commands; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Win32; namespace Venus_MainPages.ViewModels { public class ProcessViewModel : BindableBase { #region 私有字段 private string m_SelectedRecipe; #endregion #region 属性 public string SelectedRecipe { get { return m_SelectedRecipe; } set { SetProperty(ref m_SelectedRecipe, value); } } #endregion #region 命令 private DelegateCommand _LoadRecipeCommand; public DelegateCommand LoadRecipeCommand => _LoadRecipeCommand ?? (_LoadRecipeCommand = new DelegateCommand(OnLoadRecipe)); #endregion #region 命令方法 private void OnLoadRecipe() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = ".rcp|*.rcp"; dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; if (dialog.ShowDialog() == false) return; SelectedRecipe = dialog.SafeFileName.Split('.')[0]; } #endregion } }