|
|
@ -70,9 +70,13 @@ namespace StartServerWPF.Modules.Main.ViewModels
|
|
|
|
get => _wareaSelectedIndex;
|
|
|
|
get => _wareaSelectedIndex;
|
|
|
|
set
|
|
|
|
set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (value >= 0)
|
|
|
|
if(value >= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// _workareaModel = modelArray.workarea[value];
|
|
|
|
var model = _workareasModelArray.workarea[value];
|
|
|
|
|
|
|
|
string jsonStr = File.ReadAllText(Path.Combine(model.filepath, "datapro.json"));
|
|
|
|
|
|
|
|
var datas = JsonConvert.DeserializeObject<List<DataProModel>>(jsonStr);
|
|
|
|
|
|
|
|
NameSource = new ObservableCollection<DataProModel>();
|
|
|
|
|
|
|
|
datas.ForEach(d => { NameSource.Add(d); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetProperty(ref _wareaSelectedIndex, value);
|
|
|
|
SetProperty(ref _wareaSelectedIndex, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -84,6 +88,30 @@ namespace StartServerWPF.Modules.Main.ViewModels
|
|
|
|
set { SetProperty(ref _workareaNameSource, value); }
|
|
|
|
set { SetProperty(ref _workareaNameSource, value); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<DataProModel> _nameSource=new ObservableCollection<DataProModel>();
|
|
|
|
|
|
|
|
public ObservableCollection<DataProModel> NameSource
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _nameSource;
|
|
|
|
|
|
|
|
set { SetProperty(ref _nameSource, value); }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private int _dataSelectedIndex;
|
|
|
|
|
|
|
|
public int DataSelectedIndex
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _dataSelectedIndex;
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (value >= 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var item = NameSource[value];
|
|
|
|
|
|
|
|
StartSelectedDate = item.StartTime;
|
|
|
|
|
|
|
|
EndSelectedDate = item.EndTime;
|
|
|
|
|
|
|
|
DataPath = item.DataPath;
|
|
|
|
|
|
|
|
SavePath = item.ResultPath;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
SetProperty(ref _dataSelectedIndex, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<MsEventModel> _apmsEventSource = new ObservableCollection<MsEventModel>();
|
|
|
|
private ObservableCollection<MsEventModel> _apmsEventSource = new ObservableCollection<MsEventModel>();
|
|
|
|
public ObservableCollection<MsEventModel> ApmsEventSource
|
|
|
|
public ObservableCollection<MsEventModel> ApmsEventSource
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -109,39 +137,47 @@ namespace StartServerWPF.Modules.Main.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
StartSelectedDate = DateTime.Now;
|
|
|
|
StartSelectedDate = DateTime.Now;
|
|
|
|
EndSelectedDate = DateTime.Now;
|
|
|
|
EndSelectedDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
WorkareaNameSource = new ObservableCollection<string>();
|
|
|
|
WorkareaNameSource = new ObservableCollection<string>();
|
|
|
|
_workareasModelArray.workarea.Select(n => n.workareaname).ToList().ForEach(a => WorkareaNameSource.Add(a));
|
|
|
|
_workareasModelArray.workarea.Select(n => n.workareaname).ToList().ForEach(a => WorkareaNameSource.Add(a));
|
|
|
|
WareaSelectedIndex = _workareasModelArray.selectIndex;
|
|
|
|
WareaSelectedIndex = _workareasModelArray.selectIndex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var model = _workareasModelArray.workarea[WareaSelectedIndex];
|
|
|
|
|
|
|
|
string jsonStr= File.ReadAllText(Path.Combine(model.filepath, "datapro.json"));
|
|
|
|
|
|
|
|
var datas= JsonConvert.DeserializeObject<List<DataProModel>>(jsonStr);
|
|
|
|
|
|
|
|
NameSource = new ObservableCollection<DataProModel>();
|
|
|
|
|
|
|
|
datas.ForEach(d => { NameSource.Add(d); });
|
|
|
|
|
|
|
|
DataSelectedIndex = 0;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
public DelegateCommand SaveCommand => new(() =>
|
|
|
|
public DelegateCommand AddItemCommand => new(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int count = NameSource.Count()+1;
|
|
|
|
DataProModelArray dataProModelArray = new DataProModelArray();
|
|
|
|
NameSource.Add(new DataProModel
|
|
|
|
dataProModelArray.selectIndex = 0;
|
|
|
|
|
|
|
|
dataProModelArray.dataProModels = new List<DataProModel>();
|
|
|
|
|
|
|
|
dataProModelArray.dataProModels.Add(new DataProModel
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = DateTime.Now.ToString("d"),
|
|
|
|
Name = DateTime.Now.ToString("d") +" "+ count.ToString("D2"),
|
|
|
|
DataPath = DataPath,
|
|
|
|
DataPath = "",
|
|
|
|
ResultPath = SavePath,
|
|
|
|
ResultPath = "",
|
|
|
|
StartTime = DateTime.Now.ToString("G"),
|
|
|
|
StartTime = DateTime.Now,
|
|
|
|
EndTime = DateTime.Now.ToString("G")
|
|
|
|
EndTime = DateTime.Now
|
|
|
|
});
|
|
|
|
});
|
|
|
|
string jsonStr = JsonConvert.SerializeObject(dataProModelArray, Formatting.Indented);
|
|
|
|
DataSelectedIndex = NameSource.Count()-1;
|
|
|
|
var model = _workareasModelArray.workarea[WareaSelectedIndex];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File.WriteAllText(Path.Combine( model.filepath, "datapro.json"), jsonStr);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DelegateCommand DeleteCommand => new(() =>
|
|
|
|
public DelegateCommand DeleteCommand => new(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (MessageBox.Show("确认删除?", "警告", MessageBoxButton.OKCancel,
|
|
|
|
|
|
|
|
MessageBoxImage.Exclamation) == MessageBoxResult.OK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NameSource.RemoveAt(DataSelectedIndex);
|
|
|
|
|
|
|
|
DataSelectedIndex = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
public DelegateCommand SaveCommand => new(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string jsonStr = JsonConvert.SerializeObject(NameSource, Formatting.Indented);
|
|
|
|
|
|
|
|
var model = _workareasModelArray.workarea[WareaSelectedIndex];
|
|
|
|
|
|
|
|
File.WriteAllText(Path.Combine(model.filepath, "datapro.json"), jsonStr);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DelegateCommand<object> SelectFileCommand => new((obj) =>
|
|
|
|
public DelegateCommand<object> SelectFileCommand => new((obj) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -217,7 +253,9 @@ namespace StartServerWPF.Modules.Main.ViewModels
|
|
|
|
process.ProParams = $"{str} {temPath}";
|
|
|
|
process.ProParams = $"{str} {temPath}";
|
|
|
|
|
|
|
|
|
|
|
|
//dataProtools 配置更新
|
|
|
|
//dataProtools 配置更新
|
|
|
|
var area = JsonParser.DeepCopy<WorkareaModel>(_workareaModel);
|
|
|
|
string temJson= JsonConvert.SerializeObject(_workareaModel);
|
|
|
|
|
|
|
|
var area = JsonConvert.DeserializeObject<WorkareaModel>(temJson); //JsonParser.DeepCopy<WorkareaModel>(_workareaModel);
|
|
|
|
|
|
|
|
|
|
|
|
ApmsModel tools = area.apmModel;
|
|
|
|
ApmsModel tools = area.apmModel;
|
|
|
|
tools.savepath = SavePath;
|
|
|
|
tools.savepath = SavePath;
|
|
|
|
tools.station = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.station)).Replace("\\", "/");
|
|
|
|
tools.station = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.station)).Replace("\\", "/");
|
|
|
|