|
|
|
|
@ -2,10 +2,15 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Media.Media3D;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using SmartAquaViewer.Classes;
|
|
|
|
|
using SmartAquaViewer.DataAnalysis;
|
|
|
|
|
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
|
|
|
|
|
|
|
|
|
|
@ -41,9 +46,90 @@ namespace SmartAquaViewer.Model
|
|
|
|
|
OnPropertyChanged(nameof(WaterQualityList));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetCCTVInfoList()
|
|
|
|
|
public void GetCCTVInfoListFromJson()
|
|
|
|
|
{
|
|
|
|
|
string cctvListPath = Utils.Instance.GetDataFileContentPath(Constants.DataFiles.CCTV_LIST);
|
|
|
|
|
if (!File.Exists(cctvListPath))
|
|
|
|
|
CreateAndSetMockUpCCTVInfoList(cctvListPath);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
string jsonString = File.ReadAllText(cctvListPath);
|
|
|
|
|
var cctvInfoList = JsonConvert.DeserializeObject<List<CCTVInfo>>(jsonString) ?? new List<CCTVInfo>();
|
|
|
|
|
|
|
|
|
|
CctvInfoList = new ObservableCollection<CCTVInfo>(cctvInfoList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CreateAndSetMockUpCCTVInfoList(string filePath)
|
|
|
|
|
{
|
|
|
|
|
CctvInfoList.Clear();
|
|
|
|
|
|
|
|
|
|
CctvInfoList = new ObservableCollection<CCTVInfo>()
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000001",
|
|
|
|
|
DeviceName = "CCTV 1",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-07",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000002",
|
|
|
|
|
DeviceName = "CCTV 2",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-08",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000003",
|
|
|
|
|
DeviceName = "CCTV 3",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-01",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000004",
|
|
|
|
|
DeviceName = "CCTV 4",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-02",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000005",
|
|
|
|
|
DeviceName = "CCTV 5",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-03",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000006",
|
|
|
|
|
DeviceName = "CCTV 6",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-04",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000007",
|
|
|
|
|
DeviceName = "CCTV 7",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-05",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
},
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
DeviceId = "000008",
|
|
|
|
|
DeviceName = "CCTV 8",
|
|
|
|
|
RtspUrl = "rtsp://210.217.121.58:8554/CAM-06",
|
|
|
|
|
Status = CCTVStatus.Disconnected
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
string updatedJson = JsonConvert.SerializeObject(CctvInfoList, Formatting.Indented);
|
|
|
|
|
File.WriteAllText(filePath, updatedJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<CCTVInfo> GetCCTVInfoList()
|
|
|
|
|
{
|
|
|
|
|
return CctvInfoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
|
|