private void SaveConfig() { if (this.TCList == null || this.TCList.Count == 0) { return; } if (currentConfig == null) { var window = new ConfigNameWindow(); var dialog = window.ShowDialog().GetValueOrDefault(); if (dialog) { var content = JsonConvert.SerializeObject(this.TCList); DeviceConfig entity = new DeviceConfig(); entity.Name = window.ConfigName; entity.IsDefault = window.IsDefault; entity.DeviceContent = content; entity.User = AppContext.UserName; entity.CreateTime = DateTime.Now; service.CreateConfig(entity); MsgBox.SuccessShow("保存成功!"); } } else { var content = JsonConvert.SerializeObject(this.TCList); currentConfig.DeviceContent = content; service.UpdateConfig(currentConfig); MsgBox.SuccessShow("保存成功!"); } }
private void SaveConfig() { if (this.TCList.Count == 0) { return; } if (currentConfig != null) { var content = JsonConvert.SerializeObject(this.TCList); currentConfig.DeviceContent = content; service.UpdateConfig(currentConfig); MsgBox.SuccessShow("保存成功!"); } }