| | |
| | | using HMI.Base; |
| | | using HMI.Core.Util; |
| | | using HMI.DataViewer.Entity; |
| | | using HMI.UI.Converter; |
| | | using HMI.UI.Util; |
| | | using NPOI.SS.Formula.Functions; |
| | | using NPOI.SS.UserModel; |
| | |
| | | |
| | | namespace HMI.DataViewer |
| | | { |
| | | public class DefaultValueConverter : IValueConverter |
| | | { |
| | | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| | | { |
| | | if (value is DateTime date) |
| | | { |
| | | return date.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| | | return value.ToString(); |
| | | } |
| | | |
| | | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
| | | { |
| | | return value; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// UserControl1.xaml 的交互逻辑 |
| | |
| | | } |
| | | |
| | | private Dictionary<string, DataBase_Setting> Map = new Dictionary<string, DataBase_Setting>(); |
| | | |
| | | private IValueConverter defaultConverter = new DefaultValueConverter(); |
| | | |
| | | private void Button_Click(object sender, RoutedEventArgs e) |
| | | { |
| | |
| | | Header = header, |
| | | Binding = new System.Windows.Data.Binding(bindingPath) |
| | | { |
| | | Converter = defaultConverter |
| | | Converter = DateStrConverter.Instance |
| | | }, |
| | | Width = new DataGridLength(1, DataGridLengthUnitType.Star) |
| | | }; |