Skip to content

Commit

Permalink
启动监听服务器之前校验是否配置DB项
Browse files Browse the repository at this point in the history
  • Loading branch information
newbienewbie committed Mar 20, 2023
1 parent 1f53eee commit 25a5a5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/S7SvrSim/S7SvrSim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<PyStdLibFolderName>Lib</PyStdLibFolderName>
Expand All @@ -15,5 +16,10 @@
<TargetPath>$(PyStdLibFolderName)\%(RecursiveDir)%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<ItemGroup>
<None Update="favicon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
6 changes: 6 additions & 0 deletions src/S7SvrSim/ViewModels/MainVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using S7Server.Simulator.ViewModels;
using S7SvrSim.ViewModels;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;

namespace S7Svr.Simulator.ViewModels
Expand All @@ -21,6 +22,11 @@ public MainVM(IS7ServerService s7ServerService, ConfigPyEngineVM configPyEngineV
this.CmdStartServer = this.RunningVM.RunningStatus.Select(i => !i)
.ToReactiveCommand()
.WithSubscribe(async i => {
if (this.ConfigVM.DBConfigs.Count == 0)
{
MessageBox.Show("当前未指定DB配置!");
return;
}
this.RunningVM.IpAddress.Value = this.ConfigVM.IpAddress.Value;
this.RunningVM.DBConfigs.Clear();
foreach (var config in this.ConfigVM.DBConfigs)
Expand Down
Binary file added src/S7SvrSim/favicon.ico
Binary file not shown.

0 comments on commit 25a5a5b

Please sign in to comment.