diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pic1.png b/Correlator/Image/icon_pic1.png deleted file mode 100644 index c85d078..0000000 --- a/Correlator/Image/icon_pic1.png +++ /dev/null Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pic1.png b/Correlator/Image/icon_pic1.png deleted file mode 100644 index c85d078..0000000 --- a/Correlator/Image/icon_pic1.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_play2.png b/Correlator/Image/icon_play2.png deleted file mode 100644 index 7d6e4a5..0000000 --- a/Correlator/Image/icon_play2.png +++ /dev/null Binary files differ diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pic1.png b/Correlator/Image/icon_pic1.png deleted file mode 100644 index c85d078..0000000 --- a/Correlator/Image/icon_pic1.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_play2.png b/Correlator/Image/icon_play2.png deleted file mode 100644 index 7d6e4a5..0000000 --- a/Correlator/Image/icon_play2.png +++ /dev/null Binary files differ diff --git a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs index ba82faf..3a33af4 100644 --- a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs +++ b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs @@ -1,5 +1,7 @@ using System; +using System.Text.RegularExpressions; using Correlator.DataService; +using Correlator.Util; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -59,7 +61,7 @@ #endregion - public AddSoundSpeedDialogViewModel(IApplicationDataService dataService) + public AddSoundSpeedDialogViewModel(IApplicationDataService dataService, IDialogService dialogService) { CancelCommand = new DelegateCommand(delegate { @@ -68,6 +70,72 @@ DetermineParamCommand = new DelegateCommand(delegate { + if (string.IsNullOrEmpty(_minDiameter) || string.IsNullOrEmpty(_maxDiameter) || + string.IsNullOrEmpty(_soundSpeed)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "不允许为空" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (int.Parse(_minDiameter) > int.Parse(_maxDiameter)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径下限不能大于管径上限" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "速度输入错误" } + }, + delegate { } + ); + return; + } + dataService.InsertVelocity(_materialName, _minDiameter, _maxDiameter, _soundSpeed); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pic1.png b/Correlator/Image/icon_pic1.png deleted file mode 100644 index c85d078..0000000 --- a/Correlator/Image/icon_pic1.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_play2.png b/Correlator/Image/icon_play2.png deleted file mode 100644 index 7d6e4a5..0000000 --- a/Correlator/Image/icon_play2.png +++ /dev/null Binary files differ diff --git a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs index ba82faf..3a33af4 100644 --- a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs +++ b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs @@ -1,5 +1,7 @@ using System; +using System.Text.RegularExpressions; using Correlator.DataService; +using Correlator.Util; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -59,7 +61,7 @@ #endregion - public AddSoundSpeedDialogViewModel(IApplicationDataService dataService) + public AddSoundSpeedDialogViewModel(IApplicationDataService dataService, IDialogService dialogService) { CancelCommand = new DelegateCommand(delegate { @@ -68,6 +70,72 @@ DetermineParamCommand = new DelegateCommand(delegate { + if (string.IsNullOrEmpty(_minDiameter) || string.IsNullOrEmpty(_maxDiameter) || + string.IsNullOrEmpty(_soundSpeed)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "不允许为空" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (int.Parse(_minDiameter) > int.Parse(_maxDiameter)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径下限不能大于管径上限" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "速度输入错误" } + }, + delegate { } + ); + return; + } + dataService.InsertVelocity(_materialName, _minDiameter, _maxDiameter, _soundSpeed); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }); diff --git a/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs b/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs index cbf467a..9080227 100644 --- a/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs +++ b/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs @@ -1,8 +1,9 @@ using System; +using System.Text.RegularExpressions; using Correlator.DataService; using Correlator.Model; +using Correlator.Util; using Prism.Commands; -using Prism.Events; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -61,20 +62,86 @@ #endregion - public EditSoundSpeedDialogViewModel(IEventAggregator eventAggregator, IApplicationDataService dataService) + public EditSoundSpeedDialogViewModel(IApplicationDataService dataService, IDialogService dialogService) { CancelCommand = new DelegateCommand(delegate { RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); }); - + DetermineParamCommand = new DelegateCommand(delegate { + if (string.IsNullOrEmpty(_minDiameter) || string.IsNullOrEmpty(_maxDiameter) || + string.IsNullOrEmpty(_soundSpeed)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "不允许为空" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (int.Parse(_minDiameter) > int.Parse(_maxDiameter)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径下限不能大于管径上限" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "速度输入错误" } + }, + delegate { } + ); + return; + } + dataService.UpdateVelocity(_materialVelocity, _minDiameter, _maxDiameter, _soundSpeed); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }); } - + public bool CanCloseDialog() { return true; @@ -87,7 +154,7 @@ public void OnDialogOpened(IDialogParameters parameters) { _materialVelocity = parameters.GetValue("MaterialVelocity"); - + MinDiameter = _materialVelocity.LowDiameter.ToString(); MaxDiameter = _materialVelocity.HighDiameter.ToString(); SoundSpeed = _materialVelocity.Velocity.ToString(); diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj index 67c2daf..0c08dcf 100644 --- a/Correlator/Correlator.csproj +++ b/Correlator/Correlator.csproj @@ -379,10 +379,6 @@ - - - - diff --git a/Correlator/DataService/ApplicationDataServiceImpl.cs b/Correlator/DataService/ApplicationDataServiceImpl.cs index 1b5c3dd..3da8760 100644 --- a/Correlator/DataService/ApplicationDataServiceImpl.cs +++ b/Correlator/DataService/ApplicationDataServiceImpl.cs @@ -1,12 +1,9 @@ using System; using System.Collections.ObjectModel; using System.Linq; -using System.Text.RegularExpressions; -using System.Windows; using Correlator.Model; using Correlator.Util; using Newtonsoft.Json; -using MessageBox = HandyControl.Controls.MessageBox; namespace Correlator.DataService { @@ -55,37 +52,6 @@ public void InsertVelocity(string materialName, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { var velocity = new MaterialVelocity @@ -101,45 +67,13 @@ public void UpdateVelocity(MaterialVelocity velocity, string minDiameter, string maxDiameter, string soundSpeed) { - if (string.IsNullOrEmpty(minDiameter) || string.IsNullOrEmpty(maxDiameter) || - string.IsNullOrEmpty(soundSpeed)) - { - MessageBox.Show("不允许为空", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("管径输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (int.Parse(minDiameter) > int.Parse(maxDiameter)) - { - MessageBox.Show("管径下限不能大于管径上限", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - - if (!Regex.IsMatch(soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) - { - MessageBox.Show("速度输入错误", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - return; - } - using (var manager = new DataBaseManager()) { velocity.LowDiameter = Convert.ToInt32(minDiameter); velocity.HighDiameter = Convert.ToInt32(maxDiameter); velocity.Velocity = Convert.ToInt32(soundSpeed); - "SoundSpeedDataService".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); - + "ApplicationDataServiceImpl".WriteLog("正在修改的管材是:" + JsonConvert.SerializeObject(velocity)); manager.Update(velocity); } } diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs index 51294cd..c00ab95 100644 --- a/Correlator/DataService/SerialPortServiceImpl.cs +++ b/Correlator/DataService/SerialPortServiceImpl.cs @@ -139,7 +139,7 @@ } else { - MessageBox.Show("接收数据存在问题", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog("接收数据存在问题"); } } @@ -191,7 +191,7 @@ } catch (Exception ex) { - MessageBox.Show(ex.Message, "出错提示", MessageBoxButton.OK, MessageBoxImage.Error); + "SerialPortServiceImpl".WriteLog($"错误:{ex.Message}"); Thread.Sleep(2000); Process.GetCurrentProcess().Kill(); return null; diff --git a/Correlator/Dialog/AlertControlDialog.xaml b/Correlator/Dialog/AlertControlDialog.xaml index a704d3a..b10e2ba 100644 --- a/Correlator/Dialog/AlertControlDialog.xaml +++ b/Correlator/Dialog/AlertControlDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Dialog/AlertMessageDialog.xaml b/Correlator/Dialog/AlertMessageDialog.xaml index 7625c9b..f08b168 100644 --- a/Correlator/Dialog/AlertMessageDialog.xaml +++ b/Correlator/Dialog/AlertMessageDialog.xaml @@ -31,7 +31,7 @@ Direction="0" Opacity="0.5" ShadowDepth="0" - Color="DarkBlue" /> + Color="Blue" /> diff --git a/Correlator/Image/homepage_icon11.png b/Correlator/Image/homepage_icon11.png deleted file mode 100644 index 95d8d66..0000000 --- a/Correlator/Image/homepage_icon11.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pause.png b/Correlator/Image/icon_pause.png deleted file mode 100644 index 94ac55c..0000000 --- a/Correlator/Image/icon_pause.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_pic1.png b/Correlator/Image/icon_pic1.png deleted file mode 100644 index c85d078..0000000 --- a/Correlator/Image/icon_pic1.png +++ /dev/null Binary files differ diff --git a/Correlator/Image/icon_play2.png b/Correlator/Image/icon_play2.png deleted file mode 100644 index 7d6e4a5..0000000 --- a/Correlator/Image/icon_play2.png +++ /dev/null Binary files differ diff --git a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs index ba82faf..3a33af4 100644 --- a/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs +++ b/Correlator/ViewModels/AddSoundSpeedDialogViewModel.cs @@ -1,5 +1,7 @@ using System; +using System.Text.RegularExpressions; using Correlator.DataService; +using Correlator.Util; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -59,7 +61,7 @@ #endregion - public AddSoundSpeedDialogViewModel(IApplicationDataService dataService) + public AddSoundSpeedDialogViewModel(IApplicationDataService dataService, IDialogService dialogService) { CancelCommand = new DelegateCommand(delegate { @@ -68,6 +70,72 @@ DetermineParamCommand = new DelegateCommand(delegate { + if (string.IsNullOrEmpty(_minDiameter) || string.IsNullOrEmpty(_maxDiameter) || + string.IsNullOrEmpty(_soundSpeed)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "不允许为空" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (int.Parse(_minDiameter) > int.Parse(_maxDiameter)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径下限不能大于管径上限" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "速度输入错误" } + }, + delegate { } + ); + return; + } + dataService.InsertVelocity(_materialName, _minDiameter, _maxDiameter, _soundSpeed); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }); diff --git a/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs b/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs index cbf467a..9080227 100644 --- a/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs +++ b/Correlator/ViewModels/EditSoundSpeedDialogViewModel.cs @@ -1,8 +1,9 @@ using System; +using System.Text.RegularExpressions; using Correlator.DataService; using Correlator.Model; +using Correlator.Util; using Prism.Commands; -using Prism.Events; using Prism.Mvvm; using Prism.Services.Dialogs; @@ -61,20 +62,86 @@ #endregion - public EditSoundSpeedDialogViewModel(IEventAggregator eventAggregator, IApplicationDataService dataService) + public EditSoundSpeedDialogViewModel(IApplicationDataService dataService, IDialogService dialogService) { CancelCommand = new DelegateCommand(delegate { RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel)); }); - + DetermineParamCommand = new DelegateCommand(delegate { + if (string.IsNullOrEmpty(_minDiameter) || string.IsNullOrEmpty(_maxDiameter) || + string.IsNullOrEmpty(_soundSpeed)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Warning }, { "Title", "温馨提示" }, { "Message", "不允许为空" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_minDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_maxDiameter, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径输入错误" } + }, + delegate { } + ); + return; + } + + if (int.Parse(_minDiameter) > int.Parse(_maxDiameter)) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "管径下限不能大于管径上限" } + }, + delegate { } + ); + return; + } + + if (!Regex.IsMatch(_soundSpeed, "^(([1-9]\\d{0,3})|10000|0)$")) + { + dialogService.ShowDialog( + "AlertMessageDialog", + new DialogParameters + { + { "AlertType", AlertType.Error }, { "Title", "温馨提示" }, { "Message", "速度输入错误" } + }, + delegate { } + ); + return; + } + dataService.UpdateVelocity(_materialVelocity, _minDiameter, _maxDiameter, _soundSpeed); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }); } - + public bool CanCloseDialog() { return true; @@ -87,7 +154,7 @@ public void OnDialogOpened(IDialogParameters parameters) { _materialVelocity = parameters.GetValue("MaterialVelocity"); - + MinDiameter = _materialVelocity.LowDiameter.ToString(); MaxDiameter = _materialVelocity.HighDiameter.ToString(); SoundSpeed = _materialVelocity.Velocity.ToString(); diff --git a/Correlator/Views/AudioFileView.xaml b/Correlator/Views/AudioFileView.xaml index 996edc6..ac2cfb8 100644 --- a/Correlator/Views/AudioFileView.xaml +++ b/Correlator/Views/AudioFileView.xaml @@ -70,6 +70,7 @@ x:Name="AudioWaveView" Grid.Column="2" Height="40" + Margin="50,0" IsEnabled="False" />