From f9cf37353cb16d8969c6bef6de9e3bedbea10ae5 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 25 八月 2023 17:41:26 +0800
Subject: [PATCH] 修改传感器类型和元数据类型为值域(下拉列表框)

---
 DataLoader/MainWindow.xaml.cs  |   12 ++++-
 DataLoader/MainWindow.xaml     |   46 +++++++++++++---------
 DataLoader/Model/CommonProp.cs |    4 +-
 DataLoader/Model/SysMeta.cs    |    4 +-
 4 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/DataLoader/MainWindow.xaml b/DataLoader/MainWindow.xaml
index 5abb672..e0562e6 100644
--- a/DataLoader/MainWindow.xaml
+++ b/DataLoader/MainWindow.xaml
@@ -2,7 +2,7 @@
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         Height="700" Width="900" Loaded="Window_Loaded" Closing="Window_Closing"
-        Title="鏁版嵁鍏ュ簱 v1.5" WindowStartupLocation="CenterScreen">
+        Title="鏁版嵁鍏ュ簱 v1.6" WindowStartupLocation="CenterScreen">
     <Window.Resources>
         <Style x:Key="btn" TargetType="Button">
             <Setter Property="Background" Value="#005699"/>
@@ -165,26 +165,34 @@
 
         <Label Grid.Row="1" Grid.Column="0" Content="浠ょ墝锛�" VerticalAlignment="Center" HorizontalAlignment="Right" />
         <TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource tb}" IsReadOnly="True" x:Name="tbToken"/>
-        <Label Grid.Row="1" Grid.Column="2" Content="鍏冩暟鎹被鍨嬶細" VerticalAlignment="Center" HorizontalAlignment="Right" />
-        <!--<TextBox Grid.Row="1" Grid.Column="3" Style="{StaticResource tb}" x:Name="tbAcqTim2e"/>-->
-        <!--<ComboBox Grid.Row="1" Grid.Column="3" IsReadOnly="True" DisplayMemberPath="Name" Style="{StaticResource ComboBoxStyle}" Width="320" Height="30" HorizontalAlignment="Left" x:Name="cbMetaType"></ComboBox>-->
-        <ComboBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" VerticalContentAlignment="Center" Cursor="Hand" Background="White" SelectedIndex="0" Width="322" Height="38" BorderThickness="0" x:Name="cbMetaType">
-            <ComboBoxItem>璇烽�夋嫨</ComboBoxItem>
-            <ComboBoxItem>鏁板瓧姝e皠褰卞儚鍥�</ComboBoxItem>
-            <ComboBoxItem>鏁板瓧楂樼▼妯″瀷</ComboBoxItem>
-            <ComboBoxItem>鍗曟尝娈垫爡鏍兼暟鎹�</ComboBoxItem>
-            <ComboBoxItem>澶氬厜璋辨爡鏍兼暟鎹�</ComboBoxItem>
-            <ComboBoxItem>楂樺厜璋辨爡鏍兼暟鎹�</ComboBoxItem>
-            <ComboBoxItem>鐭㈤噺鏁版嵁</ComboBoxItem>
-            <ComboBoxItem>涓夌淮妯″瀷</ComboBoxItem>
-        </ComboBox>
+        <Label Grid.Row="1" Grid.Column="2" Content="閲囬泦鏃堕棿锛�" VerticalAlignment="Center" HorizontalAlignment="Right" />
+        <DatePicker Grid.Row="1" Grid.Column="3" Height="35" Width="320" HorizontalAlignment="Center" VerticalContentAlignment="Center" x:Name="dpAcqTime" FontSize="13"/>
 
         <Label Grid.Row="2" Grid.Column="0" Content="浼犳劅鍣ㄧ被鍨嬶細" VerticalAlignment="Center" HorizontalAlignment="Right" />
-        <TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource tb}" x:Name="tbSensorType"/>
-        <Label Grid.Row="2" Grid.Column="2" Content="閲囬泦鏃堕棿锛�" VerticalAlignment="Center" HorizontalAlignment="Right" />
-        <!--<TextBox Grid.Row="2" Grid.Column="3" Style="{StaticResource tb}" x:Name="tbAcqTime"/>-->
-        <DatePicker Grid.Row="2" Grid.Column="3" Height="35" Width="320" HorizontalAlignment="Center" VerticalContentAlignment="Center" x:Name="dpAcqTime" FontSize="13"/>
-
+        <!--<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource tb}" x:Name="tbSensorType"/>-->
+        <ComboBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalContentAlignment="Center" Cursor="Hand" Background="White" SelectedIndex="0" Width="322" Height="38" BorderThickness="0" x:Name="tbSensorType">
+            <ComboBoxItem Tag="0">璇烽�夋嫨</ComboBoxItem>
+            <ComboBoxItem Tag="1">瀚﹀ē涓�鍙�</ComboBoxItem>
+            <ComboBoxItem Tag="2">瀚﹀ē浜屽彿</ComboBoxItem>
+            <ComboBoxItem Tag="3">绉戞櫘鏁欒偛</ComboBoxItem>
+            <ComboBoxItem Tag="4">鍏嬭幈闂ㄦ眬</ComboBoxItem>
+            <ComboBoxItem Tag="5">鏈堢悆鎺㈠嫎鑰�</ComboBoxItem>
+            <ComboBoxItem Tag="6">鏈堜寒濂崇</ComboBoxItem>
+            <ComboBoxItem Tag="7">鏈堢悆鍕樻祴杞ㄩ亾鍣�</ComboBoxItem>
+            <ComboBoxItem Tag="8">鍦f澂鍙�</ComboBoxItem>
+        </ComboBox>
+        <Label Grid.Row="2" Grid.Column="2" Content="鍏冩暟鎹被鍨嬶細" VerticalAlignment="Center" HorizontalAlignment="Right" />
+        <!--<ComboBox Grid.Row="1" Grid.Column="3" IsReadOnly="True" DisplayMemberPath="Name" Style="{StaticResource ComboBoxStyle}" Width="320" Height="30" HorizontalAlignment="Left" x:Name="cbMetaType"></ComboBox>-->
+        <ComboBox Grid.Row="2" Grid.Column="3" HorizontalAlignment="Left" VerticalContentAlignment="Center" Cursor="Hand" Background="White" SelectedIndex="0" Width="322" Height="38" BorderThickness="0" x:Name="cbMetaType">
+            <ComboBoxItem Tag="0">璇烽�夋嫨</ComboBoxItem>
+            <ComboBoxItem Tag="1">鏁板瓧姝e皠褰卞儚鍥�</ComboBoxItem>
+            <ComboBoxItem Tag="2">鏁板瓧楂樼▼妯″瀷</ComboBoxItem>
+            <ComboBoxItem Tag="3">鍗曟尝娈垫爡鏍兼暟鎹�</ComboBoxItem>
+            <ComboBoxItem Tag="4">澶氬厜璋辨爡鏍兼暟鎹�</ComboBoxItem>
+            <ComboBoxItem Tag="5">楂樺厜璋辨爡鏍兼暟鎹�</ComboBoxItem>
+            <ComboBoxItem Tag="6">鐭㈤噺鏁版嵁</ComboBoxItem>
+            <ComboBoxItem Tag="7">涓夌淮妯″瀷</ComboBoxItem>
+        </ComboBox>
 
         <Label Grid.Row="3" Grid.Column="0" Content="璧勬簮鐩綍锛�" VerticalAlignment="Center" HorizontalAlignment="Right" />
         <TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Style="{StaticResource tb}" IsReadOnly="True" x:Name="tbDir"/>
diff --git a/DataLoader/MainWindow.xaml.cs b/DataLoader/MainWindow.xaml.cs
index a98651c..efb818d 100644
--- a/DataLoader/MainWindow.xaml.cs
+++ b/DataLoader/MainWindow.xaml.cs
@@ -136,21 +136,27 @@
                 MessageBox.Show("璇烽�夋嫨璧勬簮鐩綍锛�", "鎻愮ず");
                 return;
             }
+
             CommonProp.SourcePath = this.tbSource.Text.Trim();
             if (string.IsNullOrEmpty(CommonProp.SourcePath) || !Directory.Exists(CommonProp.SourcePath))
             {
                 MessageBox.Show("璇烽�夋嫨鏁版嵁鐩綍鎴栨暟鎹洰褰曚笉瀛樺湪锛�", "鎻愮ず");
                 return;
             }
+
             CommonProp.TargetPath = this.tbTarget.Text.Trim();
             if (string.IsNullOrEmpty(CommonProp.TargetPath) || !Directory.Exists(CommonProp.TargetPath))
             {
                 MessageBox.Show("璇烽�夋嫨鍏ュ簱鐩綍鎴栧叆搴撶洰褰曚笉瀛樺湪锛�", "鎻愮ず");
                 return;
             }
-            CommonProp.SensorType = this.tbSensorType.Text.Trim();
-            ContentControl cc = this.cbMetaType.SelectedItem as ContentControl;
-            CommonProp.MetaType = null == cc || "璇烽�夋嫨" == cc.Content.ToString() ? string.Empty : cc.Content.ToString();
+
+            ContentControl ccSensor = this.tbSensorType.SelectedItem as ContentControl;
+            int.TryParse(ccSensor.Tag.ToString(), out CommonProp.SensorType);
+
+            ContentControl ccMeta = this.cbMetaType.SelectedItem as ContentControl;
+            int.TryParse(ccMeta.Tag.ToString(), out CommonProp.MetaType);
+
             CommonProp.AcqTime = this.dpAcqTime.SelectedDate;
 
             this.isBusy = true;
diff --git a/DataLoader/Model/CommonProp.cs b/DataLoader/Model/CommonProp.cs
index 314e199..94790b2 100644
--- a/DataLoader/Model/CommonProp.cs
+++ b/DataLoader/Model/CommonProp.cs
@@ -78,7 +78,7 @@
         /// <summary>
         /// 鍏冩暟鎹被鍨�
         /// </summary>
-        public static string MetaType;
+        public static int MetaType;
 
         /// <summary>
         /// 鏁版嵁鐩綍
@@ -93,7 +93,7 @@
         /// <summary>
         /// 浼犳劅鍣ㄧ被鍨�
         /// </summary>
-        public static string SensorType;
+        public static int SensorType;
 
         /// <summary>
         /// 閲囬泦鏃堕棿
diff --git a/DataLoader/Model/SysMeta.cs b/DataLoader/Model/SysMeta.cs
index eda7e12..b99fa3c 100644
--- a/DataLoader/Model/SysMeta.cs
+++ b/DataLoader/Model/SysMeta.cs
@@ -120,7 +120,7 @@
         /// <summary>
         /// 浼犳劅鍣ㄧ被鍨�
         /// </summary>
-        public string sensortype { set; get; }
+        public int sensortype { set; get; }
 
         /// <summary>
         /// 閲囬泦鏃堕棿
@@ -155,7 +155,7 @@
         /// <summary>
         /// 鍏冩暟鎹被鍨�
         /// </summary>
-        public string mata_type { set; get; }
+        public int mata_type { set; get; }
 
         /// <summary>
         /// 娉㈡鏁�

--
Gitblit v1.9.3