| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using ivf_tl_Entity.Entity;
- using ivf_tl_Manage.Converts;
- using ivf_tl_Manage.ViewModels.Win;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace ivf_tl_Manage.Win
- {
- /// <summary>
- /// EditTLWindow.xaml 的交互逻辑
- /// </summary>
- public partial class EditTLWindow : Window
- {
- private EditTLWindowViewModel vm = null;
- public EditTLWindow( long id,Window w)
- {
- InitializeComponent();
- this.Owner = w;
- vm = new EditTLWindowViewModel(id);
- this.DataContext= vm;
- this.Loaded += EditTLWindow_Loaded;
- }
- private void EditTLWindow_Loaded(object sender, RoutedEventArgs e)
- {
- if(vm.TLSettingInfo != null)
- {
- switch (vm.TLSettingInfo.online)
- {
- case 0:
- this._onLine0_RadioButton.IsChecked = true;
- break;
- case 1:
- this._onLine1_RadioButton.IsChecked = true;
- break;
- case 2:
- this._onLine2_RadioButton.IsChecked = true;
- break;
- }
- }
- }
- private void Cancel_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- }
- private void Ok_Click(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(vm.TLSettingInfo.tlName))
- {
- //MessageBoxShow("设备名称不能为空");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0188"));
- return;
- }
- if (string.IsNullOrEmpty(vm.TLSettingInfo.installTime))
- {
- //MessageBoxShow("安装日期不能为空");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0198"));
- return;
- }
- if (string.IsNullOrEmpty(vm.TLSettingInfo.address))
- {
- //MessageBoxShow("安装地址不能为空");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0268"));
- return;
- }
- if (string.IsNullOrEmpty(vm.TLSettingInfo.remark))
- {
- //MessageBoxShow("医院名称不能为空");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0199"));
- return;
- }
- if (string.IsNullOrEmpty(vm.TLSettingInfo.collectSn))
- {
- //MessageBoxShow("温度设备编号不能为空");
- MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0191"));
- return;
- }
- string error = vm.SaveTlInfo();
- if (!string.IsNullOrEmpty(error))
- {
- //MessageBoxShow($"操作失败:{error}");
- MessageBoxShow($"{KeyToStringConvert.GetLanguageStringByKey("0286")}:{error}");
- return;
- }
- this.DialogResult = true;
- return;
- }
- private void MessageBoxShow(string mess)
- {
- this._message.Text = mess;
- }
- private void AddressSelectUserControl_SelectValue(string value)
- {
- // vm.TLSettingInfo.address = value;
- }
- private void Cancel_MouseUp(object sender, MouseButtonEventArgs e)
- {
- this.DialogResult = false;
- return;
- }
- }
- }
|