1 修改测试问题

2 更换波形回放功能库.dll
3 手动处理功能完善;
4 增加csv新配置文件;
master
mzhifa 7 months ago
parent c6f7c3c3f1
commit 7ddb0a75b0

@ -29,6 +29,12 @@ namespace StartServerWPF.Models
get { return proTitle; } get { return proTitle; }
set { proTitle = value; } set { proTitle = value; }
} }
private bool isEnable;
public bool IsEnable
{
get { return isEnable; }
set { isEnable = value; }
}
private string proPath; private string proPath;
/// <summary> /// <summary>

@ -92,6 +92,7 @@ namespace StartServerWPF.Models
model.Location = location; model.Location = location;
stations.Add(model); stations.Add(model);
} }
stations = stations.OrderBy(x => x.Num).ToList();
//释放资源 //释放资源
workbook = null; workbook = null;
worksheet = null; worksheet = null;

@ -72,11 +72,21 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
if(value >= 0) if(value >= 0)
{ {
var model = _workareasModelArray.workarea[value]; string path = string.Empty;
string jsonStr = File.ReadAllText(Path.Combine(model.filepath, "datapro.json")); try
var datas = JsonConvert.DeserializeObject<List<DataProModel>>(jsonStr); {
NameSource = new ObservableCollection<DataProModel>(); var model = _workareasModelArray.workarea[value];
datas.ForEach(d => { NameSource.Add(d); }); path = Path.Combine(model.filepath, "datapro.json");
string jsonStr = File.ReadAllText(path);
var datas = JsonConvert.DeserializeObject<List<DataProModel>>(jsonStr);
NameSource = new ObservableCollection<DataProModel>();
datas.ForEach(d => { NameSource.Add(d); });
}
catch (Exception ex)
{
MessageBox.Show("加载配置失败,"+path);
}
} }
SetProperty(ref _wareaSelectedIndex, value); SetProperty(ref _wareaSelectedIndex, value);
} }
@ -174,9 +184,23 @@ namespace StartServerWPF.Modules.Main.ViewModels
}); });
public DelegateCommand SaveCommand => new(() => public DelegateCommand SaveCommand => new(() =>
{ {
var item = NameSource[DataSelectedIndex];
item.DataPath = DataPath;
item.ResultPath = SavePath;
item.StartTime = StartSelectedDate;
item.EndTime=EndSelectedDate;
string jsonStr = JsonConvert.SerializeObject(NameSource, Formatting.Indented); string jsonStr = JsonConvert.SerializeObject(NameSource, Formatting.Indented);
var model = _workareasModelArray.workarea[WareaSelectedIndex]; var model = _workareasModelArray.workarea[WareaSelectedIndex];
File.WriteAllText(Path.Combine(model.filepath, "datapro.json"), jsonStr); File.WriteAllText(Path.Combine(model.filepath, "datapro.json"), jsonStr);
//dataProtools 配置更新
string temJson = JsonConvert.SerializeObject(_workareaModel);
var area = JsonConvert.DeserializeObject<WorkareaModel>(temJson);
ApmsModel tools = area.apmModel;
tools.savepath = SavePath;
tools.station = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.station)).Replace("\\", "/");
tools.ttime[0].ttime2d = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.ttime[0].ttime2d)).Replace("\\", "/");
JsonParser.WriteSystemConfigFile(Path.Combine(_systemConfig.dataProTools.ProPath, "apms.json"), tools);
}); });
public DelegateCommand<object> SelectFileCommand => new((obj) => public DelegateCommand<object> SelectFileCommand => new((obj) =>
@ -206,78 +230,66 @@ namespace StartServerWPF.Modules.Main.ViewModels
get => new DelegateCommand(() => get => new DelegateCommand(() =>
{ {
// 数据校验关键字段不能为空、年龄做数字区间的校验、做UserName的唯一检查自定义特性检查 // 数据校验关键字段不能为空、年龄做数字区间的校验、做UserName的唯一检查自定义特性检查
if (string.IsNullOrEmpty(DataPath) || string.IsNullOrEmpty(SavePath)) if (string.IsNullOrEmpty(DataPath) || string.IsNullOrEmpty(SavePath))
{
MessageBox.Show("内容不能为空", "提示", MessageBoxButton.OK);
return;
}
if (MessageBox.Show("确认修改?", "参数设置", MessageBoxButton.OKCancel,
MessageBoxImage.Exclamation) == MessageBoxResult.OK)
{ {
var time = (EndSelectedDate - StartSelectedDate); MessageBox.Show("内容不能为空", "提示", MessageBoxButton.OK);
if (time.TotalMinutes < 1) return;
{ }
MessageBox.Show("结束时间必需大于开始时间", "提示", MessageBoxButton.OK);
return; var time = (EndSelectedDate.AddSeconds(-EndSelectedDate.Second) - StartSelectedDate.AddSeconds(-StartSelectedDate.Second));
} if (time.TotalMinutes < 1)
DateTime dateTime = StartSelectedDate; {
string temPath = Path.GetPathRoot(_workareaModel.savepath) + "temPath"; MessageBox.Show("结束时间必需大于开始时间", "提示", MessageBoxButton.OK);
if (!Directory.Exists(temPath)) return;
{ }
Directory.CreateDirectory(temPath); DateTime dateTime = StartSelectedDate;
} string temPath = Path.GetPathRoot(_workareaModel.savepath) + "temPath";
Task.Run(() => if (!Directory.Exists(temPath))
{
Directory.CreateDirectory(temPath);
}
Task.Run(() =>
{
IsBusy = false;
while ((EndSelectedDate - dateTime).TotalMinutes >= 1)
{ {
IsBusy = false; string path = Path.GetFullPath($"{DataPath}\\{dateTime.Month.ToString().PadLeft(2, '0')}\\{dateTime.Day.ToString().PadLeft(2, '0')}\\{dateTime.Hour.ToString().PadLeft(2, '0')}\\{dateTime.Minute.ToString().PadLeft(2, '0')}");
while ((EndSelectedDate - dateTime).TotalMinutes >= 1) dateTime = dateTime.AddMinutes(1);
if (!Directory.Exists(path))
{ {
string path = Path.GetFullPath($"{DataPath}\\{dateTime.Month.ToString().PadLeft(2, '0')}\\{dateTime.Day.ToString().PadLeft(2, '0')}\\{dateTime.Hour.ToString().PadLeft(2, '0')}\\{dateTime.Minute.ToString().PadLeft(2, '0')}"); continue;
dateTime = dateTime.AddMinutes(1);
if (!Directory.Exists(path))
{
continue;
}
var mseedFiles = new DirectoryInfo(path).EnumerateFiles("*.mseed");
// var mseedFiles = files.Where(i => i.Extension == ".mseed");
Parallel.ForEach(mseedFiles, (item) =>
{
Debug.WriteLine($"***************path:{path},{item.FullName}");
File.Copy(item.FullName, Path.Combine(temPath, item.Name), true);
});
} }
var mseedFiles = new DirectoryInfo(path).EnumerateFiles("*.mseed");
// var mseedFiles = files.Where(i => i.Extension == ".mseed");
Parallel.ForEach(mseedFiles, (item) =>
{
Debug.WriteLine($"***************path:{path},{item.FullName}");
File.Copy(item.FullName, Path.Combine(temPath, item.Name), true);
});
}
ProcessInfo process = _systemConfig.dataProTools; ProcessInfo process = _systemConfig.dataProTools;
int index = process.ProParams.IndexOf("-wave"); int index = process.ProParams.IndexOf("-wave");
string str = process.ProParams.Substring(0, index) + "-wave"; string str = process.ProParams.Substring(0, index) + "-wave";
process.ProParams = $"{str} {temPath}"; process.ProParams = $"{str} {temPath}";
//dataProtools 配置更新
string temJson= JsonConvert.SerializeObject(_workareaModel);
var area = JsonConvert.DeserializeObject<WorkareaModel>(temJson); //JsonParser.DeepCopy<WorkareaModel>(_workareaModel);
ApmsModel tools = area.apmModel;
tools.savepath = SavePath;
tools.station = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.station)).Replace("\\", "/");
tools.ttime[0].ttime2d = Path.GetFullPath(Path.Combine(area.savepath, area.apmModel.ttime[0].ttime2d)).Replace("\\", "/");
JsonParser.WriteSystemConfigFile(Path.Combine(_systemConfig.dataProTools.ProPath, "apms.json"), tools);
var mfile = new DirectoryInfo(temPath).EnumerateFiles("*.mseed"); var mfile = new DirectoryInfo(temPath).EnumerateFiles("*.mseed");
if (mfile.Any()) if (mfile.Any())
{ {
isStart = true; isStart = true;
if (fileDic.Count != 0) fileDic.Clear(); if (fileDic.Count != 0) fileDic.Clear();
this.StartProcess(process); this.StartProcess(process);
} }
else else
{
IsBusy=true;
Application.Current.Dispatcher.InvokeAsync(() =>
{ {
Application.Current.Dispatcher.InvokeAsync(() => AddItems(ProcessSliceSource, new ProcessingInformationModel { ProcessMes = "没有需要处理的文件", MonitorTime = DateTime.Now.ToString() });
{ }, DispatcherPriority.ApplicationIdle);
AddItems(ProcessSliceSource, new ProcessingInformationModel { ProcessMes = "没有需要处理的文件", MonitorTime = DateTime.Now.ToString() }); }
}, DispatcherPriority.ApplicationIdle); });
}
});
}
}); });
} }
@ -290,6 +302,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
process.StartInfo.FileName = Path.GetFullPath(proInfo.ProPath + proInfo.ProName + ".exe"); process.StartInfo.FileName = Path.GetFullPath(proInfo.ProPath + proInfo.ProName + ".exe");
process.StartInfo.WorkingDirectory = Path.GetFullPath(proInfo.ProPath); process.StartInfo.WorkingDirectory = Path.GetFullPath(proInfo.ProPath);
process.StartInfo.Arguments = proInfo.ProParams; process.StartInfo.Arguments = proInfo.ProParams;
Debug.WriteLine($"*******name:{process.StartInfo.FileName}, arguments:{process.StartInfo.Arguments}*********");
process.StartInfo.UseShellExecute = false; process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardError = true;
@ -312,7 +325,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
return; return;
} }
list.Add(t1); list.Insert(0,t1);
if (list.Count > 30) if (list.Count > 30)
{ {
T item = list[0]; T item = list[0];
@ -362,16 +375,27 @@ namespace StartServerWPF.Modules.Main.ViewModels
private void Process_Exited(object? sender, EventArgs e) private void Process_Exited(object? sender, EventArgs e)
{ {
Debug.WriteLine($"****数据处理程序退出,{e.ToString()}******************");
IsBusy = true; IsBusy = true;
var fileName = Directory.GetFiles(SavePath, "*.index"); //处理完成后删除临时文件
if (!File.Exists( fileName.FirstOrDefault())) string temPath = Path.GetPathRoot(_workareaModel.savepath) + "temPath";
if (Directory.Exists(temPath))
{ {
return; Directory.Delete(temPath, true);
}
//解析处理后的事件文件
var fileName = Directory.GetFiles(SavePath, "*.index", SearchOption.AllDirectories);
List<string> lines = new List<string>();
foreach (var file in fileName)
{
string[] text = File.ReadAllLines(file);
var data = text.Where(p => StartSelectedDate <= Convert.ToDateTime(p.Split(" ")[0])
&& EndSelectedDate >= Convert.ToDateTime(p.Split(" ")[0]));
lines.AddRange(data);
} }
string[] text = File.ReadAllLines(fileName.FirstOrDefault());
Application.Current.Dispatcher.BeginInvoke(() => Application.Current.Dispatcher.BeginInvoke(() =>
{ {
foreach (var item in text) foreach (var item in lines)
{ {
ApmsEventSource.Add(new MsEventModel(item)); ApmsEventSource.Add(new MsEventModel(item));
} }

@ -34,7 +34,8 @@ namespace StartServerWPF.Modules.Main.ViewModels
Message = "View A" ; Message = "View A" ;
Console.WriteLine(System.Environment.CurrentDirectory + "\\" + JsonParser.systemConfigPath); Console.WriteLine(System.Environment.CurrentDirectory + "\\" + JsonParser.systemConfigPath);
_systemConfig = systemConfig; _systemConfig = systemConfig;
ApmsIsEnable = _systemConfig.proApms.IsEnable;
ToolsIsEnable= _systemConfig.proTools.IsEnable;
InitializeParams(); InitializeParams();
StartTime = DateTime.Now; StartTime = DateTime.Now;
Console.WriteLine(System.Environment.CurrentDirectory); Console.WriteLine(System.Environment.CurrentDirectory);
@ -196,6 +197,29 @@ namespace StartServerWPF.Modules.Main.ViewModels
get { return isIndeterminate; } get { return isIndeterminate; }
set { SetProperty(ref isIndeterminate, value); } set { SetProperty(ref isIndeterminate, value); }
} }
private bool apmsIsEnable;
public bool ApmsIsEnable
{
get { return apmsIsEnable; }
set
{
_systemConfig.proApms.IsEnable = value;
SetProperty(ref apmsIsEnable, value);
}
}
private bool toolsIsEnable;
public bool ToolsIsEnable
{
get { return toolsIsEnable; }
set
{
_systemConfig.proTools.IsEnable= value;
SetProperty(ref toolsIsEnable, value);
}
}
private ObservableCollection<ProcessModel> _processDataSource =new ObservableCollection<ProcessModel>(); private ObservableCollection<ProcessModel> _processDataSource =new ObservableCollection<ProcessModel>();
public ObservableCollection<ProcessModel> ProcessDataSource public ObservableCollection<ProcessModel> ProcessDataSource
@ -258,7 +282,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
return; return;
} }
list.Add(t1); list.Insert(0,t1);
if (list.Count > 30) if (list.Count > 30)
{ {
T item = list[0]; T item = list[0];
@ -385,7 +409,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
foreach (var item in _systemConfig.GetType().GetProperties()) foreach (var item in _systemConfig.GetType().GetProperties())
{ {
var pro = item.GetValue(_systemConfig) as ProcessInfo; var pro = item.GetValue(_systemConfig) as ProcessInfo;
if (pro != null&& pro.ProTitle!= "数据处理") if (pro != null&& pro.IsEnable && pro.ProTitle!= "数据处理")
{ {
StartTime = DateTime.Now; StartTime = DateTime.Now;
pro.Pid= StartProcess(pro); pro.Pid= StartProcess(pro);
@ -418,7 +442,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
foreach (var item in _systemConfig.GetType().GetProperties()) foreach (var item in _systemConfig.GetType().GetProperties())
{ {
var pro = item.GetValue(_systemConfig) as ProcessInfo; var pro = item.GetValue(_systemConfig) as ProcessInfo;
if (pro != null&& pro.ProTitle != "数据处理") if (pro != null&& pro.IsEnable && pro.ProTitle != "数据处理")
{ {
int indexPro = KillProcess(pro); int indexPro = KillProcess(pro);
var model= ProcessDataSource.Where(x => x.ProName == pro.ProName).FirstOrDefault(); var model= ProcessDataSource.Where(x => x.ProName == pro.ProName).FirstOrDefault();

@ -1,5 +1,6 @@
using Google.Protobuf.WellKnownTypes; using Google.Protobuf.WellKnownTypes;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Prism.Commands; using Prism.Commands;
using Prism.Ioc; using Prism.Ioc;
using Prism.Mvvm; using Prism.Mvvm;
@ -29,11 +30,11 @@ namespace StartServerWPF.Modules.Main.ViewModels
this._dialogService = dialogService; this._dialogService = dialogService;
_systemConfig = configModel; _systemConfig = configModel;
WareaModel = workareaModel; WareaModel = workareaModel;
wareaModelSingleton = workareaModel;
this._workareasModelArray = workareasModelArray; this._workareasModelArray = workareasModelArray;
MainModel = _systemConfig.vpnInfo; MainModel = _systemConfig.vpnInfo;
WorkareaNameSource = new ObservableCollection<string>(); WorkareaNameSource = new ObservableCollection<string>();
_workareasModelArray.workarea.Select(n=>n.workareaname).ToList().ForEach(a=> WorkareaNameSource.Add(a)); _workareasModelArray.workarea.Select(n=>n.workareaname).ToList().ForEach(a=> WorkareaNameSource.Add(a));
WareaSelectedIndex = _workareasModelArray.selectIndex;
} }
private string _title = "应用列表"; private string _title = "应用列表";
public string Title => _title; public string Title => _title;
@ -77,12 +78,12 @@ namespace StartServerWPF.Modules.Main.ViewModels
File.WriteAllText(file, JsonConvert.SerializeObject(WareaModel)); File.WriteAllText(file, JsonConvert.SerializeObject(WareaModel));
//MessageBox.Show("当前工区目录配置文件不存在," + ex.Message); //MessageBox.Show("当前工区目录配置文件不存在," + ex.Message);
} }
_workareasModelArray.selectIndex = value;
} }
SetProperty(ref _wareaSelectedIndex, value); SetProperty(ref _wareaSelectedIndex, value);
} }
} }
private WorkareaModel wareaModelSingleton = null;
private WorkareaModel _wareaModel = new WorkareaModel(); private WorkareaModel _wareaModel = new WorkareaModel();
public WorkareaModel WareaModel public WorkareaModel WareaModel
{ {
@ -107,6 +108,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
apmStationFile = string.Empty; apmStationFile = string.Empty;
apmttime2dFile = string.Empty; apmttime2dFile = string.Empty;
WareaSelectedIndex = _workareasModelArray.selectIndex;
}); });
public DelegateCommand AddItemCommand => new(() => public DelegateCommand AddItemCommand => new(() =>
@ -206,8 +208,11 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
case "apmsStation": case "apmsStation":
WareaModel.apmModel.station = fbd.SafeFileName; WareaModel.apmModel.station = fbd.SafeFileName;
apmStationFile = fbd.FileName; apmStationFile = fbd.FileName;
break;
WareaModel.StationConfig.Stations= WareaModel.CreateStationFromCSV(apmStationFile, WareaModel.StationConfig.Location)
?.Select(a => new StationState { IsEnable = a.Enable, Name = a.Num }).ToList();
break;
case "apmsttime2d": case "apmsttime2d":
WareaModel.apmModel.ttime[0].ttime2d = fbd.SafeFileName; WareaModel.apmModel.ttime[0].ttime2d = fbd.SafeFileName;
apmttime2dFile = fbd.FileName; apmttime2dFile = fbd.FileName;
@ -261,6 +266,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
MessageBoxImage.Exclamation) == MessageBoxResult.OK) MessageBoxImage.Exclamation) == MessageBoxResult.OK)
{ {
//1 Workarea配置更新选择的索引 //1 Workarea配置更新选择的索引
_workareasModelArray.selectIndex = WareaSelectedIndex;
JsonParser.WriteSystemConfigFile(Path.Combine(JsonParser.workareaPath, "Workareas.json"), _workareasModelArray); JsonParser.WriteSystemConfigFile(Path.Combine(JsonParser.workareaPath, "Workareas.json"), _workareasModelArray);
_wareaModel.apmModel.channels = new List<StationChannelsModel> _wareaModel.apmModel.channels = new List<StationChannelsModel>
{ {
@ -272,6 +278,18 @@ namespace StartServerWPF.Modules.Main.ViewModels
station = string.Join(",", _wareaModel.StationConfig.Stations.Where(p => p.IsEnable).Select(n => n.Name)) station = string.Join(",", _wareaModel.StationConfig.Stations.Where(p => p.IsEnable).Select(n => n.Name))
} }
}; };
wareaModelSingleton.workareaname = _wareaModel.workareaname;
wareaModelSingleton.apmpush2wx =_wareaModel.apmpush2wx;
wareaModelSingleton.toolpush2wx =_wareaModel.toolpush2wx;
wareaModelSingleton.savepath =_wareaModel.savepath;
wareaModelSingleton.chartsavepath=_wareaModel.chartsavepath;
wareaModelSingleton.apmsavepath =_wareaModel.apmsavepath;
wareaModelSingleton.toolsavepath =_wareaModel.toolsavepath;
wareaModelSingleton.delayTime =_wareaModel.delayTime;
wareaModelSingleton.apmModel = _wareaModel.apmModel;
wareaModelSingleton.StationConfig = _wareaModel.StationConfig;
JsonParser.WriteSystemConfigFile(Path.Combine(_wareaModel.savepath, Path.GetFileName(_wareaModel.savepath) + ".json"), _wareaModel); JsonParser.WriteSystemConfigFile(Path.Combine(_wareaModel.savepath, Path.GetFileName(_wareaModel.savepath) + ".json"), _wareaModel);
string temJson = JsonConvert.SerializeObject(_wareaModel); string temJson = JsonConvert.SerializeObject(_wareaModel);
@ -317,7 +335,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
//4 SystemConfig.json配置更新 //4 SystemConfig.json配置更新
int index = _systemConfig.proTools.ProParams.IndexOf("-savepath"); int index = _systemConfig.proTools.ProParams.IndexOf("-savepath");
string str = _systemConfig.proTools.ProParams.Substring(0, index) + "-savepath"; string str = _systemConfig.proTools.ProParams.Substring(0, index) + "-savepath";
_systemConfig.proTools.ProParams = $"{str} {tools.savepath} -delay {curWorkarea.delayTime * 60}"; _systemConfig.proTools.ProParams = $"{str} {Path.Combine(curWorkarea.savepath, curWorkarea.chartsavepath).Replace("\\", "/")} -delay {curWorkarea.delayTime * 60}";
JsonParser.WriteSystemConfigFile(JsonParser.systemConfigPath, _systemConfig); JsonParser.WriteSystemConfigFile(JsonParser.systemConfigPath, _systemConfig);
} }
//dataProTools配置更新 //dataProTools配置更新

@ -56,18 +56,18 @@
<DockPanel VerticalAlignment="Center"> <DockPanel VerticalAlignment="Center">
<TextBlock Text="配置名称:" Width="65" VerticalAlignment="Center"/> <TextBlock Text="配置名称:" Width="65" VerticalAlignment="Center"/>
<Button Content="删除" Background="#FFA6783E" Foreground="White" DockPanel.Dock="Right" Command="{Binding DeleteCommand}"/> <Button Content="删除" Background="#FFA6783E" Foreground="White" DockPanel.Dock="Right" Command="{Binding DeleteCommand}"/>
<Button Content="保存" Background="#FF0ABEFF" Foreground="White" DockPanel.Dock="Right" Command="{Binding AddItemCommand}"/> <Button Content="添加" Background="#FF0ABEFF" Foreground="White" DockPanel.Dock="Right" Command="{Binding AddItemCommand}"/>
<ComboBox DockPanel.Dock="Left" ItemsSource="{Binding NameSource}" DisplayMemberPath="Name" SelectedIndex="{Binding DataSelectedIndex}"/> <ComboBox DockPanel.Dock="Left" ItemsSource="{Binding NameSource}" DisplayMemberPath="Name" SelectedIndex="{Binding DataSelectedIndex}"/>
</DockPanel> </DockPanel>
<DockPanel VerticalAlignment="Center"> <DockPanel VerticalAlignment="Center">
<TextBlock Text="数据目录:" Width="65" VerticalAlignment="Center"/> <TextBlock Text="数据目录:" Width="65" VerticalAlignment="Center"/>
<Button Content="..." Foreground="White" DockPanel.Dock="Right" Command="{Binding SelectFileCommand}" CommandParameter="DataPath" Background="#FF0ABEFF"/> <Button Content="..." Foreground="White" DockPanel.Dock="Right" Command="{Binding SelectFileCommand}" CommandParameter="DataPath" Background="#FF0ABEFF"/>
<TextBox DockPanel.Dock="Left" Text="{Binding DataPath}"/> <TextBox DockPanel.Dock="Left" Text="{Binding DataPath}" IsReadOnly="True"/>
</DockPanel> </DockPanel>
<DockPanel VerticalAlignment="Center"> <DockPanel VerticalAlignment="Center">
<TextBlock Text="结果目录:" Width="65" VerticalAlignment="Center"/> <TextBlock Text="结果目录:" Width="65" VerticalAlignment="Center"/>
<Button Content="..." Foreground="White" DockPanel.Dock="Right" Command="{Binding SelectFileCommand}" CommandParameter="SavePath" Background="#FF0ABEFF"/> <Button Content="..." Foreground="White" DockPanel.Dock="Right" Command="{Binding SelectFileCommand}" CommandParameter="SavePath" Background="#FF0ABEFF"/>
<TextBox DockPanel.Dock="Left" Text="{Binding SavePath}"/> <TextBox DockPanel.Dock="Left" Text="{Binding SavePath}" IsReadOnly="True"/>
</DockPanel> </DockPanel>
<DockPanel VerticalAlignment="Center"> <DockPanel VerticalAlignment="Center">
<TextBlock Text="开始时间:" Width="65" VerticalAlignment="Center"/> <TextBlock Text="开始时间:" Width="65" VerticalAlignment="Center"/>
@ -103,7 +103,7 @@
</ListBox> </ListBox>
</Border> </Border>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="应用" Background="#FF0ABEFF" Foreground="White" Command="{Binding SaveCommand}" VerticalAlignment="Bottom" Margin="0,0,30,0"/> <Button Content="保存" Background="#FF0ABEFF" Foreground="White" Command="{Binding SaveCommand}" VerticalAlignment="Bottom" Margin="0,0,30,0"/>
<Button Content="开始" Background="#FF0ABEFF" Foreground="White" Command="{Binding StartCommand}" VerticalAlignment="Bottom" IsEnabled="{Binding IsBusy}"/> <Button Content="开始" Background="#FF0ABEFF" Foreground="White" Command="{Binding StartCommand}" VerticalAlignment="Bottom" IsEnabled="{Binding IsBusy}"/>
<hc:LoadingCircle Height="30" Visibility="{Binding IsBusy, Converter={StaticResource Boolean2VisibilityReConverter}}"/> <hc:LoadingCircle Height="30" Visibility="{Binding IsBusy, Converter={StaticResource Boolean2VisibilityReConverter}}"/>
</StackPanel> </StackPanel>

@ -76,7 +76,7 @@
<RowDefinition Height="35"/> <RowDefinition Height="35"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="启动服务:" VerticalAlignment="Center" FontSize="20"/> <TextBlock Text="启动服务:" VerticalAlignment="Center" FontSize="20"/>
<CheckBox IsChecked="False" Command="{Binding StartCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}" Style="{StaticResource ToggleButtonSwitch}" Grid.Column="1" HorizontalAlignment="Left"> <CheckBox IsChecked="False" Name="cBoxService" Command="{Binding StartCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}" Style="{StaticResource ToggleButtonSwitch}" Grid.Column="1" HorizontalAlignment="Left">
</CheckBox> </CheckBox>
<TextBlock Grid.Row="1" Grid.Column="0" FontSize="20" Text="启动时间:" VerticalAlignment="Center"/> <TextBlock Grid.Row="1" Grid.Column="0" FontSize="20" Text="启动时间:" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="20" Text="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock Grid.Row="1" Grid.Column="1" FontSize="20" Text="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
@ -107,16 +107,20 @@
<StackPanel > <StackPanel >
<TextBlock Text="程序运行状态" FontSize="22" Margin="20,10,0,10"/> <TextBlock Text="程序运行状态" FontSize="22" Margin="20,10,0,10"/>
<Grid Margin="10"> <Grid Margin="10">
<DataGrid ItemsSource="{Binding ProcessDataSource}" Background="White" IsReadOnly="True" AutoGenerateColumns="False"> <DataGrid ItemsSource="{Binding ProcessDataSource}" Background="White" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="程序" Width="80" Binding="{Binding ProcessTile}"/> <DataGridTextColumn Header="程序" Width="80" Binding="{Binding ProcessTile}"/>
<DataGridTextColumn Header="进程" Width="90" Binding="{Binding ProName}"/> <DataGridTextColumn Header="进程" Width="90" Binding="{Binding ProName}"/>
<DataGridTextColumn Header="监控时间" Width="*" Binding="{Binding MonitorTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"/> <DataGridTextColumn Header="监控时间" Width="*" Binding="{Binding MonitorTime,StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"/>
<DataGridTextColumn Header="运行状态" Width="80" Binding="{Binding ProcessStatus}"/> <DataGridTextColumn Header="运行状态" Width="80" Binding="{Binding ProcessStatus}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<!--<ProgressBar Grid.Row="4" Grid.ColumnSpan="3" VerticalAlignment="Bottom" IsIndeterminate="{Binding IsIndeterminate}" Foreground="Green" Value="0"/>--> <!--<ProgressBar Grid.Row="4" Grid.ColumnSpan="3" VerticalAlignment="Bottom" IsIndeterminate="{Binding IsIndeterminate}" Foreground="Green" Value="0"/>-->
</Grid> </Grid>
<UniformGrid Rows="1" IsEnabled="{Binding ElementName=cBoxService, Path=IsChecked, Converter={StaticResource Boolean2BooleanReConverter}}">
<CheckBox Content="数据处理" IsChecked="{Binding ApmsIsEnable}" Style="{StaticResource ToggleButtonSwitch}" Width="100"/>
<CheckBox Content="结果处理" IsChecked="{Binding ToolsIsEnable}" Style="{StaticResource ToggleButtonSwitch}" Width="100"/>
</UniformGrid>
</StackPanel> </StackPanel>
</Border> </Border>
<UniformGrid Grid.Column="1" Grid.RowSpan="2" Columns="1" > <UniformGrid Grid.Column="1" Grid.RowSpan="2" Columns="1" >

@ -202,7 +202,7 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.Row="3" Grid.Column="2" Margin="0,0,0,30"> <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.Row="3" Grid.Column="2" Margin="0,0,0,30">
<Button Content="添加工区" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding AddItemCommand}"/> <Button Content="添加工区" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding AddItemCommand}"/>
<Button Content="导入工区" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding ImportCommand}" Margin="20,0,20,0"/> <Button Content="导入工区" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding ImportCommand}" Margin="20,0,20,0"/>
<Button Content="应用" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding ConfirmCommand}"/> <Button Content="保存" Width="80" Height="30" Background="#FF0ABEFF" Foreground="White" Command="{Binding ConfirmCommand}"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>

@ -157,33 +157,84 @@ namespace StartServerWPF.Modules.MseedChart.Models
var asciifile = asciiFiles.GetFiles(); var asciifile = asciiFiles.GetFiles();
if (asciifile.Count() == 0) if (asciifile.Count() == 0)
{ {
// 并行运算 foreach(var item in mseedFiles)
Parallel.ForEach(mseedFiles, (item) =>
{ {
MSeed2Asc(item.FullName, Path.Combine(Path.GetDirectoryName(asciiSavePath), Path.GetFileNameWithoutExtension(item.Name))); var buffer= File.ReadAllBytes(item.FullName);
}); Mseed2asciiApi.bufferMseedData(buffer.Length, buffer);
// MSeed2Asc(item.FullName, Path.Combine(Path.GetDirectoryName(asciiSavePath), Path.GetFileNameWithoutExtension(item.Name)));
};
} }
// 并行运算 // 并行运算
Parallel.ForEach(asciiFiles.GetFiles(), (item) => // Parallel.ForEach(asciiFiles.GetFiles(), (item) =>
{ // {
var list = UpdateWavesFromTxt(item.FullName); // var list = UpdateWavesFromTxt(item.FullName);
list.ForEach(i => smList.Enqueue(i)); // list.ForEach(i => smList.Enqueue(i));
}); // });
var list = UpdateWavesFromTxt(asciiSavePath);
list.ForEach(i => smList.Enqueue(i));
} }
else else
{ {
if (!File.Exists(asciiSavePath)) if (!File.Exists(asciiSavePath))
{ {
MSeed2Asc(dataFilePath, asciiSavePath); // MSeed2Asc(dataFilePath, asciiSavePath);
} }
var list = UpdateWavesFromTxt(asciiSavePath); var buffer = File.ReadAllBytes(dataFilePath);
list.ForEach(i => smList.Enqueue(i)); Mseed2asciiApi.bufferMseedData(buffer.Length, buffer);
// var list = UpdateWavesFromTxt(asciiSavePath);
// list.ForEach(i => smList.Enqueue(i));
} }
sw.Stop(); sw.Stop();
Debug.WriteLine("MSeed2Asc解压时间" + sw.Elapsed.TotalSeconds); Debug.WriteLine("MSeed2Asc解压时间" + sw.Elapsed.TotalSeconds);
return smList; return smList;
} }
public List<StationModel> UpdateWavesFromMseedC(string data)
{
List<StationModel> temSM = new List<StationModel>();
if (data.Length > 0)
{
int channelFlag = 0;
string row = data.Trim();
StationModel station = new StationModel();
if (data.Contains("HA"))
{
string[] rowStr = data.Split(',');
string chnStr1 = rowStr[0].Substring(21, 3);
string stationName = rowStr[0].Substring(14, 3);
if (!temSM.Any(name => name.Name == stationName))
{
station = new StationModel();
station.Name = stationName;
station.BeginTime = Convert.ToDateTime(rowStr[3]).AddHours(8);
station.PointCount = int.Parse(rowStr[1].Trim().Split(' ')[0]);
station.SamplingFrequency = int.Parse(rowStr[2].Trim().Split(' ')[0]);
temSM.Add(station);
}
channelFlag = (chnStr1 == "SHZ") ? 0 : (chnStr1 == "SHN") ? 1 : 2;
}
else
{
switch (channelFlag)
{
case 0://Z
station.dz.Add(double.Parse(row));
break;
case 1://N
station.dn.Add(double.Parse(row));
break;
case 2://E
station.de.Add(double.Parse(row));
break;
}
}
// temSM.Add(station);
// temSM.Reverse();
}
return temSM;
}
public List<StationModel> UpdateWavesFromTxt(string fn) public List<StationModel> UpdateWavesFromTxt(string fn)
{ {
@ -245,7 +296,7 @@ namespace StartServerWPF.Modules.MseedChart.Models
} }
return temSM; return temSM;
} }
public void MSeed2Asc(string filePath, string savePath) public void MSeed2Asc(string filePath, string savePath)
{ {
using (Process compiler = new Process()) using (Process compiler = new Process())

@ -41,7 +41,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
_dispatcher = Application.Current.Dispatcher; _dispatcher = Application.Current.Dispatcher;
IntervalTime =1000; IntervalTime =1000;
loopCallback = new Mseed2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent); loopCallback = new Mseed2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
GC.KeepAlive(loopCallback); GC.KeepAlive(loopCallback);
workarea= workareaModel; workarea= workareaModel;
_wavesModel = new WavesModel(); _wavesModel = new WavesModel();
@ -281,11 +281,12 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
private void Loaded() private void Loaded()
{ {
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
} }
private void UnLoaded() private void UnLoaded()
{ {
Mseed2asciiApi.MseedDatasCallFun(null);
} }
private void Sure() private void Sure()

@ -34,12 +34,14 @@ using System.Windows.Threading;
using System.Xml.Linq; using System.Xml.Linq;
using Prism.Regions; using Prism.Regions;
using static System.Collections.Specialized.BitVector32; using static System.Collections.Specialized.BitVector32;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
namespace StartServerWPF.Modules.MseedChart.ViewModels namespace StartServerWPF.Modules.MseedChart.ViewModels
{ {
public class ChartPlotViewModel : BindableBase, INavigationAware public class ChartPlotViewModel : BindableBase, INavigationAware
{ {
Mseed2asciiApi.LoopCallbackHandler loopCallback;
public ChartPlotViewModel() public ChartPlotViewModel()
{ {
_dispatcher = Application.Current.Dispatcher; _dispatcher = Application.Current.Dispatcher;
@ -47,7 +49,77 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
(Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose; (Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose;
IntervalTime=100; IntervalTime=100;
CreateChart(); CreateChart();
loopCallback = new Mseed2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
GC.KeepAlive(loopCallback);
}
private void Mseed2AsciiEvent(AsciiDataStruct asciiData)
{
DateTime startTime = Convert.ToDateTime(asciiData.starttime).AddHours(8);
DateTime endTime = Convert.ToDateTime(asciiData.endtime).AddHours(8);
byte[] bytes = new byte[asciiData.numsamples * asciiData.samplesize];
// IntPtr bufferHandler = Marshal.AllocHGlobal((int)asciiData.datasize);
Marshal.Copy(asciiData.datasamples, bytes, 0, bytes.Length);
List<double> lines = new List<double>();
string[] sid = asciiData.sid.Substring(5).Split('_');
string name = $"{sid[0]}.{sid[1]}.{sid[2]}.{sid[3]}{sid[4]}{sid[5]}";
var ts = DateTime.Now.Subtract(startTime);
System.Diagnostics.Debug.WriteLine($"台站号:{name},总数:{asciiData.samprate},{asciiData.datasize},{asciiData.samplecnt}, {asciiData.numsamples},当前时间:{DateTime.Now.ToString("o")},接时间:{startTime.ToString("o")}********时间差:{ts.TotalSeconds}秒");
//if (ts.TotalSeconds > 20)
//{
// return;
//}
if (asciiData.sampletype == 'i')
{
for (int index = 0; index < bytes.Length; index += 4)
{
var a = BitConverter.ToInt32(bytes, index);
lines.Add(a);
}
}
else if (asciiData.sampletype == 'f')
{
for (int index = 0; index < bytes.Length; index += 4)
{
var b = BitConverter.ToSingle(bytes, index);
lines.Add(b);
}
}
else if (asciiData.sampletype == 'd')
{
for (int index = 0; index < bytes.Length; index += 8)
{
var b = BitConverter.ToDouble(bytes, index);
lines.Add(b);
}
}
var dat = smList.Where(p => p.Name == sid[1]).FirstOrDefault();
var channelFlag = ($"{sid[3]}{sid[4]}{sid[5]}" == "SHZ") ? 0 : ($"{sid[3]}{sid[4]}{sid[5]}" == "SHN") ? 1 : 2;
if (dat == null)
{
StationModel station = new StationModel
{
Name = sid[1],
BeginTime = startTime,
PointCount = (int)asciiData.numsamples,
SamplingFrequency = (int)asciiData.samprate,
};
smList.Enqueue(station);
dat = station;
}
switch (channelFlag)
{
case 0://Z
dat.dz.AddRange(lines);
break;
case 1://N
dat.dn.AddRange(lines);
break;
case 2://E
dat.de.AddRange(lines);
break;
}
} }
#region 字段 #region 字段
@ -244,17 +316,21 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
#region 事件 #region 事件
public DelegateCommand LoadedCommand => new DelegateCommand(Loaded); public DelegateCommand LoadedCommand => new DelegateCommand(Loaded);
public DelegateCommand UnloadedCommand => new DelegateCommand(UnLoaded);
public DelegateCommand<object> AxesYVisibleCommand => new DelegateCommand<object>(AxesYVisible); public DelegateCommand<object> AxesYVisibleCommand => new DelegateCommand<object>(AxesYVisible);
public DelegateCommand<object> FileSelectorCommand => new DelegateCommand<object>(FileSelector); public DelegateCommand<object> FileSelectorCommand => new DelegateCommand<object>(FileSelector);
public DelegateCommand<object> OtimeSortCommand => new DelegateCommand<object>(OtimeSort); public DelegateCommand<object> OtimeSortCommand => new DelegateCommand<object>(OtimeSort);
public DelegateCommand IntervalSureCommand => new DelegateCommand(IntervalSure); public DelegateCommand IntervalSureCommand => new DelegateCommand(IntervalSure);
public DelegateCommand<object> RealTimeDataCommand => new DelegateCommand<object>(RealTimeData);
private void Loaded() private void Loaded()
{ {
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
} }
private void UnLoaded()
{
Mseed2asciiApi.MseedDatasCallFun(null);
}
private void AxesYVisible(object isCheck) private void AxesYVisible(object isCheck)
{ {
if (_lChartAll != null) if (_lChartAll != null)
@ -281,14 +357,18 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
if (openFileDialog.ShowDialog() == true) if (openFileDialog.ShowDialog() == true)
{ {
string asciiSavePath = openFileDialog.FileName.Replace("Mseed", "Txt"); string asciiSavePath = openFileDialog.FileName.Replace("Mseed", "Txt");
asciiSavePath = Path.ChangeExtension(asciiSavePath, ".txt"); asciiSavePath = Path.ChangeExtension(asciiSavePath, "txt");
string JsonPath = Path.ChangeExtension(openFileDialog.FileName, "Json"); string JsonPath = Path.ChangeExtension(openFileDialog.FileName, "json");
if(!File.Exists(JsonPath))
{
JsonPath = JsonPath.Replace(".json", "B.json");
}
Stopwatch st = new Stopwatch(); Stopwatch st = new Stopwatch();
st.Start(); st.Start();
//读取.json文件 //读取.json文件
CurrentEventTime = _wavesModel.ReadChartJsonFile(JsonPath); CurrentEventTime = _wavesModel.ReadChartJsonFile(JsonPath);
//读取.mseed文件 //读取.mseed文件
smList = _wavesModel.ReadMseedFile(openFileDialog.FileName, asciiSavePath, IsMultFiles); _wavesModel.ReadMseedFile(openFileDialog.FileName, asciiSavePath, IsMultFiles);
_channelCount = smList.Count * 3; _channelCount = smList.Count * 3;
CurrentTime = smList.First().BeginTime.ToShortDateString(); CurrentTime = smList.First().BeginTime.ToShortDateString();
StationsName = smList.Select(a => new StationAxis{Name= a.Name,IsChecked=true,SelectCommand =new DelegateCommand<object>(StationsNameVisible)}).ToList(); StationsName = smList.Select(a => new StationAxis{Name= a.Name,IsChecked=true,SelectCommand =new DelegateCommand<object>(StationsNameVisible)}).ToList();
@ -461,48 +541,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
_lChartAll.EndUpdate(); _lChartAll.EndUpdate();
} }
} }
private void RealTimeData(object isCheck)
{
//
String str = "N02,N03,N04,N05,N06";//,N07,N08,N09,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27";
var stations= str.Split(',');
smList = _wavesModel.ReadWavesFromJson(stations);
_channelCount = smList.Count * 3;
CurrentTime = smList.First().BeginTime.ToShortDateString();
StationsName = smList.Select(a => new StationAxis { Name = a.Name, IsChecked = true, SelectCommand = new DelegateCommand<object>(StationsNameVisible) }).ToList();
// StartChart();
if (_lChartAll != null)
{
bool isStartRealData = (Convert.ToBoolean(isCheck) == true);
if (smList.Count == 0)
{
return;
}
_lChartAll.BeginUpdate();
if (isStartRealData)
{
StartChart();
//Set real-time monitoring automatic old data destruction
LChartALL.ViewXY.DropOldSeriesData = true;
_pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
dispatcherTimer.Tick -= CompositionTarget_Rendering;
dispatcherTimer.Tick += CompositionTarget_Rendering;
LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.Scrolling;
dispatcherTimer.Start();
}
else
{
dispatcherTimer.Stop();
LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.None;
dispatcherTimer.Tick -= CompositionTarget_Rendering;
}
_lChartAll.EndUpdate();
}
}
#endregion #endregion
private void CreateChart() private void CreateChart()
{ {
@ -701,6 +739,9 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
LChartALL.BeginUpdate(); LChartALL.BeginUpdate();
for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++) for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++)
{ {
double[] thisSeriesData = _data[channelIndex];
_lChartAll.ViewXY.YAxes[channelIndex].SetRange(thisSeriesData.Min() - 1, thisSeriesData.Max() + 1);
LChartALL.ViewXY.SampleDataSeries[channelIndex].AddSamples(_data[channelIndex], true); LChartALL.ViewXY.SampleDataSeries[channelIndex].AddSamples(_data[channelIndex], true);
} }
LChartALL.EndUpdate(); LChartALL.EndUpdate();
@ -750,100 +791,11 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
} }
} }
#region 实时数据 private double[][] _data;
private void CompositionTarget_Rendering(object sender, EventArgs e)
{
RenderNextFrame();
}
private void RenderNextFrame()
{
if (_lChartAll == null)
{
return;
}
_dispatcher.Invoke(() =>
{
FeedData(/*chartTitleText*/);
});
}
int _iRound = 0;
double _pointsAppended = 0;
double[][] _data;
int PreGenerateDataForRoundCount = 6;
private void FeedData(/*string chartTitleText*/)
{
if (_lChartAll != null)
{
_lChartAll.BeginUpdate();
//Append data to series
System.Threading.Tasks.Parallel.For(0, _channelCount, (seriesIndex) =>
{
double[] thisSeriesData = _data[seriesIndex];
double[] dataToAppendNow = new double[_samplingFrequency];
Array.Copy(thisSeriesData, (_iRound % PreGenerateDataForRoundCount) * _samplingFrequency, dataToAppendNow, 0, _samplingFrequency);
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(dataToAppendNow, false);
System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1},time:{2}", seriesIndex,
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount, DateTime.Now);
});
_pointsAppended += 1;
//Set X axis real-time scrolling position
double lastX = _pointsAppended;
_lChartAll.ViewXY.XAxes[0].ScrollPosition = lastX;
//Update sweep bands
if (_lChartAll.ViewXY.XAxes[0].ScrollMode == XAxisScrollMode.Sweeping)
{
//Dark band of old page fading away
double pageLen = _lChartAll.ViewXY.XAxes[0].Maximum - _lChartAll.ViewXY.XAxes[0].Minimum;
double sweepGapWidth = pageLen / 20.0;
_lChartAll.ViewXY.Bands[0].SetValues(lastX - pageLen, lastX - pageLen + sweepGapWidth);
if (_lChartAll.ViewXY.Bands[0].Visible == false)
{
_lChartAll.ViewXY.Bands[0].Visible = true;
}
//Bright new page band
_lChartAll.ViewXY.Bands[1].SetValues(lastX - sweepGapWidth / 6, lastX);
if (_lChartAll.ViewXY.Bands[1].Visible == false)
{
_lChartAll.ViewXY.Bands[1].Visible = true;
}
}
else
{
//Hide sweeping bands if not in sweeping mode
//if (_lChartAll.ViewXY.Bands[0].Visible == true)
//{
// _lChartAll.ViewXY.Bands[0].Visible = false;
//}
//if (_lChartAll.ViewXY.Bands[1].Visible == true)
//{
// _lChartAll.ViewXY.Bands[1].Visible = false;
//}
}
_lChartAll.EndUpdate();
_iRound++;
}
}
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
var str= navigationContext.Parameters.GetValue<string>("model");
if(str == "实时波形")
{
IsRealtimeData = true;
}
else
{
IsRealtimeData = false;
}
} }
public bool IsNavigationTarget(NavigationContext navigationContext) public bool IsNavigationTarget(NavigationContext navigationContext)
@ -855,7 +807,5 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{ {
} }
#endregion
} }
} }

@ -77,7 +77,6 @@
<TextBox Text="{Binding XaisInterval}" Width="60" VerticalAlignment="Center"/> <TextBox Text="{Binding XaisInterval}" Width="60" VerticalAlignment="Center"/>
<Button Command="{Binding IntervalSureCommand}" Background="#FF66B1FF" HorizontalAlignment="Right">确认</Button> <Button Command="{Binding IntervalSureCommand}" Background="#FF66B1FF" HorizontalAlignment="Right">确认</Button>
<CheckBox Command="{Binding AxesYVisibleCommand}" Visibility="Collapsed" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="Y轴显示" VerticalContentAlignment="Center" IsChecked="True" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold" /> <CheckBox Command="{Binding AxesYVisibleCommand}" Visibility="Collapsed" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Content="Y轴显示" VerticalContentAlignment="Center" IsChecked="True" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold" />
<CheckBox Command="{Binding RealTimeDataCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Visibility="Collapsed" Content="实时" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" FontWeight="Bold" DockPanel.Dock="Right"></CheckBox>
<TextBox Text="{Binding IntervalTime}" Visibility="Collapsed" Width="60" VerticalAlignment="Center"></TextBox> <TextBox Text="{Binding IntervalTime}" Visibility="Collapsed" Width="60" VerticalAlignment="Center"></TextBox>
<!--<TextBox Text="{Binding IntervalTime}" Width="60" VerticalAlignment="Center"></TextBox>--> <!--<TextBox Text="{Binding IntervalTime}" Width="60" VerticalAlignment="Center"></TextBox>-->
</StackPanel> </StackPanel>

@ -20,6 +20,7 @@
"proServer": { "proServer": {
"ProName": "server", "ProName": "server",
"ProTitle": "服务", "ProTitle": "服务",
"IsEnable": true,
"ProPath": "serverprogram\\server\\", "ProPath": "serverprogram\\server\\",
"ProParams": "service.conf", "ProParams": "service.conf",
"JsonPath": null, "JsonPath": null,
@ -30,6 +31,7 @@
"proRecv": { "proRecv": {
"ProName": "gw.recvftp", "ProName": "gw.recvftp",
"ProTitle": "数据接收", "ProTitle": "数据接收",
"IsEnable": true,
"ProPath": "serverprogram\\recvftp\\", "ProPath": "serverprogram\\recvftp\\",
"ProParams": "-cfg gw.recvftp.json >outRecv.txt", "ProParams": "-cfg gw.recvftp.json >outRecv.txt",
"JsonPath": "gw.recvftp.json", "JsonPath": "gw.recvftp.json",
@ -40,6 +42,7 @@
"proApms": { "proApms": {
"ProName": "gw.apms", "ProName": "gw.apms",
"ProTitle": "实时处理", "ProTitle": "实时处理",
"IsEnable": true,
"ProPath": "serverprogram\\apms\\", "ProPath": "serverprogram\\apms\\",
"ProParams": "-cfg apms.json >outApms.txt", "ProParams": "-cfg apms.json >outApms.txt",
"JsonPath": "apms.json", "JsonPath": "apms.json",
@ -50,6 +53,7 @@
"proTools": { "proTools": {
"ProName": "gw.tools", "ProName": "gw.tools",
"ProTitle": "后处理", "ProTitle": "后处理",
"IsEnable": true,
"ProPath": "serverprogram\\tools\\", "ProPath": "serverprogram\\tools\\",
"ProParams": "-cfg apms.json -savepath I:\\yuwuN3102mseed -delay 600", "ProParams": "-cfg apms.json -savepath I:\\yuwuN3102mseed -delay 600",
"JsonPath": "apms.json", "JsonPath": "apms.json",
@ -60,6 +64,7 @@
"dataProTools": { "dataProTools": {
"ProName": "gw.tools", "ProName": "gw.tools",
"ProTitle": "数据处理", "ProTitle": "数据处理",
"IsEnable": true,
"ProPath": "serverprogram\\dataProTools\\", "ProPath": "serverprogram\\dataProTools\\",
"ProParams": "-cfg apms.json -wave I:\\yuwuN3102mseed", "ProParams": "-cfg apms.json -wave I:\\yuwuN3102mseed",
"JsonPath": "apms.json", "JsonPath": "apms.json",

@ -0,0 +1,19 @@
net,sta,x2000,y2000,z2000,sens,begin,stop
HA,N02,38400255.1,4031654.41,966.32,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N06,38400688.38,4030813.33,1041,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N19,38400791.26,4030547.77,1025,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N09,38400228.78,4031036.79,1033,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N13,38400469.12,4031359.62,1032,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N14,38400256.41,4031432.14,989.87,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N15,38400777.97,4031411.1,1057,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N16,38401099.84,4031276.27,1048,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N18,38400933.3,4030680.32,1023,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N20,38400483.27,4031231.37,1062,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N22,38400271.47,4031233.68,1035,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N24,38400544.63,4031589.46,1017,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N11,38400746.23,4031159.5,1049,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N26,38400515.17,4030482.78,1030,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N05,38400453.68,4030747.89,1039,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N27,38400993.22,4030786,1023,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N23,38400833.88,4031587.71,1024,3.20E+09,2023-11-17T00:00:00.000,2024-12-21T23:59:59.000
HA,N10,38401120,4031613,1016,3.20E+09,2023-11-17T00:00:00.001,2024-12-21T23:59:59.000
1 net sta x2000 y2000 z2000 sens begin stop
2 HA N02 38400255.1 4031654.41 966.32 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
3 HA N06 38400688.38 4030813.33 1041 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
4 HA N19 38400791.26 4030547.77 1025 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
5 HA N09 38400228.78 4031036.79 1033 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
6 HA N13 38400469.12 4031359.62 1032 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
7 HA N14 38400256.41 4031432.14 989.87 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
8 HA N15 38400777.97 4031411.1 1057 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
9 HA N16 38401099.84 4031276.27 1048 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
10 HA N18 38400933.3 4030680.32 1023 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
11 HA N20 38400483.27 4031231.37 1062 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
12 HA N22 38400271.47 4031233.68 1035 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
13 HA N24 38400544.63 4031589.46 1017 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
14 HA N11 38400746.23 4031159.5 1049 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
15 HA N26 38400515.17 4030482.78 1030 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
16 HA N05 38400453.68 4030747.89 1039 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
17 HA N27 38400993.22 4030786 1023 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
18 HA N23 38400833.88 4031587.71 1024 3.20E+09 2023-11-17T00:00:00.000 2024-12-21T23:59:59.000
19 HA N10 38401120 4031613 1016 3.20E+09 2023-11-17T00:00:00.001 2024-12-21T23:59:59.000

@ -33,14 +33,6 @@
"Main.content": "通知事件", "Main.content": "通知事件",
"Main.push_key": "Y3qYFBQPMbfTt6m", "Main.push_key": "Y3qYFBQPMbfTt6m",
"RServer.host": "127.0.0.1", "RServer.host": "127.0.0.1",
"channels": [
{
"network": "HA",
"location": "06",
"channels": "SHZ:SHN:SHE",
"station": "N02,N03,N04,N05,N06,N07,N08,N09,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27"
}
],
"Locate.log_level": "DEBUG", "Locate.log_level": "DEBUG",
"Locate.work_path": ".", "Locate.work_path": ".",
"Locate.xmin": 38396517, "Locate.xmin": 38396517,
@ -58,44 +50,7 @@
"network": "HA", "network": "HA",
"location": "06", "location": "06",
"channels": "SHZ:SHN:SHE", "channels": "SHZ:SHN:SHE",
"stations": [ "stations": null
{
"Name": "N02",
"IsEnable": true
},
{
"Name": "N03",
"IsEnable": true
},
{
"Name": "N04",
"IsEnable": true
},
{
"Name": "N05",
"IsEnable": true
},
{
"Name": "N06",
"IsEnable": false
},
{
"Name": "N07",
"IsEnable": false
},
{
"Name": "N08",
"IsEnable": true
},
{
"Name": "N09",
"IsEnable": true
},
{
"Name": "N10",
"IsEnable": true
}
]
} }
} }
Loading…
Cancel
Save