diff --git a/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs index f2e3228..176fc43 100644 --- a/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs +++ b/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs @@ -5,6 +5,7 @@ using Prism.Events; using Prism.Mvvm; using Prism.Regions; using Prism.Services.Dialogs; +using StartServerWPF.Models; using StartServerWPF.Modules.Main.Models; using System; using System.Collections.Generic; @@ -20,13 +21,14 @@ namespace StartServerWPF.Modules.Main.ViewModels public class LogManagementViewModel : BindableBase { IEventAggregator _ea; + private readonly SystemConfigModel _systemConfig; private readonly IDialogService _dialogService; private readonly MainViewModel _mainViewModel; - public LogManagementViewModel( - IEventAggregator ea, IDialogService dialogService, MainViewModel mainViewModel) + public LogManagementViewModel(SystemConfigModel systemConfig, IEventAggregator ea, IDialogService dialogService, MainViewModel mainViewModel) { + this._systemConfig = systemConfig; this._dialogService = dialogService; this._mainViewModel = mainViewModel; } @@ -59,7 +61,7 @@ namespace StartServerWPF.Modules.Main.ViewModels { SelectIndexLogType = "全部"; DataList = new List(); - string fileName = _mainViewModel._systemConfig.vpnInfo.SystemLogPath+ "SerLog_" + EndTime.ToString("yyyyMMdd") + ".txt"; + string fileName = _systemConfig.vpnInfo.SystemLogPath+ "SerLog_" + EndTime.ToString("yyyyMMdd") + ".txt"; if (!File.Exists(fileName)) return; Task.Run(() => diff --git a/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs index d4f29e8..ae20ad7 100644 --- a/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs +++ b/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs @@ -493,7 +493,7 @@ namespace StartServerWPF.Modules.Main.ViewModels public VPNHelper vpn; public bool vpnStatus = false; - public SystemConfigModel _systemConfig; + private SystemConfigModel _systemConfig; private DispatcherTimer timer1= new DispatcherTimer(); private readonly IDialogService _dialogService; @@ -537,8 +537,11 @@ namespace StartServerWPF.Modules.Main.ViewModels process.StartInfo.CreateNoWindow = true; //* Set your output and error (asynchronous) handlers - process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler); - process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler); + if (!proInfo.ProName.Contains("gw.apms")) + { + process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler); + process.ErrorDataReceived += new DataReceivedEventHandler(OutputHandler); + } //* Start process and handlers bool res= process.Start(); process.BeginOutputReadLine(); @@ -559,19 +562,20 @@ namespace StartServerWPF.Modules.Main.ViewModels if (outLine.Data.Contains("ProcessSlice:")) { var pro = sendingProcess as Process; - if (pro != null) + if (pro != null&& pro.MainModule.ModuleName.Contains(_systemConfig.proTools.ProName)) { - Application.Current.Dispatcher.BeginInvoke(() => + Application.Current.Dispatcher.InvokeAsync(() => { - if (pro.MainModule.ModuleName.Contains(_systemConfig.proApms.ProName)) - { - AddItems(ApmsProcessSliceSource, new ProcessingInformationModel { ProcessMes = outLine.Data, MonitorTime = DateTime.Now.ToString() }); - } - else if (pro.MainModule.ModuleName.Contains(_systemConfig.proTools.ProName)) + //if (pro.MainModule.ModuleName.Contains(_systemConfig.proApms.ProName)) + //{ + // AddItems(ApmsProcessSliceSource, new ProcessingInformationModel { ProcessMes = outLine.Data, MonitorTime = DateTime.Now.ToString() }); + //} + //else + if (pro.MainModule.ModuleName.Contains(_systemConfig.proTools.ProName)) { AddItems(ToolsProcessSliceSource, new ProcessingInformationModel { ProcessMes = outLine.Data, MonitorTime = DateTime.Now.ToString() }); } - }); + }, DispatcherPriority.ApplicationIdle); } } else if (outLine.Data.Contains("ML ")) diff --git a/StartServerWPF.Modules.Main/ViewModels/SetParamViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/SetParamViewModel.cs index 289a63b..f26b53f 100644 --- a/StartServerWPF.Modules.Main/ViewModels/SetParamViewModel.cs +++ b/StartServerWPF.Modules.Main/ViewModels/SetParamViewModel.cs @@ -21,7 +21,7 @@ namespace StartServerWPF.Modules.Main.ViewModels { public SetParamViewModel(MainViewModel mainViewModel,SystemConfigModel configModel) { - _systemConfig = mainViewModel._systemConfig; + _systemConfig = configModel; MainModel = _systemConfig.vpnInfo; MoniTime = mainViewModel.MoniStartTime; @@ -179,17 +179,18 @@ namespace StartServerWPF.Modules.Main.ViewModels fbd.ShowNewFolderButton = true; if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { + string path= fbd.SelectedPath.Replace("\\", "/"); if (para == "systemSavepath") { - MainModel.DataSavePath = fbd.SelectedPath; + MainModel.DataSavePath = path; } else if(para == "apmssavepath") { - AModel.savepath = fbd.SelectedPath; + AModel.savepath = path; } else if(para == "toolssavepath") { - ToolsModel.savepath = fbd.SelectedPath; + ToolsModel.savepath = path; } } @@ -242,8 +243,8 @@ namespace StartServerWPF.Modules.Main.ViewModels int index= _systemConfig.proTools.ProParams.IndexOf("-savepath"); // int index = _systemConfig.proTools.ProParams.IndexOf("-delay"); - string st= _systemConfig.proTools.ProParams.Substring(0, index); - _systemConfig.proTools.ProParams = $"{_systemConfig.proTools.ProParams.Substring(0, index)}{ToolsModel.savepath} -delay {DelayTime * 60}"; + string str= _systemConfig.proTools.ProParams.Substring(0, index)+ "-savepath"; + _systemConfig.proTools.ProParams = $"{str} {ToolsModel.savepath} -delay {DelayTime * 60}"; JsonParser.WriteSystemConfigFile(JsonParser.systemConfigPath, _systemConfig); diff --git a/StartServerWPF.Modules.Main/Views/SetParamView.xaml b/StartServerWPF.Modules.Main/Views/SetParamView.xaml index 76ddb73..a7499a7 100644 --- a/StartServerWPF.Modules.Main/Views/SetParamView.xaml +++ b/StartServerWPF.Modules.Main/Views/SetParamView.xaml @@ -51,12 +51,12 @@