diff --git a/Correlator.sln b/Correlator.sln index ea97844..02122b1 100644 --- a/Correlator.sln +++ b/Correlator.sln @@ -5,6 +5,8 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Correlator", "Correlator\Correlator.csproj", "{BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}" EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "相关仪", "..\..\..\..\Setup Project\相关仪\相关仪.vdproj", "{6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|Any CPU.Build.0 = Release|Any CPU {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|x64.ActiveCfg = Release|x64 {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|x64.Build.0 = Release|x64 + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Debug|Any CPU.ActiveCfg = Debug + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Debug|x64.ActiveCfg = Debug + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Release|Any CPU.ActiveCfg = Release + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Release|x64.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Correlator.sln b/Correlator.sln index ea97844..02122b1 100644 --- a/Correlator.sln +++ b/Correlator.sln @@ -5,6 +5,8 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Correlator", "Correlator\Correlator.csproj", "{BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}" EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "相关仪", "..\..\..\..\Setup Project\相关仪\相关仪.vdproj", "{6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|Any CPU.Build.0 = Release|Any CPU {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|x64.ActiveCfg = Release|x64 {BD4834CC-8FE1-47B4-BF30-982CD23CBC7F}.Release|x64.Build.0 = Release|x64 + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Debug|Any CPU.ActiveCfg = Debug + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Debug|x64.ActiveCfg = Debug + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Release|Any CPU.ActiveCfg = Release + {6B97EEFC-3704-4C51-9B89-A5C0C6C2C2ED}.Release|x64.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Correlator/ViewModel/HomePageViewModel.cs b/Correlator/ViewModel/HomePageViewModel.cs index fd5abc7..da360cf 100644 --- a/Correlator/ViewModel/HomePageViewModel.cs +++ b/Correlator/ViewModel/HomePageViewModel.cs @@ -431,8 +431,14 @@ #endregion + //计算时间 + private int _runningSeconds; + //运行时间Timer - private DispatcherTimer _runningTimer; + private readonly DispatcherTimer _runningTimer = new DispatcherTimer + { + Interval = TimeSpan.FromSeconds(1) + }; //自动截屏倒计时 private readonly DispatcherTimer _snapShotTimer = new DispatcherTimer @@ -603,6 +609,22 @@ Messenger.Default.Send("", MessengerToken.AddMenu); }); + //计算时间Timer + _runningTimer.Tick += delegate + { + _runningSeconds++; + PassTime = _runningSeconds.ToString(); + if (_runningSeconds >= 90) + { + _runningTimer.Stop(); + var result = MessageBox.Show("接收不到数据,请重启软件", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); + if (result == MessageBoxResult.OK) + { + Process.GetCurrentProcess().Kill(); + } + } + }; + //自动截屏Timer _snapShotTimer.Tick += delegate { @@ -714,7 +736,7 @@ new Task(CollectData).Start(); //记录计算时间 - ShowPassTime(); + _runningTimer.Start(); }); //计算测试数据 @@ -781,6 +803,8 @@ SoundSpeed = "0"; InterfereValue = "未设置"; PassTime = "0"; + _runningSeconds = 0; + _runningTimer.Stop(); } /// @@ -888,31 +912,6 @@ return true; } - //TODO 复位之后之前的timer还在运行中,需要调整 - private void ShowPassTime() - { - var seconds = 0; - _runningTimer = new DispatcherTimer - { - Interval = TimeSpan.FromSeconds(1) - }; - _runningTimer.Tick += delegate - { - seconds++; - PassTime = seconds.ToString(); - if (seconds >= 90) - { - _runningTimer.Stop(); - var result = MessageBox.Show("接收不到数据,请重启软件", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); - if (result == MessageBoxResult.OK) - { - Process.GetCurrentProcess().Kill(); - } - } - }; - _runningTimer.Start(); - } - private static double[] GetArray(MWNumericArray inputMw) { var num = inputMw.NumberOfElements;