1修改vpn断线重连问题;

2 更新mseedc.dll库
master
mzhifa 7 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.
// Begin dialing the connection; this will raise events from the dialer instance.
handle = dialer.DialAsync();
handle = dialer.Dial();
return "VPN连接成功";
// Enable the disconnect button for use later.
//this.DisconnectButton.Enabled = true;

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

@ -43,6 +43,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
loopCallback = new MseedReal2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
MseedReal2asciiApi.MseedDatasCallFun(loopCallback);
GC.KeepAlive(loopCallback);
this._dialogService = dialogService;
workarea = workareaModel;
_wavesModel = new WavesModel();
CreateChart();
@ -62,7 +63,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
StartChart();
Sure();
}
this._dialogService = dialogService;
}
#region 字段
@ -278,6 +278,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
public DelegateCommand<object> OtimeSortCommand => new DelegateCommand<object>(OtimeSort);
public DelegateCommand IntervalSureCommand => new DelegateCommand(IntervalSure);
public DelegateCommand<object> RealTimeDataCommand => new DelegateCommand<object>(RealTimeData);
public DelegateCommand ReSetCommand => new DelegateCommand(Reset);
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()
{
if (_lChartAll != null)
@ -569,8 +591,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
string mes = System.Text.Encoding.Default.GetString(message);
byte[] data = message.Skip(15).ToArray();
string mes1 = System.Text.Encoding.Default.GetString(data);
// if (message.Length == 7 && System.Text.Encoding.Default.GetString(message) == "shutoff")
if(!IsEnableStopRealtime)
// if (message.Length == 7 && System.Text.Encoding.Default.GetString(message) == "shutoff")
if (!IsEnableStopRealtime)
{
iRedisSubscription.UnSubscribeFromChannels(subNameList.Keys.ToArray());
}
@ -590,6 +612,11 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
_lChartAll.EndUpdate();
}
else
{
IsEnableStartRealtime = true;
IsEnableStopRealtime = false;
}
}
private void Mseed2AsciiEvent(AsciiDataStruct asciiData)

@ -93,6 +93,11 @@
Command="{Binding RealTimeDataCommand}" CommandParameter="False" Margin="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Center">
</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"/>
<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"/>

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

Binary file not shown.
Loading…
Cancel
Save