public SettingsViewModel(Action closeAction, IDialogService dialogService)
 {
     this.closeAction = closeAction;
     this.dialogService = dialogService;
     SetDeviceSettingsCommand = new RelayCommand(_ => SetNewDevSettings());
     SetDefaultDeviceSettingsCommand = new RelayCommand(_ => SetDefaultSettings());
     SetSaveResultPathCommand = new RelayCommand(_ => SelectNewSaveResultPath());
     IncreasedInputTypes = new[] { "±3.0", "±1.0", "±0.3" };
     IncreasedInputType = increasedInputType;
 }
예제 #2
0
        public DataViewModel(WindowsFormsHost windowsFormsHostGrapData, IDialogService dialogService)
        {
            _deviceManager = UnityConfig.GetConfiguredContainer().Resolve<IDeviceManager>();
            ViewDataCommand = new RelayCommand(_ => ViewData());
            WriteDataCommand = new RelayCommand(_ => WriteData());
            StopCommand = new RelayCommand(_ => Stop());
            ChannelEnabledCommand = new RelayCommand(_ => ChannelEnabled());
            Capacity = Settings.Default.BufferDisplayLength;
            for (int i = 0; i < NumberOfCahnnels; i++)
            {
                datas.Add(new RollingPointPairList(Capacity));
            }
            this.dataService = null;
            //
            this.windowsFormsHostGrapData = windowsFormsHostGrapData;
            this.dialogService = dialogService;
            this.zedGraphControlData = (ZedGraphControl)this.windowsFormsHostGrapData.Child;
            Capacity = Convert.ToInt16(windowsFormsHostGrapData.ActualWidth)-1;
            PrepareGraph();

            var e2020 = UnityConfig.GetConfiguredContainer().Resolve<IE2010>();
            this.dataService = null;

            e2020.OnData += UpdateData;
            StartDate = DateTime.UtcNow;

            if (!_deviceManager.mE2010.OpenLDevice())
            {
                this.windowsFormsHostGrapData.Visibility = Visibility.Hidden;
            }
            else
            {
                this.windowsFormsHostGrapData.Visibility = Visibility.Visible;
            }

            LastUpdateTime = DateTime.MinValue;
            Settings.Default.PropertyChanged += DefaultOnPropertyChanged;
            Settings.Default.SettingsSaving += DefaultOnSettingsSaving;
            this.windowsFormsHostGrapData.InvalidateVisual();
        }