public SampleMaster3000ViewModel(string niDeviceAddresss) { try { _niInterface = new NiInterface(niDeviceAddresss, Properties.Settings.Default.SampleFrequency, 10); _niInterface.CompletedSamples += _niInterface_CompletedSamples; _readValueTimer = new DispatcherTimer(DispatcherPriority.Normal, Application.Current.Dispatcher) { Interval = TimeSpan.FromMilliseconds(100) }; _readValueTimer.Tick += _readValueTimer_Tick; _readValueTimer.Start(); DeviceStarted = Visibility.Visible; _syncCtx = SynchronizationContext.Current; Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\KCF Technologies\\Gauss Master"); SampleFrequency = Properties.Settings.Default.SampleFrequency.ToString(); } catch (Exception ex) { MainWindow.ShowError(ex.Message, true); } }
public GaussMeter3000ViewModel(string comPort, string niDeviceAddresss) { try { _sc = new GaussSerialComms(comPort); _sc.StringReceived += _sc_StringReceived; _sc.DeviceStarted += _sc_DeviceStarted; _sc.ChangedChannel += _sc_ChangedChannel; _niInterface = new NiInterface(niDeviceAddresss, Convert.ToInt32(Properties.Settings.Default.SampleFrequency), 2); _niInterface.CompletedSamples += _niInterface_CompletedSamples; _currentChannel = GaussMeterChannelEnum.Unknown; DeviceStarted = Visibility.Hidden; ResetDevice = Visibility.Visible; _syncCtx = SynchronizationContext.Current; Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\KCF Technologies\\Gauss Master"); SampleFrequency = Properties.Settings.Default.SampleFrequency; } catch (Exception ex) { MainWindow.ShowError(ex.Message, true); } }