| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using MuchInfo.Chart.Data.Models;
- using MuchInfo.Chart.DataAdapter;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace MuchInfo.Chart.FormulaEdit
- {
- public class EditFormulaViewModel
- {
- private IDataService _iDataService;
- public EditFormulaViewModel(List<ProgramModel> programModels)
- {
- _programModels = programModels;
- _iDataService = new DataService();
- SelectProgramModel = _programModels.FirstOrDefault();
- }
- //编辑公式集合
- private List<ProgramModel> _programModels;
- /// <summary>
- /// 编辑公式集合
- /// </summary>
- public List<ProgramModel> ProgramModels
- {
- get { return _programModels; }
- set { _programModels = value; }
- }
- private ProgramModel _selectProgramModel;
- /// <summary>
- /// 当前选择的公式
- /// </summary>
- public ProgramModel SelectProgramModel
- {
- get { return _selectProgramModel; }
- set { _selectProgramModel = value; }
- }
- /// <summary>
- /// 修改用户编辑参数
- /// </summary>
- public void ChangeParam()
- {
- Task.Factory.StartNew(() =>
- {
- _iDataService.SaveFormulaParams(ProgramModels);
- });
- }
- /// <summary>
- /// 调用公式编辑器编辑公式
- /// </summary>
- public void EditFormula()
- {
- if (SelectProgramModel != null)
- {
- var formula = SelectProgramModel.CovertToFormulaModel();
- _iDataService.EditFormula(formula.FormulaName);
- }
- }
- /// <summary>
- /// 打开公式管理器
- /// </summary>
- public void OpenEditer()
- {
- if (SelectProgramModel != null)
- {
- var formula = SelectProgramModel.CovertToFormulaModel();
- _iDataService.OpenFormulaEdit(formula.FormulaName);
- }
- }
- }
- }
|