77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
using InSituLaboratory.Entities;
|
||
using InSituLaboratory.Models;
|
||
using Prism.Regions;
|
||
using Prism.Services.Dialogs;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Collections.ObjectModel;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
|
||
namespace InSituLaboratory.ViewModels.Pages
|
||
{
|
||
public class SequentialDistributionViewModel : ViewModelBase
|
||
{
|
||
public ObservableCollection<RecordModel> RecordList { get; set; } =
|
||
new ObservableCollection<RecordModel>();
|
||
|
||
IDialogService _dialogService;
|
||
public SequentialDistributionViewModel(IRegionManager regionManager, IDialogService dialogService) : base(regionManager)
|
||
{
|
||
this.PageTitle = "时序下发";
|
||
_dialogService = dialogService;
|
||
|
||
|
||
RecordList.Add(new RecordModel { Number = 1, SensorID = "色谱、质谱", DurationTime = "30"});
|
||
RecordList.Add(new RecordModel { Number = 2, SensorID = "二氧化碳", DurationTime = "50"});
|
||
RecordList.Add(new RecordModel { Number = 3, SensorID = "摄像1、摄像2", DurationTime = "100"});
|
||
|
||
Refresh();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 编辑或者新增
|
||
/// </summary>
|
||
/// <param name="model"></param>
|
||
public override void DoModify(object model)
|
||
{
|
||
DialogParameters ps = new DialogParameters();
|
||
ps.Add("model", model);
|
||
_dialogService.ShowDialog("ModifySequentialView", ps, result =>
|
||
{
|
||
// 判断子窗口的返回状态,如果OK,刷新当前页面,否则不管
|
||
if (result.Result == ButtonResult.OK)
|
||
{
|
||
this.Refresh();
|
||
}
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除
|
||
/// </summary>
|
||
/// <param name="model"></param>
|
||
public override void DoDelete(object model)
|
||
{
|
||
try
|
||
{
|
||
if (MessageBox.Show("是否确定删除此项?", "提示", MessageBoxButton.YesNo) ==
|
||
MessageBoxResult.Yes)
|
||
{
|
||
// 物理删除
|
||
|
||
MessageBox.Show("删除完成!", "提示");
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show(ex.Message, "提示");
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|