1修改日志文件目录自动创建;

2修改时间显示格式
master
mzhifa 1 year ago
parent 736925cc1e
commit 745d663c4a

@ -217,6 +217,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
DialogParameters param = new DialogParameters();
param.Add("type", 1);// 编辑
param.Add("model", sc.vpnInfo);
param.Add("moniTime", MoniStartTime);
_dialogService.ShowDialog(
"SetParamDialog",
@ -683,6 +684,10 @@ namespace StartServerWPF.Modules.Main.ViewModels
public void WriteSerLog(string fn, string logstr)
{
if(!File.Exists(fn))
{
Directory.CreateDirectory(Path.GetDirectoryName(fn));
}
StreamWriter sw = new StreamWriter(fn, true, Encoding.Default);
sw.WriteLine(logstr);
sw.Close();

@ -35,6 +35,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
var _type = parameters.GetValue<int>("type");
// _title = (_type == 0 ? "新增" : "修改") + _title;
MainModel = parameters.GetValue<VpnInfo>("model");
MoniTime= parameters.GetValue<DateTime>("moniTime");
}
private VpnInfo _mainModel = new VpnInfo();
@ -43,6 +44,12 @@ namespace StartServerWPF.Modules.Main.ViewModels
get => _mainModel;
set { SetProperty(ref _mainModel, value); }
}
private DateTime _moniTime ;
public DateTime MoniTime
{
get => _moniTime;
set { SetProperty(ref _moniTime, value); }
}
public DelegateCommand FilePathSaveCommand=> new(()=>
{

@ -68,7 +68,7 @@
</Grid>
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="监控日期:"/>
<TextBox />
<TextBlock Text="{Binding MoniTime,StringFormat=yyyy-MM-dd HH:mm:ss}" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="4" >
<Button Content="确认" Width="100" Height="30" Margin="5,0"

@ -15,7 +15,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Systemlog\" />
</ItemGroup>
</Project>

@ -11,10 +11,10 @@
"VpnName": "YUWU-VPN-BySM",
"VpnIP": "49.232.209.49",
"VpnUserName": "lzvpn",
"VpnPsw": "Lz123456789"
},
"VpnPsw": "Lz123456789",
"SystemLogPath": "Systemlog\\",
"DataSavePath": "G:\\DATA\\",
"DataSavePath": "G:\\DATA\\"
},
"proServer": {
"ProName": "server",
"ProPath": "serverprogram\\server\\",

@ -1,8 +0,0 @@
2023-05-13T21:45:27 程序启动
2023-05-13T22:24:27 程序启动
2023-05-13T22:25:42 程序启动
2023-05-13T22:45:32 程序启动
2023-05-13T22:46:27 程序启动
2023-05-13T22:47:46 程序启动
2023-05-13T22:48:44 程序启动
2023-05-13T23:04:23 程序启动
Loading…
Cancel
Save