diff --git a/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/2271f2e6-1f58-42ee-ad77-3506a9b030ff.vsidx b/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/2271f2e6-1f58-42ee-ad77-3506a9b030ff.vsidx new file mode 100644 index 0000000..b470654 Binary files /dev/null and b/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/2271f2e6-1f58-42ee-ad77-3506a9b030ff.vsidx differ diff --git a/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/6abdc64d-5fa9-4e45-b43d-4ffa92e914fa.vsidx b/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/6abdc64d-5fa9-4e45-b43d-4ffa92e914fa.vsidx deleted file mode 100644 index 43b5376..0000000 Binary files a/FujianEarthquake_seabed/.vs/FujianEarthquake/FileContentIndex/6abdc64d-5fa9-4e45-b43d-4ffa92e914fa.vsidx and /dev/null differ diff --git a/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/.suo b/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/.suo index 0bb597b..346709c 100644 Binary files a/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/.suo and b/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/.suo differ diff --git a/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/DocumentLayout.json b/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/DocumentLayout.json index f362218..7fffa0e 100644 --- a/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/DocumentLayout.json +++ b/FujianEarthquake_seabed/.vs/FujianEarthquake/v17/DocumentLayout.json @@ -2,13 +2,29 @@ "Version": 1, "WorkspaceRootPath": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\", "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\alarmrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\alarmrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\common\\csvdownload.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\common\\csvdownload.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\views\\alarmrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\views\\alarmrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, { "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\logrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\logrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}", + "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}" }, { "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", @@ -18,26 +34,10 @@ "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\realtimedataviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\realtimedataviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, - { - "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}", - "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\app.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}" - }, - { - "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\views\\alarmrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", - "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\views\\alarmrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" - }, - { - "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\viewmodels\\alarmrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\viewmodels\\alarmrecordviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, { "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\views\\logrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\views\\logrecordview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" }, - { - "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\common\\csvdownload.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\common\\csvdownload.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, { "AbsoluteMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|f:\\code\\fjeq\\20240801_fjeq_upperpc\\fujianearthquake_seabed\\fujianearthquake\\models\\shorebasestationstatedatamodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{BC950963-02DC-4704-A532-8D46CE8933E5}|FujianEarthquake\\FujianEarthquake.csproj|solutionrelative:fujianearthquake\\models\\shorebasestationstatedatamodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -58,11 +58,11 @@ "DocumentGroups": [ { "DockedWidth": 163, - "SelectedChildIndex": 6, + "SelectedChildIndex": 11, "Children": [ { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 5, "Title": "App.config", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\App.config", "RelativeDocumentMoniker": "FujianEarthquake\\App.config", @@ -71,46 +71,48 @@ "ViewState": "AQIAAAAAAAAAAAAAAAAAAA4AAAAQAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|", "WhenOpened": "2024-07-30T08:37:35.106Z", - "IsPinned": true + "IsPinned": true, + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 3, "Title": "AlarmRecordView.xaml", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\Views\\AlarmRecordView.xaml", "RelativeDocumentMoniker": "FujianEarthquake\\Views\\AlarmRecordView.xaml", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\Views\\AlarmRecordView.xaml", "RelativeToolTip": "FujianEarthquake\\Views\\AlarmRecordView.xaml", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", - "WhenOpened": "2024-08-22T06:19:04.638Z" + "WhenOpened": "2024-08-22T06:19:04.638Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 2, "Title": "CSVDownload.cs", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\Common\\CSVDownload.cs", "RelativeDocumentMoniker": "FujianEarthquake\\Common\\CSVDownload.cs", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\Common\\CSVDownload.cs", "RelativeToolTip": "FujianEarthquake\\Common\\CSVDownload.cs", - "ViewState": "AQIAAB8AAAAAAAAAAAAQwHsAAAASAAAA", + "ViewState": "AQIAACUAAAAAAAAAAAAQwNkAAAAFAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-22T02:52:28.362Z" + "WhenOpened": "2024-08-22T02:52:28.362Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 6, "Title": "MainWindow.xaml", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\MainWindow.xaml", "RelativeDocumentMoniker": "FujianEarthquake\\MainWindow.xaml", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\MainWindow.xaml", "RelativeToolTip": "FujianEarthquake\\MainWindow.xaml", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", - "WhenOpened": "2024-08-22T00:51:43.018Z", - "EditorCaption": "" + "WhenOpened": "2024-08-22T00:51:43.018Z" }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 8, "Title": "LogRecordView.xaml", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\Views\\LogRecordView.xaml", "RelativeDocumentMoniker": "FujianEarthquake\\Views\\LogRecordView.xaml", @@ -121,25 +123,26 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 1, "Title": "AlarmRecordViewModel.cs", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\AlarmRecordViewModel.cs", "RelativeDocumentMoniker": "FujianEarthquake\\ViewModels\\AlarmRecordViewModel.cs", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\AlarmRecordViewModel.cs", "RelativeToolTip": "FujianEarthquake\\ViewModels\\AlarmRecordViewModel.cs", - "ViewState": "AQIAAEUAAAAAAAAAAAAAAFkAAAAAAAAA", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAMgBAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-07-30T08:15:25.234Z" + "WhenOpened": "2024-07-30T08:15:25.234Z", + "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 4, "Title": "LogRecordViewModel.cs", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\LogRecordViewModel.cs", "RelativeDocumentMoniker": "FujianEarthquake\\ViewModels\\LogRecordViewModel.cs", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\LogRecordViewModel.cs", "RelativeToolTip": "FujianEarthquake\\ViewModels\\LogRecordViewModel.cs", - "ViewState": "AQIAAEQBAAAAAAAAAADwv0oBAAAJAAAA", + "ViewState": "AQIAAMYAAAAAAAAAAAAgwGgBAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-07-30T08:14:39.106Z", "EditorCaption": "" @@ -181,7 +184,7 @@ }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 7, "Title": "RealTimeDataViewModel.cs", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\RealTimeDataViewModel.cs", "RelativeDocumentMoniker": "FujianEarthquake\\ViewModels\\RealTimeDataViewModel.cs", @@ -189,18 +192,17 @@ "RelativeToolTip": "FujianEarthquake\\ViewModels\\RealTimeDataViewModel.cs", "ViewState": "AQIAAAAAAAAAAAAAAAAAAA4AAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-07-30T00:23:05.266Z", - "EditorCaption": "" + "WhenOpened": "2024-07-30T00:23:05.266Z" }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 0, "Title": "MainViewModel.cs", "DocumentMoniker": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\MainViewModel.cs", "RelativeDocumentMoniker": "FujianEarthquake\\ViewModels\\MainViewModel.cs", "ToolTip": "F:\\Code\\FJEQ\\20240801_FJEQ_upperpc\\FujianEarthquake_seabed\\FujianEarthquake\\ViewModels\\MainViewModel.cs", "RelativeToolTip": "FujianEarthquake\\ViewModels\\MainViewModel.cs", - "ViewState": "AQIAADoAAAAAAAAAAAAAwGsBAAAAAAAA", + "ViewState": "AQIAAAIAAAAAAAAAAAAmwMsBAAABAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-07-29T02:48:21.6Z", "EditorCaption": "" diff --git a/FujianEarthquake_seabed/FujianEarthquake/Common/CSVDownload.cs b/FujianEarthquake_seabed/FujianEarthquake/Common/CSVDownload.cs index b7ee8a6..d752d97 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/Common/CSVDownload.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/Common/CSVDownload.cs @@ -5,6 +5,7 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Reflection; +using System.Windows; using System.Text; using System.Threading.Tasks; using System.Windows.Media; @@ -123,5 +124,96 @@ namespace FujianEarthquake.Common } #endregion + + #region AlarmRecord + /// + /// 获取类的属性集合(以便生成CSV文件的所有Column标题) + /// + /// + public static PropertyInfo[] GetAlarmRecordPropertyInfoArray() + { + PropertyInfo[] props = null; + try + { + Type type = typeof(AlarmRecordModel); + object obj = Activator.CreateInstance(type); + props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); + } + catch (Exception ex) + { } + return props; + } + + + /// + /// Save the List data to CSV file + /// + /// data source + /// file path + /// success flag + public static bool SaveAlarmRecordDataToCSVFile(ObservableCollection AlarmRecordList, string filePath) + { + bool successFlag = true; + + StringBuilder strColumn = new StringBuilder(); + StringBuilder strValue = new StringBuilder(); + StreamWriter sw = null; + PropertyInfo[] props = GetAlarmRecordPropertyInfoArray(); + + try + { + sw = new StreamWriter(filePath); + for (int i = 0; i < props.Length; i++) + { + strColumn.Append(props[i].Name); + strColumn.Append(","); + } + strColumn.Remove(strColumn.Length - 1, 1); + sw.WriteLine(strColumn); //write the column name + + for (int i = 0; i < AlarmRecordList.Count; i++) + { + strValue.Remove(0, strValue.Length); //clear the temp row value + strValue.Append(AlarmRecordList[i].Index); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].RecordTime); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].ParaName); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].ParaNum); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].ParaContent); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].ProcessingMethod); + strValue.Append(","); + if (AlarmRecordList[i].UrgencyLevel == (ImageSource)Application.Current.FindResource("CycleRed")) + strValue.Append("一级紧急"); + else if (AlarmRecordList[i].UrgencyLevel == (ImageSource)Application.Current.FindResource("CycleOrange")) + strValue.Append("二级紧急"); + else if (AlarmRecordList[i].UrgencyLevel == (ImageSource)Application.Current.FindResource("CycleYellow")) + strValue.Append("三级紧急"); + strValue.Append(","); + strValue.Append(AlarmRecordList[i].IsHandled); + + sw.WriteLine(strValue); //write the row value + } + } + catch (Exception ex) + { + successFlag = false; + } + finally + { + if (sw != null) + { + sw.Dispose(); + } + } + + return successFlag; + } + #endregion + + } } diff --git a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/AlarmRecordViewModel.cs b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/AlarmRecordViewModel.cs index 5ef631b..25427fb 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/AlarmRecordViewModel.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/AlarmRecordViewModel.cs @@ -1,11 +1,16 @@ using FujianEarthquake.Common; +using FujianEarthquake.DataAccess; using FujianEarthquake.Models; +using FujianEarthquake.Views.UserControls; +using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Windows; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using System.Windows.Threading; namespace FujianEarthquake.ViewModels @@ -93,10 +98,359 @@ namespace FujianEarthquake.ViewModels public DispatcherTimer timerDownloadDataMsgHidden = new DispatcherTimer(); - public AlarmRecordViewModel(int id) - { - + #region Data Filtering + public static DialogViewModel vm; + + private bool _isChecked; + + public bool IsChecked + { + get { return _isChecked; } + set + { + _isChecked = value; + this.DoNotify(); + + if (IsChecked) + { + if (string.IsNullOrEmpty(EndDateTime.ToString()) || string.IsNullOrEmpty(StartDateTime.ToString())) + { + IsChecked = false; + return; + } + + if (EndDateTime < StartDateTime) + { + HandyControl.Controls.Dialog.Show(new TextDialog("起始时间大于结束时间,\n请重新输入!")); + IsChecked = false; + //this.EndDateTime = DateTime.Now; + //this.StartDateTime = DateTime.Now.AddDays(-1); + return; + } + + timeSearch = " and DataTime BETWEEN '" + StartDateTime + "' and '" + EndDateTime + "' "; + } + else + { + timeSearch = ""; + } + + //设置当前页为1 + PageIndex = 1; + + TotalAlarmRecordList.Clear(); + AlarmRecordList.Clear(); + + string sql = String.Format("select * from underjuncbox_alarm_info where StationID = {0} {1} ORDER by id desc limit 100", station_id, timeSearch); + MySqlDataReader dataReader = DBHelper.ExecuteReader(sql, 1); + int index = 1; + while (dataReader.Read()) + { + AlarmRecordModel alarmRecordModel = new AlarmRecordModel(); + alarmRecordModel.Index = index++; + alarmRecordModel.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); + alarmRecordModel.ParaName = dataReader["ParaName"].ToString(); + alarmRecordModel.ParaNum = Convert.ToInt32(string.IsNullOrEmpty(dataReader["ParaNum"].ToString()) ? 0 : dataReader["ParaNum"]); + alarmRecordModel.ParaContent = dataReader["ParaContent"].ToString(); + alarmRecordModel.ProcessingMethod = dataReader["ProcessingMethod"].ToString(); + if (dataReader["UrgencyLevel"].ToString() == "1") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleRed"); + } + else if (dataReader["UrgencyLevel"].ToString() == "2") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleOrange"); + } + else + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleYellow"); + } + if (dataReader["IsHandled"].ToString() == "0") + { + alarmRecordModel.IsHandled = "未处理"; + } + else if (dataReader["IsHandled"].ToString() == "1") + { + alarmRecordModel.IsHandled = "已处理"; + } + else + { + alarmRecordModel.IsHandled = "处理中"; + } + TotalAlarmRecordList.Add(alarmRecordModel); + } + dataReader.Dispose(); + + RecordCount = index - 1; + if (RecordCount <= 10) + { + TotalPage = 1; + + AlarmRecordList = TotalAlarmRecordList; + } + else + { + TotalPage = (int)Math.Ceiling((double)RecordCount / 10); + + for (int i = 0; i < 10; i++) + { + AlarmRecordList.Add(TotalAlarmRecordList[i]); + } + } + + AlarmMsg = string.Format("共计{0}页,当前第{1}页", TotalPage, PageIndex); + + string record = "查询告警记录历史记录,查询时间范围为:" + StartDateTime + "至" + EndDateTime + ",共查询到" + RecordCount + "条历史记录"; + + sql = $"insert into underjuncbox_log_record(StationID,RecordTime,Device_Name,Operation_Type,Record) values('{station_id}','{DateTime.Now}','海底地震监测基站','数据查询','{record}');"; + DBHelper.ExecuteNonQuery(sql, 1); + } } + #endregion + + + public AlarmRecordViewModel(int id) + { + // 默认查询1天内的日志 + this.EndDateTime = DateTime.Now; + this.StartDateTime = DateTime.Now.AddDays(-1); + + PageIndex = 1; + station_id = id; + + vm = new DialogViewModel + { + Content = "" + }; + + + #region Command Set + this.ForwordAlarmCommand = new CommandBase(); + this.ForwordAlarmCommand.DoExcute = new Action(ForwordAlarm); + this.ForwordAlarmCommand.DoCanExcute = new Func((o) => true); + + this.NextAlarmCommand = new CommandBase(); + this.NextAlarmCommand.DoExcute = new Action(NextAlarm); + this.NextAlarmCommand.DoCanExcute = new Func((o) => true); + + this.RefreshDataCommand = new CommandBase(); + this.RefreshDataCommand.DoExcute = new Action(RefreshData); + this.RefreshDataCommand.DoCanExcute = new Func((o) => true); + + this.DownloadDataCommand = new CommandBase(); + this.DownloadDataCommand.DoExcute = new Action(DownloadData); + this.DownloadDataCommand.DoCanExcute = new Func((o) => true); + #endregion + + + timerDownloadDataMsgHidden.Interval = TimeSpan.FromSeconds(2); + timerDownloadDataMsgHidden.Tick += TimerDownloadDataMsgHidden_Tick; + } + + + #region RefreshData + public void RefreshData(object o) + { + if (IsChecked) + { + timeSearch = " and DataTime BETWEEN '" + StartDateTime + "' and '" + EndDateTime + "' "; + } + else + { + timeSearch = ""; + } + + //设置当前页为1 + PageIndex = 1; + + TotalAlarmRecordList.Clear(); + AlarmRecordList.Clear(); + + string sql = String.Format("select * from underjuncbox_alarm_info where StationID = {0} {1} ORDER by id desc limit 100", station_id, timeSearch); + MySqlDataReader dataReader = DBHelper.ExecuteReader(sql, 1); + int index = 1; + while (dataReader.Read()) + { + AlarmRecordModel alarmRecordModel = new AlarmRecordModel(); + alarmRecordModel.Index = index++; + alarmRecordModel.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); + alarmRecordModel.ParaName = dataReader["ParaName"].ToString(); + alarmRecordModel.ParaNum = Convert.ToInt32(string.IsNullOrEmpty(dataReader["ParaNum"].ToString()) ? 0 : dataReader["ParaNum"]); + alarmRecordModel.ParaContent = dataReader["ParaContent"].ToString(); + alarmRecordModel.ProcessingMethod = dataReader["ProcessingMethod"].ToString(); + if (dataReader["UrgencyLevel"].ToString() == "1") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleRed"); + } + else if (dataReader["UrgencyLevel"].ToString() == "2") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleOrange"); + } + else + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleYellow"); + } + if (dataReader["IsHandled"].ToString() == "0") + { + alarmRecordModel.IsHandled = "未处理"; + } + else if (dataReader["IsHandled"].ToString() == "1") + { + alarmRecordModel.IsHandled = "已处理"; + } + else + { + alarmRecordModel.IsHandled = "处理中"; + } + TotalAlarmRecordList.Add(alarmRecordModel); + } + dataReader.Dispose(); + + RecordCount = index - 1; + if (RecordCount <= 10) + { + TotalPage = 1; + + AlarmRecordList = TotalAlarmRecordList; + } + else + { + TotalPage = (int)Math.Ceiling((double)RecordCount / 10); + + for (int i = 0; i < 10; i++) + { + AlarmRecordList.Add(TotalAlarmRecordList[i]); + } + } + + AlarmMsg = string.Format("共计{0}页,当前第{1}页", TotalPage, PageIndex); + + sql = $"insert into underjuncbox_log_record(StationID,RecordTime,Device_Name,Operation_Type,Record) values('{station_id}','{DateTime.Now}','海底地震监测基站','数据刷新','刷新告警记录');"; + DBHelper.ExecuteNonQuery(sql, 1); + } + #endregion + + + #region DownloadData + private void TimerDownloadDataMsgHidden_Tick(object sender, EventArgs e) + { + DownloadDataMsgVisibility = Visibility.Hidden; + + // 停止定时器 + (sender as DispatcherTimer).Stop(); + } + + private string downloadDataMsg; + + public string DownloadDataMsg + { + get { return downloadDataMsg; } + set { downloadDataMsg = value; this.DoNotify(); } + } + + private Brush downloadDataMsgForeground; + + public Brush DownloadDataMsgForeground + { + get { return downloadDataMsgForeground; } + set { downloadDataMsgForeground = value; this.DoNotify(); } + } + + private bool downloadDataBtnIsEnabled = true; + + public bool DownloadDataBtnIsEnabled + { + get { return downloadDataBtnIsEnabled; } + set { downloadDataBtnIsEnabled = value; this.DoNotify(); } + } + + private Visibility downloadDataMsgVisibility = Visibility.Visible; + + public Visibility DownloadDataMsgVisibility + { + get { return downloadDataMsgVisibility; } + set { downloadDataMsgVisibility = value; this.DoNotify(); } + } + + public void DownloadData(object o) + { + DownloadDataBtnIsEnabled = false; + + string baseStationFolder = Tools.GetAppSetting("AlarmRecordFolder"); + string savePath = CSVDownload.CreateFile(baseStationFolder, "AlarmRecord_" + DateTime.Now.ToString("yyyyMMddhhMMss"), "csv"); + + bool result = CSVDownload.SaveAlarmRecordDataToCSVFile(TotalAlarmRecordList, savePath); + if (result) + { + DownloadDataMsg = "下载数据成功!"; + DownloadDataMsgVisibility = Visibility.Visible; + DownloadDataMsgForeground = new SolidColorBrush(Colors.Green); + } + else + { + DownloadDataMsg = "下载数据失败!"; + DownloadDataMsgVisibility = Visibility.Visible; + DownloadDataMsgForeground = new SolidColorBrush(Colors.Red); + } + + timerDownloadDataMsgHidden.Start(); + DownloadDataBtnIsEnabled = true; + + string record = "下载告警记录," + DownloadDataMsg; + + string sql = $"insert into log_record(StationID,RecordTime,Device_Name,Operation_Type,Record) values('{station_id}','{DateTime.Now}','海底地震监测基站','数据下载','{record}');"; + DBHelper.ExecuteNonQuery(sql, 1); + } + #endregion + + + #region Page Switching + public void ForwordAlarm(object o) + { + if (PageIndex == 1) + return; + + try + { + PageIndex -= 1; + + AlarmRecordList.Clear(); + for (int i = 0; i < 10; i++) + { + AlarmRecordList.Add(TotalAlarmRecordList[i + (PageIndex - 1) * 10]); + } + AlarmMsg = string.Format("共计{0}页,当前第{1}页", TotalPage, PageIndex); + } + catch + { + TotalAlarmRecordList.Clear(); + AlarmRecordList.Clear(); + } + } + + public void NextAlarm(object o) + { + if (PageIndex == TotalPage) + return; + + try + { + PageIndex += 1; + + AlarmRecordList.Clear(); + for (int i = 0; i < (PageIndex == TotalPage ? (RecordCount - (PageIndex - 1) * 10) : 10); i++) + { + AlarmRecordList.Add(TotalAlarmRecordList[i + (PageIndex - 1) * 10]); + } + AlarmMsg = string.Format("共计{0}页,当前第{1}页", TotalPage, PageIndex); + } + catch + { + TotalAlarmRecordList.Clear(); + AlarmRecordList.Clear(); + } + } + #endregion } } diff --git a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/LogRecordViewModel.cs b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/LogRecordViewModel.cs index f187660..ef06645 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/LogRecordViewModel.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/LogRecordViewModel.cs @@ -332,7 +332,7 @@ namespace FujianEarthquake.ViewModels DownloadDataBtnIsEnabled = false; string baseStationFolder = Tools.GetAppSetting("LogRecordFolder"); - string savePath = CSVDownload.CreateFile(baseStationFolder, "UnderJuncboxLogRecord_" + DateTime.Now.ToString("yyyyMMddhhMMss"), "csv"); + string savePath = CSVDownload.CreateFile(baseStationFolder, "LogRecord_" + DateTime.Now.ToString("yyyyMMddhhMMss"), "csv"); bool result = CSVDownload.SaveLogRecordDataToCSVFile(TotalLogRecordList, savePath); if (result) diff --git a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/MainViewModel.cs b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/MainViewModel.cs index 8f12aea..8681fc1 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/ViewModels/MainViewModel.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/ViewModels/MainViewModel.cs @@ -20,18 +20,12 @@ namespace FujianEarthquake.ViewModels public static RealTimeDataViewModel realTimeDataViewModel1 = new RealTimeDataViewModel(1); public static RealTimeDataViewModel realTimeDataViewModel2 = new RealTimeDataViewModel(2); public static RealTimeDataViewModel realTimeDataViewModel3 = new RealTimeDataViewModel(3); - //public static RealTimeDataViewModel realTimeDataViewModel4 = new RealTimeDataViewModel(4); - //public static RealTimeDataViewModel realTimeDataViewModel5 = new RealTimeDataViewModel(5); public static AlarmRecordViewModel alarmRecordViewModel1 = new AlarmRecordViewModel(1); public static AlarmRecordViewModel alarmRecordViewModel2 = new AlarmRecordViewModel(2); public static AlarmRecordViewModel alarmRecordViewModel3 = new AlarmRecordViewModel(3); - //public static AlarmRecordViewModel alarmRecordViewModel4 = new AlarmRecordViewModel(4); - //public static AlarmRecordViewModel alarmRecordViewModel5 = new AlarmRecordViewModel(5); public static LogRecordViewModel logRecordViewModel1 = new LogRecordViewModel(1); public static LogRecordViewModel logRecordViewModel2 = new LogRecordViewModel(2); public static LogRecordViewModel logRecordViewModel3 = new LogRecordViewModel(3); - //public static LogRecordViewModel logRecordViewModel4 = new LogRecordViewModel(4); - //public static LogRecordViewModel logRecordViewModel5 = new LogRecordViewModel(5); #endregion @@ -145,50 +139,150 @@ namespace FujianEarthquake.ViewModels logRecordViewModel3.LogRecordList.Add(logRecordViewModel3.TotalLogRecordList[i]); } logRecordViewModel3.LogMsg = string.Format("共计{0}页,当前第{1}页", logRecordViewModel3.TotalPage, 1); + #endregion - //sql = String.Format("select * from intejunctionbox_log_record where StationID = {0} ORDER by id desc limit 100", 4); - //dataReader = DBHelper.ExecuteReader(sql, 1); - //index = 1; - //while (dataReader.Read()) - //{ - // LogRecordModel logRecord = new LogRecordModel(); - // logRecord.Index = index++; - // logRecord.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); - // logRecord.Device_Name = dataReader["Device_Name"].ToString(); - // logRecord.Operation_Type = dataReader["Operation_Type"].ToString(); - // logRecord.Record = dataReader["Record"].ToString(); - // logRecordViewModel4.TotalLogRecordList.Add(logRecord); - //} - //dataReader.Dispose(); - //logRecordViewModel4.RecordCount = index - 1; - //logRecordViewModel4.TotalPage = index <= 10 ? 1 : (int)Math.Ceiling((double)index / 10); - //for (int i = 0; i < (logRecordViewModel4.RecordCount < 10 ? logRecordViewModel4.RecordCount : 10); i++) - //{ - // logRecordViewModel4.LogRecordList.Add(logRecordViewModel4.TotalLogRecordList[i]); - //} - //logRecordViewModel4.LogMsg = string.Format("共计{0}页,当前第{1}页", logRecordViewModel4.TotalPage, 1); - //sql = String.Format("select * from seisverfyplatform_log_record where StationID = {0} ORDER by id desc limit 100", 5); - //dataReader = DBHelper.ExecuteReader(sql, 1); - //index = 1; - //while (dataReader.Read()) - //{ - // LogRecordModel logRecord = new LogRecordModel(); - // logRecord.Index = index++; - // logRecord.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); - // logRecord.Device_Name = dataReader["Device_Name"].ToString(); - // logRecord.Operation_Type = dataReader["Operation_Type"].ToString(); - // logRecord.Record = dataReader["Record"].ToString(); - // logRecordViewModel5.TotalLogRecordList.Add(logRecord); - //} - //dataReader.Dispose(); - //logRecordViewModel5.RecordCount = index - 1; - //logRecordViewModel5.TotalPage = index <= 10 ? 1 : (int)Math.Ceiling((double)index / 10); - //for (int i = 0; i < (logRecordViewModel5.RecordCount < 10 ? logRecordViewModel5.RecordCount : 10); i++) - //{ - // logRecordViewModel5.LogRecordList.Add(logRecordViewModel5.TotalLogRecordList[i]); - //} - //logRecordViewModel5.LogMsg = string.Format("共计{0}页,当前第{1}页", logRecordViewModel5.TotalPage, 1); + #region 告警页面初始化 + sql = String.Format("select * from underjuncbox_alarm_info where StationID = {0} ORDER by id desc limit 100", 1); + dataReader = DBHelper.ExecuteReader(sql, 1); + index = 1; + while (dataReader.Read()) + { + AlarmRecordModel alarmRecordModel = new AlarmRecordModel(); + alarmRecordModel.Index = index++; + alarmRecordModel.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); + alarmRecordModel.ParaName = dataReader["ParaName"].ToString(); + alarmRecordModel.ParaNum = Convert.ToInt32(string.IsNullOrEmpty(dataReader["ParaNum"].ToString()) ? 0 : dataReader["ParaNum"]); + alarmRecordModel.ParaContent = dataReader["ParaContent"].ToString(); + alarmRecordModel.ProcessingMethod = dataReader["ProcessingMethod"].ToString(); + if (dataReader["UrgencyLevel"].ToString() == "1") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleRed"); + } + else if (dataReader["UrgencyLevel"].ToString() == "2") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleOrange"); + } + else + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleYellow"); + } + if (dataReader["IsHandled"].ToString() == "0") + { + alarmRecordModel.IsHandled = "未处理"; + } + else if (dataReader["IsHandled"].ToString() == "1") + { + alarmRecordModel.IsHandled = "已处理"; + } + else + { + alarmRecordModel.IsHandled = "处理中"; + } + alarmRecordViewModel1.TotalAlarmRecordList.Add(alarmRecordModel); + } + dataReader.Dispose(); + alarmRecordViewModel1.RecordCount = index - 1; + alarmRecordViewModel1.TotalPage = (index - 1) <= 10 ? 1 : (int)Math.Ceiling((double)(index - 1) / 10); + for (int i = 0; i < (alarmRecordViewModel1.RecordCount < 10 ? alarmRecordViewModel1.RecordCount : 10); i++) + { + alarmRecordViewModel1.AlarmRecordList.Add(alarmRecordViewModel1.TotalAlarmRecordList[i]); + } + alarmRecordViewModel1.AlarmMsg = string.Format("共计{0}页,当前第{1}页", alarmRecordViewModel1.TotalPage, 1); + + sql = String.Format("select * from underjuncbox_alarm_info where StationID = {0} ORDER by id desc limit 100", 2); + dataReader = DBHelper.ExecuteReader(sql, 1); + index = 1; + while (dataReader.Read()) + { + AlarmRecordModel alarmRecordModel = new AlarmRecordModel(); + alarmRecordModel.Index = index++; + alarmRecordModel.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); + alarmRecordModel.ParaName = dataReader["ParaName"].ToString(); + alarmRecordModel.ParaNum = Convert.ToInt32(string.IsNullOrEmpty(dataReader["ParaNum"].ToString()) ? 0 : dataReader["ParaNum"]); + alarmRecordModel.ParaContent = dataReader["ParaContent"].ToString(); + alarmRecordModel.ProcessingMethod = dataReader["ProcessingMethod"].ToString(); + if (dataReader["UrgencyLevel"].ToString() == "1") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleRed"); + } + else if (dataReader["UrgencyLevel"].ToString() == "2") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleOrange"); + } + else + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleYellow"); + } + if (dataReader["IsHandled"].ToString() == "0") + { + alarmRecordModel.IsHandled = "未处理"; + } + else if (dataReader["IsHandled"].ToString() == "1") + { + alarmRecordModel.IsHandled = "已处理"; + } + else + { + alarmRecordModel.IsHandled = "处理中"; + } + alarmRecordViewModel2.TotalAlarmRecordList.Add(alarmRecordModel); + } + dataReader.Dispose(); + alarmRecordViewModel2.RecordCount = index - 1; + alarmRecordViewModel2.TotalPage = (index - 1) <= 10 ? 1 : (int)Math.Ceiling((double)(index - 1) / 10); + for (int i = 0; i < (alarmRecordViewModel2.RecordCount < 10 ? alarmRecordViewModel2.RecordCount : 10); i++) + { + alarmRecordViewModel2.AlarmRecordList.Add(alarmRecordViewModel2.TotalAlarmRecordList[i]); + } + alarmRecordViewModel2.AlarmMsg = string.Format("共计{0}页,当前第{1}页", alarmRecordViewModel2.TotalPage, 1); + + sql = String.Format("select * from underjuncbox_alarm_info where StationID = {0} ORDER by id desc limit 100", 3); + dataReader = DBHelper.ExecuteReader(sql, 1); + index = 1; + while (dataReader.Read()) + { + AlarmRecordModel alarmRecordModel = new AlarmRecordModel(); + alarmRecordModel.Index = index++; + alarmRecordModel.RecordTime = Convert.ToDateTime(dataReader["RecordTime"]); + alarmRecordModel.ParaName = dataReader["ParaName"].ToString(); + alarmRecordModel.ParaNum = Convert.ToInt32(string.IsNullOrEmpty(dataReader["ParaNum"].ToString()) ? 0 : dataReader["ParaNum"]); + alarmRecordModel.ParaContent = dataReader["ParaContent"].ToString(); + alarmRecordModel.ProcessingMethod = dataReader["ProcessingMethod"].ToString(); + if (dataReader["UrgencyLevel"].ToString() == "1") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleRed"); + } + else if (dataReader["UrgencyLevel"].ToString() == "2") + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleOrange"); + } + else + { + alarmRecordModel.UrgencyLevel = (ImageSource)Application.Current.FindResource("CycleYellow"); + } + if (dataReader["IsHandled"].ToString() == "0") + { + alarmRecordModel.IsHandled = "未处理"; + } + else if (dataReader["IsHandled"].ToString() == "1") + { + alarmRecordModel.IsHandled = "已处理"; + } + else + { + alarmRecordModel.IsHandled = "处理中"; + } + alarmRecordViewModel3.TotalAlarmRecordList.Add(alarmRecordModel); + } + dataReader.Dispose(); + alarmRecordViewModel3.RecordCount = index - 1; + alarmRecordViewModel3.TotalPage = (index - 1) <= 10 ? 1 : (int)Math.Ceiling((double)(index - 1) / 10); + for (int i = 0; i < (alarmRecordViewModel3.RecordCount < 10 ? alarmRecordViewModel3.RecordCount : 10); i++) + { + alarmRecordViewModel3.AlarmRecordList.Add(alarmRecordViewModel3.TotalAlarmRecordList[i]); + } + alarmRecordViewModel3.AlarmMsg = string.Format("共计{0}页,当前第{1}页", alarmRecordViewModel3.TotalPage, 1); #endregion diff --git a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfo.cs b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfo.cs index 724739b..78487fc 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfo.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("FujianEarthquake")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0c0f9f371adfd8bec2b68ee0684b7e4f23a0c931")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9d9eebd854faede45dee4d66fb0d85e732b621f8")] [assembly: System.Reflection.AssemblyProductAttribute("FujianEarthquake")] [assembly: System.Reflection.AssemblyTitleAttribute("FujianEarthquake")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfoInputs.cache b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfoInputs.cache index ea10482..b7802a9 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfoInputs.cache +++ b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake.AssemblyInfoInputs.cache @@ -1 +1 @@ -fb4272134568d8746d92fb97d62dd3ad2f52f24df8d325bd9a0fd17117b62f9a +2c17ca3ff2d18450e97629e78f87d566cb6f85fd1228a7bd7f58c9b7d7cd0ea7 diff --git a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake_MarkupCompile.i.lref b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake_MarkupCompile.i.lref index 3782dd3..9f80c17 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake_MarkupCompile.i.lref +++ b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/FujianEarthquake_MarkupCompile.i.lref @@ -1,13 +1,4 @@  -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\App.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\MainWindow.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\AlarmRecordView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\BaseStationModelView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\JunctionBoxEnvironDataView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\JunctionBoxStatusDataView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\LogRecordView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\RealTimeDataView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\ShoreBaseStationStatusDataView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\SystemControlView.xaml;; -FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\Views\UserControls\TextDialog.xaml;; + +FF:\Code\FJEQ\20240801_FJEQ_upperpc\FujianEarthquake_seabed\FujianEarthquake\MainWindow.xaml;; diff --git a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/MainWindow.g.i.cs b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/MainWindow.g.i.cs index f042ad6..93b95fc 100644 --- a/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/MainWindow.g.i.cs +++ b/FujianEarthquake_seabed/FujianEarthquake/obj/Debug/net6.0-windows/MainWindow.g.i.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "251452D84FC57D54B2222A3253298A5AAD37C47B" +#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "E9B45FFE73DAC7FAC85EA5965EA9EC4E9301A935" //------------------------------------------------------------------------------ // // 此代码由工具生成。