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

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

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

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

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

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

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