1修改vpn断线重连问题;

2 更新mseedc.dll库
master
mzhifa 8 months ago
parent 7dda496345
commit 5f8ffb2a32

@ -58,7 +58,7 @@ namespace StartServerWPF.Modules.Main
// NOTE: The entry MUST be in the phone book before the connection can be dialed. // NOTE: The entry MUST be in the phone book before the connection can be dialed.
// Begin dialing the connection; this will raise events from the dialer instance. // Begin dialing the connection; this will raise events from the dialer instance.
handle = dialer.DialAsync(); handle = dialer.Dial();
return "VPN连接成功"; return "VPN连接成功";
// Enable the disconnect button for use later. // Enable the disconnect button for use later.
//this.DisconnectButton.Enabled = true; //this.DisconnectButton.Enabled = true;

@ -294,10 +294,10 @@ namespace StartServerWPF.Modules.Main.ViewModels
return; return;
} }
list.Insert(0,t1); list.Insert(0,t1);
if (list.Count > 30) if (list.Count >= 50)
{ {
T item = list[0]; T item = list[0];
list.RemoveAt(0); list.Remove(list.Last());
} }
} }
#endregion #endregion
@ -334,9 +334,13 @@ namespace StartServerWPF.Modules.Main.ViewModels
} }
private void ConnectVPN() private void ConnectVPN()
{ {
Debug.WriteLine("start connect vpn enter >.....");
vpn.CreateOrUpdateVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnIP); vpn.CreateOrUpdateVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnIP);
Debug.WriteLine("connect ConnectVPN 11.........");
vpn.ConnectVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnUserName, _systemConfig.vpnInfo.VpnPsw); vpn.ConnectVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnUserName, _systemConfig.vpnInfo.VpnPsw);
Thread.Sleep(1000); Debug.WriteLine("connect vpn 12.........");
// Thread.Sleep(1500);
var log = new LogMessageModel var log = new LogMessageModel
{ {
LogType="网络", LogType="网络",
@ -345,7 +349,9 @@ namespace StartServerWPF.Modules.Main.ViewModels
OriginTime = DateTime.Now, OriginTime = DateTime.Now,
}; };
LogHelper.WriteSerLog(_systemConfig.vpnInfo.SystemLogPath , log.ToString()); LogHelper.WriteSerLog(_systemConfig.vpnInfo.SystemLogPath , log.ToString());
Debug.WriteLine(" SetControlstatus enter >.....");
SetControlstatus(); SetControlstatus();
Debug.WriteLine("connect vpn exit <.....");
} }
private void DisConnectVPN() private void DisConnectVPN()
@ -365,6 +371,10 @@ namespace StartServerWPF.Modules.Main.ViewModels
}; };
LogHelper.WriteSerLog(_systemConfig.vpnInfo.SystemLogPath , log.ToString()); LogHelper.WriteSerLog(_systemConfig.vpnInfo.SystemLogPath , log.ToString());
} }
else
{
VPNIsConnect = true;
}
} }
private void GetVPNStatus() private void GetVPNStatus()
@ -792,10 +802,12 @@ namespace StartServerWPF.Modules.Main.ViewModels
} }
} }
RunTime = DateDiff(DateTime.Now, StartTime); RunTime = DateDiff(DateTime.Now, StartTime);
vpnStatus = vpn.CheckVpnStatus(_systemConfig.vpnInfo.VpnName); //vpnStatus = vpn.CheckVpnStatus(_systemConfig.vpnInfo.VpnName);
SetControlstatus();
if (!vpnStatus) if (!vpnStatus)
{ {
vpn.ConnectVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnUserName, _systemConfig.vpnInfo.VpnPsw); this.ConnectVPN();
// vpn.ConnectVPN(_systemConfig.vpnInfo.VpnName, _systemConfig.vpnInfo.VpnUserName, _systemConfig.vpnInfo.VpnPsw);
Thread.Sleep(1000); Thread.Sleep(1000);
var log = new LogMessageModel var log = new LogMessageModel
{ {
@ -855,7 +867,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
} }
else else
{ {
VPNIsConnect = false; // VPNIsConnect = false;
VPNStatusForeColor = "#FFFF0000"; VPNStatusForeColor = "#FFFF0000";
VPNStatus = "VPN断开连接"; VPNStatus = "VPN断开连接";
} }

@ -43,6 +43,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
loopCallback = new MseedReal2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent); loopCallback = new MseedReal2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
MseedReal2asciiApi.MseedDatasCallFun(loopCallback); MseedReal2asciiApi.MseedDatasCallFun(loopCallback);
GC.KeepAlive(loopCallback); GC.KeepAlive(loopCallback);
this._dialogService = dialogService;
workarea = workareaModel; workarea = workareaModel;
_wavesModel = new WavesModel(); _wavesModel = new WavesModel();
CreateChart(); CreateChart();
@ -62,7 +63,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
StartChart(); StartChart();
Sure(); Sure();
} }
this._dialogService = dialogService;
} }
#region 字段 #region 字段
@ -278,7 +278,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
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); public DelegateCommand<object> RealTimeDataCommand => new DelegateCommand<object>(RealTimeData);
public DelegateCommand ReSetCommand => new DelegateCommand(Reset);
private void Loaded() private void Loaded()
{ {
@ -289,6 +290,27 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
} }
private void Reset()
{
_wavesModel = new WavesModel();
CreateChart();
if (workarea.StationConfig.Stations != null)
{
List<string> devicesNums = new List<string>();
foreach (var item in workarea.StationConfig.Stations)
{
if (item.IsEnable)
{
devicesNums.Add(item.Name);
}
}
devicesNums.Sort();
smList = _wavesModel.ReadWavesFromJson(devicesNums.ToArray());
subNameList = new Dictionary<string, ASCiiData>();
StartChart();
Sure();
}
}
private void Sure() private void Sure()
{ {
if (_lChartAll != null) if (_lChartAll != null)
@ -569,8 +591,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
string mes = System.Text.Encoding.Default.GetString(message); string mes = System.Text.Encoding.Default.GetString(message);
byte[] data = message.Skip(15).ToArray(); byte[] data = message.Skip(15).ToArray();
string mes1 = System.Text.Encoding.Default.GetString(data); string mes1 = System.Text.Encoding.Default.GetString(data);
// if (message.Length == 7 && System.Text.Encoding.Default.GetString(message) == "shutoff") // if (message.Length == 7 && System.Text.Encoding.Default.GetString(message) == "shutoff")
if(!IsEnableStopRealtime) if (!IsEnableStopRealtime)
{ {
iRedisSubscription.UnSubscribeFromChannels(subNameList.Keys.ToArray()); iRedisSubscription.UnSubscribeFromChannels(subNameList.Keys.ToArray());
} }
@ -587,9 +609,14 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
time.Elapsed -= CompositionTarget_Rendering; time.Elapsed -= CompositionTarget_Rendering;
LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.None; LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.None;
} }
_lChartAll.EndUpdate(); _lChartAll.EndUpdate();
} }
else
{
IsEnableStartRealtime = true;
IsEnableStopRealtime = false;
}
} }
private void Mseed2AsciiEvent(AsciiDataStruct asciiData) private void Mseed2AsciiEvent(AsciiDataStruct asciiData)

@ -93,6 +93,11 @@
Command="{Binding RealTimeDataCommand}" CommandParameter="False" Margin="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Center"> Command="{Binding RealTimeDataCommand}" CommandParameter="False" Margin="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Center">
</Button> </Button>
<Button Grid.Column="1" Height="40" Content="重置" Width="90" IsEnabled="{Binding IsEnableStartRealtime}"
Command="{Binding ReSetCommand}" Margin="0,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Center">
</Button>
<TextBlock Text="通道:" VerticalAlignment="Center"/> <TextBlock Text="通道:" VerticalAlignment="Center"/>
<CheckBox Content="Z" IsChecked="{Binding SHZChannel}" VerticalAlignment="Center" Style="{x:Null}" /> <CheckBox Content="Z" IsChecked="{Binding SHZChannel}" VerticalAlignment="Center" Style="{x:Null}" />
<CheckBox Content="E" IsChecked="{Binding SHEChannel}" VerticalAlignment="Center" Style="{x:Null}" Margin="5,0,5,0"/> <CheckBox Content="E" IsChecked="{Binding SHEChannel}" VerticalAlignment="Center" Style="{x:Null}" Margin="5,0,5,0"/>

@ -30,6 +30,9 @@
<None Update="mseed2ascii.exe"> <None Update="mseed2ascii.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="mseedC.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Properties\Settings.settings"> <None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

Binary file not shown.
Loading…
Cancel
Save