Browse Source

上传代码

luo 5 months ago
parent
commit
c30010a31f

+ 3 - 3
NIFPGA/Fifo.cs

@@ -1,9 +1,11 @@
 using NativeLibraryLoader;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Net.Http.Headers;
 using System.Reflection;
+using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -25,9 +27,7 @@ namespace NIFPGA
         {
             FifoSession= fifosession;
             if (_Session.Session == 0) return;
-            int value = 0;
-            _Session.CheckResult(_Session.GetDelegate<Interop.NiFpgaDll_GetFifoPropertyI32>()(_Session.Session, fifosession, Interop.NiFpga_FifoProperty.NiFpga_FifoProperty_HostBufferType, ref value));
-            _HostBufferType = (NiFpga_HostBufferType)value;
+            _Session.CheckResult(_Session.GetDelegate<Interop.NiFpgaDll_GetFifoPropertyI32>()(_Session.Session, fifosession, Interop.NiFpga_FifoProperty.NiFpga_FifoProperty_HostBufferType, ref Unsafe.As<NiFpga_HostBufferType,int>(ref _HostBufferType)));
             _Session.CheckResult(_Session.GetDelegate<Interop.NiFpgaDll_GetFifoPropertyU32>()(_Session.Session, fifosession, Interop.NiFpga_FifoProperty.NiFpga_FifoProperty_BytesPerElement, ref _BytesPerElement));
         }
         public string Name { get; init; } = string.Empty;

+ 1 - 0
ShakerControl/MainWindow.xaml

@@ -90,6 +90,7 @@
                     Command="{Binding Source={StaticResource DeviceManger}, Path=Data.DisConnectDeviceCommand}"
                     Header="{DynamicResource MenuDisConnect}"
                     IsEnabled="{Binding Source={StaticResource DeviceManger}, Path=Data.CurrentDevice, Converter={StaticResource Object2BooleanConverter}}" />
+
                 <MenuItem
                     Command="{Binding Source={StaticResource VM}, Path=Data.DeviceConfigCommand}"
                     Header="{DynamicResource MenuDeviceConfig}"

+ 2 - 0
ShakerControl/ViewModel/AnalogDataViewModel.cs

@@ -8,6 +8,7 @@ using OxyPlot;
 using System.Collections.ObjectModel;
 using ShakerControl.Tools;
 using System.Runtime.CompilerServices;
+using System.Diagnostics;
 
 namespace ShakerControl.ViewModel
 {
@@ -138,6 +139,7 @@ namespace ShakerControl.ViewModel
         {
             if (data == null) return;
             if (data.GetLength(1) != MainWindowViewModel.Default.ShakerConfig.SampleRate || data.GetLength(0) != MainWindowViewModel.Default.ShakerConfig.ChannelCount) return;
+
             lock (locker)
             {
                 List<List<DataPoint>> points = Enumerable.Range(0, (int)MainWindowViewModel.Default.ShakerConfig.ChannelCount).Select(x => new List<DataPoint>()).ToList();

+ 4 - 0
ShakerControl/ViewModel/MainWindowViewModel.cs

@@ -47,6 +47,10 @@ namespace ShakerControl.ViewModel
                     AnalogDataViewModel.Default.Init();
                 }
             });
+            GetEvent(nameof(TcpEventBus.TcpEventBus.Disconnected)).Subscrip((_, _) =>
+            {
+                SelectedTest = false;
+            });
         }
         static MainWindowViewModel()
         {