From 594dac71b03e10e17b685c65d38621a905f8ebcb Mon Sep 17 00:00:00 2001 From: tayttt Date: Thu, 25 Jun 2026 22:35:55 +0800 Subject: [PATCH] chore: clean compiler warnings --- Txgy.Controls/myListBox.cs | 1 - .../Helpers/ReportPlanImage.cs | 2 -- .../Helpers/ReportStereogramImage.cs | 4 ---- Txgy.EWS.Client.Common/Helpers/XMLHelper.cs | 2 +- .../ViewModels/EarlyWarningViewModel.cs | 2 +- .../ViewModels/PlanViewModel.cs | 1 - .../ViewModels/ReportViewModel.cs | 3 --- .../ViewModels/WaveformViewModel.cs | 23 +++---------------- .../Views/EarlyWarningView.xaml.cs | 6 ++--- .../Views/EarlyWarningViewBak.xaml.cs | 4 ++-- .../Views/FocalMechanismView.xaml.cs | 1 - .../Views/PlanView.xaml.cs | 7 ++---- .../Views/ReportDayListView.xaml.cs | 3 --- .../ViewModels/AddFileDialogViewModel.cs | 2 ++ 14 files changed, 13 insertions(+), 48 deletions(-) diff --git a/Txgy.Controls/myListBox.cs b/Txgy.Controls/myListBox.cs index c20c8f7..7795b4b 100644 --- a/Txgy.Controls/myListBox.cs +++ b/Txgy.Controls/myListBox.cs @@ -12,7 +12,6 @@ namespace Txgy.Controls public class myListBox : System.Windows.Controls.ListBox { - private ListBoxItem _lastSelectedItem; protected override DependencyObject GetContainerForItemOverride() { return new myListBoxItem(); diff --git a/Txgy.EWS.Client.Common/Helpers/ReportPlanImage.cs b/Txgy.EWS.Client.Common/Helpers/ReportPlanImage.cs index d1c81e7..0fe779a 100644 --- a/Txgy.EWS.Client.Common/Helpers/ReportPlanImage.cs +++ b/Txgy.EWS.Client.Common/Helpers/ReportPlanImage.cs @@ -44,8 +44,6 @@ namespace Txgy.EWS.Client.Common.Helpers double yDrawUnit = 1; double drawUnit = 1; Point _downPoint = new Point(0, 0); - bool _isMoving = false; - double left = 0, top = 0; public bool IsShowGridText = true; public bool IsShowGrid = true; public System.Windows.Media.Color BackGroundColor = System.Windows.Media.Colors.White; diff --git a/Txgy.EWS.Client.Common/Helpers/ReportStereogramImage.cs b/Txgy.EWS.Client.Common/Helpers/ReportStereogramImage.cs index 935cc8f..b9368d6 100644 --- a/Txgy.EWS.Client.Common/Helpers/ReportStereogramImage.cs +++ b/Txgy.EWS.Client.Common/Helpers/ReportStereogramImage.cs @@ -20,7 +20,6 @@ namespace Txgy.EWS.Client.Common.Helpers public class ReportStereogramImage : IDisposable { string stereoImagePath; - List eventList; public LightningChart lightChart = new LightningChart(); View3D view3D = new View3D(); @@ -30,8 +29,6 @@ namespace Txgy.EWS.Client.Common.Helpers double _sideRotationRS = 0; double _horizontalRotationRS = -30; double _verticalRotationRS = 30; - double _distanceRS = 150; - bool _clipDispaly = false; WallXZ _topWall; WallYZ _leftWall; WallYZ _rightWall; @@ -41,7 +38,6 @@ namespace Txgy.EWS.Client.Common.Helpers AxisX3D _axisXPri3D; AxisY3D _axisYPri3D; AxisZ3D _axisZPri3D; - ProjectionType _projectionTypeRS = ProjectionType.Perspective; public double _scale = 1; SizeDoubleXYZ eventSize; diff --git a/Txgy.EWS.Client.Common/Helpers/XMLHelper.cs b/Txgy.EWS.Client.Common/Helpers/XMLHelper.cs index 68752fa..e005baa 100644 --- a/Txgy.EWS.Client.Common/Helpers/XMLHelper.cs +++ b/Txgy.EWS.Client.Common/Helpers/XMLHelper.cs @@ -25,7 +25,7 @@ namespace Txgy.EWS.Client.Common.Helpers //CommonLogHelper.Debug("XML文件读取成功。"); } - catch (Exception ex) + catch (Exception) { //CommonLogHelper.log.Error(string.Format("XML文件读取失败。{0}", ex)); } diff --git a/Txgy.EWS.Client.PageModule/ViewModels/EarlyWarningViewModel.cs b/Txgy.EWS.Client.PageModule/ViewModels/EarlyWarningViewModel.cs index 99c322d..52b7021 100644 --- a/Txgy.EWS.Client.PageModule/ViewModels/EarlyWarningViewModel.cs +++ b/Txgy.EWS.Client.PageModule/ViewModels/EarlyWarningViewModel.cs @@ -948,7 +948,7 @@ namespace Txgy.EWS.Client.PageModule.ViewModels } } } - catch (Exception ex) + catch (Exception) { return 0; //throw ex; diff --git a/Txgy.EWS.Client.PageModule/ViewModels/PlanViewModel.cs b/Txgy.EWS.Client.PageModule/ViewModels/PlanViewModel.cs index 36c8bf1..803b364 100644 --- a/Txgy.EWS.Client.PageModule/ViewModels/PlanViewModel.cs +++ b/Txgy.EWS.Client.PageModule/ViewModels/PlanViewModel.cs @@ -193,7 +193,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels } } private Fill _chartBackGround = new Fill(); - private IEventAggregator _ea; public Fill ChartBackGround { diff --git a/Txgy.EWS.Client.PageModule/ViewModels/ReportViewModel.cs b/Txgy.EWS.Client.PageModule/ViewModels/ReportViewModel.cs index 58b834a..0f00ca4 100644 --- a/Txgy.EWS.Client.PageModule/ViewModels/ReportViewModel.cs +++ b/Txgy.EWS.Client.PageModule/ViewModels/ReportViewModel.cs @@ -86,8 +86,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels double _sideRotationRS = 0; double _horizontalRotationRS = -30; double _verticalRotationRS = 30; - double _distanceRS = 150; - bool _clipDispaly = false; WallXZ _topWall; WallYZ _leftWall; WallYZ _rightWall; @@ -97,7 +95,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels AxisX3D _axisXPri3D; AxisY3D _axisYPri3D; AxisZ3D _axisZPri3D; - ProjectionType _projectionTypeRS = ProjectionType.Perspective; public double _scale = 1; SizeDoubleXYZ eventSize; #endregion diff --git a/Txgy.EWS.Client.PageModule/ViewModels/WaveformViewModel.cs b/Txgy.EWS.Client.PageModule/ViewModels/WaveformViewModel.cs index 0d5d710..1dc72a9 100644 --- a/Txgy.EWS.Client.PageModule/ViewModels/WaveformViewModel.cs +++ b/Txgy.EWS.Client.PageModule/ViewModels/WaveformViewModel.cs @@ -43,7 +43,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels /// 当前采样数 /// public int CurPoints; - private DispatcherTimer _fitYTimer; private readonly IEventAggregator _ea; private readonly ISearchMsEventBLL _searchMsEventBLL; private int _selectResult = 0; @@ -58,17 +57,16 @@ namespace Txgy.EWS.Client.PageModule.ViewModels } int _channelCount = 60; // Channel count. double _samplingFrequency = 500; // Sampling frequency (Hz). - double _xLength = 10; // X axis length. double _previousX = 0; // Latest X value on axis. long _now; // Latest time stamp. - long _startTicks; // Controls timing. + long _startTicks = 0; // Controls timing. long _samplesOutput; // Generated samples quantity. // Constants const double YMin = 30000; // Minimal y-value. const double YMax = 33000; // Maximal y-value. - private volatile bool _stop; // Stops thread work. + private volatile bool _stop = false; // Stops thread work. internal bool IsRunning { get @@ -82,7 +80,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels /// Thread. /// private Thread _thread; - private Thread _threadWrite; private delegate void ChartUpdateFromThreadHandler(double[][] samples); @@ -192,8 +189,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels /// 文件数据位置 /// public string FileDataPath { get; set; } = @"D:\TaySystemPath\Downloads"; - private string _cachePath; - private int _cacheSize; /// /// 缓存大小 @@ -265,7 +260,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels set { gridChart = value; } } private string _btnContrlContent = "开始"; - private int channelCount; public string BtnContrlContent { @@ -281,7 +275,7 @@ namespace Txgy.EWS.Client.PageModule.ViewModels SetProperty(ref _showEvents, value); } } - StationWorkModel _stationWorker; + StationWorkModel _stationWorker = null; public List smList; //public static readonly DependencyProperty XAxesProperty = @@ -455,8 +449,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels } private void UpdateChartData() { - double yRange = YMax - YMin; - double[][] multiChannelData = new double[smList.Count * 3][]; try { @@ -480,10 +472,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels public void UpdateWavesFromTxt(string fn) { string allStr; - string sn = "";//0 - int points = 0;//1 - int samp = 500;//2 - string startTime = "";//3;4,5,6=null smList = new List(); using (StreamReader streamReader = new StreamReader(fn)) @@ -495,7 +483,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels string[] strLines = allStr.Trim().Split(new char[] { '\n' }); List strList = strLines.ToList(); int cnt = strList.Count; - int num = 0; string[] snStr = strLines[0].Trim().Split(','); string tmpName = snStr[0].Substring(14, 3); CurPoints = int.Parse(snStr[1].Trim().Split(' ')[0]); @@ -913,8 +900,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels } private void ThreadLoop() { - int sm = 0; - while (_stop == false) { @@ -941,8 +926,6 @@ namespace Txgy.EWS.Client.PageModule.ViewModels if (sampleBundleToGenerate > 0) { //YMax = tmps.Max(); - double yRange = YMax - YMin; - double[][] multiChannelData = new double[_channelCount][]; for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++) diff --git a/Txgy.EWS.Client.PageModule/Views/EarlyWarningView.xaml.cs b/Txgy.EWS.Client.PageModule/Views/EarlyWarningView.xaml.cs index 97741a4..d2bc682 100644 --- a/Txgy.EWS.Client.PageModule/Views/EarlyWarningView.xaml.cs +++ b/Txgy.EWS.Client.PageModule/Views/EarlyWarningView.xaml.cs @@ -67,7 +67,6 @@ namespace Txgy.EWS.Client.PageModule.Views double drawUnit = 1; Point _downPoint = new Point(0, 0); bool _isMoving = false; - double left = 0, top = 0; public bool IsShowGridText = true; public bool IsShowGrid = true; public System.Windows.Media.Color BackGroundColor = System.Windows.Media.Colors.White; @@ -108,7 +107,8 @@ namespace Txgy.EWS.Client.PageModule.Views //rpi.DrawPlanClipToDrawVisual(mes, (int)rView.canvasPlan.ActualWidth, (int)rView.canvasPlan.ActualHeight); rpi.Draw(null, canvas.Width, canvas.Height); //host = new VisualHost(); - canvas.Children.Add(rpi.host); + host = rpi.host; + canvas.Children.Add(host); baseX = GlobalConfig.ProjectConfig.WorkArea.EMin; baseY = GlobalConfig.ProjectConfig.WorkArea.NMin; @@ -1050,8 +1050,6 @@ namespace Txgy.EWS.Client.PageModule.Views transform.Y += position.Y - this.previousMousePoint.Y; this.previousMousePoint = position; } - private ListBoxItem _lastSelectedItem; - private void myListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //if (ReceivedEventListBox.SelectedItem == null && _lastSelectedItem != null) diff --git a/Txgy.EWS.Client.PageModule/Views/EarlyWarningViewBak.xaml.cs b/Txgy.EWS.Client.PageModule/Views/EarlyWarningViewBak.xaml.cs index bec1bb5..7e3af1f 100644 --- a/Txgy.EWS.Client.PageModule/Views/EarlyWarningViewBak.xaml.cs +++ b/Txgy.EWS.Client.PageModule/Views/EarlyWarningViewBak.xaml.cs @@ -65,7 +65,6 @@ namespace Txgy.EWS.Client.PageModule.Views double drawUnit = 1; Point _downPoint = new Point(0, 0); bool _isMoving = false; - double left = 0, top = 0; public bool IsShowGridText = true; public bool IsShowGrid = true; public System.Windows.Media.Color BackGroundColor = System.Windows.Media.Colors.White; @@ -104,7 +103,8 @@ namespace Txgy.EWS.Client.PageModule.Views //rpi.DrawPlanClipToDrawVisual(mes, (int)rView.canvasPlan.ActualWidth, (int)rView.canvasPlan.ActualHeight); rpi.Draw(null, canvas.Width, canvas.Height); //host = new VisualHost(); - canvas.Children.Add(rpi.host); + host = rpi.host; + canvas.Children.Add(host); baseX = GlobalConfig.ProjectConfig.WorkArea.EMin; baseY = GlobalConfig.ProjectConfig.WorkArea.NMin; diff --git a/Txgy.EWS.Client.PageModule/Views/FocalMechanismView.xaml.cs b/Txgy.EWS.Client.PageModule/Views/FocalMechanismView.xaml.cs index 0c9c837..bcac194 100644 --- a/Txgy.EWS.Client.PageModule/Views/FocalMechanismView.xaml.cs +++ b/Txgy.EWS.Client.PageModule/Views/FocalMechanismView.xaml.cs @@ -68,7 +68,6 @@ namespace Txgy.EWS.Client.PageModule.Views double drawUnit = 1; Point _downPoint = new Point(0, 0); bool _isMoving = false; - double left = 0, top = 0; public bool IsShowGridText = true; public bool IsShowGrid = true; public System.Windows.Media.Color BackGroundColor = System.Windows.Media.Colors.White; diff --git a/Txgy.EWS.Client.PageModule/Views/PlanView.xaml.cs b/Txgy.EWS.Client.PageModule/Views/PlanView.xaml.cs index 35d2d24..90cc485 100644 --- a/Txgy.EWS.Client.PageModule/Views/PlanView.xaml.cs +++ b/Txgy.EWS.Client.PageModule/Views/PlanView.xaml.cs @@ -56,7 +56,6 @@ namespace Txgy.EWS.Client.PageModule.Views { Dispatcher _dispatcher; private readonly IEventAggregator _ea; - private readonly ISearchMsEventBLL searchMsEventBLL; IFreeSql fsqlSqLite = FreeSqlLocalSqLite.freeLocalSqLite; //private readonly IRemoteDownloadDataBLL remoteDownloadDataBLL; @@ -83,12 +82,9 @@ namespace Txgy.EWS.Client.PageModule.Views public double stationFontSize = 10; double baseX = 39701000; double baseY = 4352000; - double xDrawUnit = 1; - double yDrawUnit = 1; double drawUnit = 1; Point _downPoint = new Point(0, 0); bool _isMoving = false; - double left = 0, top = 0; public bool IsShowGridText = true; public bool IsShowGrid = true; public System.Windows.Media.Color BackGroundColor = System.Windows.Media.Colors.White; @@ -129,7 +125,8 @@ namespace Txgy.EWS.Client.PageModule.Views height = canvas.Height; //rpi.DrawPlanClipToDrawVisual(mes, (int)rView.canvasPlan.ActualWidth, (int)rView.canvasPlan.ActualHeight); rpi.DrawGier(null, width, height); - canvas.Children.Add(rpi.host); + host = rpi.host; + canvas.Children.Add(host); _handleDataGenerated = new HandleDataGeneratedDelegate(rpi.DrawGier); diff --git a/Txgy.EWS.Client.PageModule/Views/ReportDayListView.xaml.cs b/Txgy.EWS.Client.PageModule/Views/ReportDayListView.xaml.cs index a711f06..18136f4 100644 --- a/Txgy.EWS.Client.PageModule/Views/ReportDayListView.xaml.cs +++ b/Txgy.EWS.Client.PageModule/Views/ReportDayListView.xaml.cs @@ -37,9 +37,6 @@ namespace Txgy.EWS.Client.PageModule.Views IFreeSql fsqlTencent = FreeSqlTencent.tencentRemoteMySQL; ReportFreqImage reportImage = new ReportFreqImage(); CultureInfo culture = new CultureInfo("zh-CN"); - byte[] dayFreqBytes = null; - byte[] dayMiddleEventPlanBytes = null; - byte[] dayMiddleEventStereoBytes = null; public string dayFreqImagePath; public int dayFreqImageWidth = 1485; public int dayFreqImageHeight = 585; diff --git a/Txgy.EWS.Client.SysModule/ViewModels/AddFileDialogViewModel.cs b/Txgy.EWS.Client.SysModule/ViewModels/AddFileDialogViewModel.cs index 574a441..73c4e09 100644 --- a/Txgy.EWS.Client.SysModule/ViewModels/AddFileDialogViewModel.cs +++ b/Txgy.EWS.Client.SysModule/ViewModels/AddFileDialogViewModel.cs @@ -19,7 +19,9 @@ namespace Txgy.EWS.Client.SysModule.ViewModels { public string Title => "系统更新文件上传"; +#pragma warning disable CS0067 public event Action RequestClose; +#pragma warning restore CS0067 public bool CanCloseDialog() => true;