protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //to do: service resolver (/locator ?)
            var cvConfig      = new CVConfiguration();
            var cvEntryConfig = new CVEntryConfiguration();

            cvConfig.Configure(modelBuilder);
            cvEntryConfig.Configure(modelBuilder);

            base.OnModelCreating(modelBuilder);
        }
Exemple #2
0
        public CVTesterViewModel(IKeithley2400ViewModel keithley2400ViewModel,
                                 IWayneKerr4300ViewModel wayneKerr4300ViewModel,
                                 CVTester cvTester)
        {
            _cvScan            = new CVScan();
            _cvtester          = cvTester;
            _cvtester.Closing += CloseProgram;
            Keithley           = keithley2400ViewModel;
            WayneKerr          = wayneKerr4300ViewModel;
            _wayneKerr         = WayneKerr.GetModel();
            _keithley          = Keithley.GetModel();

            _serialPortManagerSelector = new SerialPortManagerSelector(new SerialPortManager(),
                                                                       new SerialPortEmulatorManager());

            _cvConfiguration      = new CVConfiguration();
            _cvScan.Monitor       = MonitorMessageDelegate;
            _monitorStringBuilder = new StringBuilder();
            FrequencyList         = new ObservableCollection <double>();
            _shortCircuitActive   = false;
            _openCircuitActive    = false;
            _devicesDiscovered    = false;
            Executing             = false;
            Emulate = false;

            SaveConfigCommand = new DelegateCommand(ExecuteSaveConfig, CanExecuteSaveConfig)
                                .ObservesProperty <string>(() => ConfigurationFile);

            AddFrequencyCommand = new DelegateCommand(ExecuteAddFrequency, CanExecuteAddFrequency).ObservesProperty(() => NewFrequency);

            DeleteSelectedFrequenciesCommand = new DelegateCommand <ICollection <object> >(ExecuteDeleteSelectedFrequencies, CanExecuteDeleteSelectedFrequencies);

            DiscoveryCommand = new DelegateCommand(ExecuteDiscovery, CanExecuteDiscovery)
                               .ObservesProperty <bool>(() => Emulate)
                               .ObservesProperty <string>(() => KeithleyEmulationFile)
                               .ObservesProperty <string>(() => WayneKerrEmulationFile);

            ShortCircuitTestCommand = new DelegateCommand(ExecuteShortCircuitTest, CanExecuteShortCircuitTest)
                                      .ObservesProperty <bool>(() => Emulate)
                                      .ObservesProperty <bool>(() => Executing)
                                      .ObservesProperty <bool>(() => ShortCircuitActive)
                                      .ObservesProperty <bool>(() => DevicesDiscovered)
                                      .ObservesProperty <string>(() => ResultsFileName);


            OpenCircuitTestCommand = new DelegateCommand(ExecuteOpenCircuitTest, CanExecuteOpenCircuitTest)
                                     .ObservesProperty <bool>(() => Emulate)
                                     .ObservesProperty <bool>(() => Executing)
                                     .ObservesProperty <bool>(() => DevicesDiscovered)
                                     .ObservesProperty <bool>(() => OpenCircuitActive)
                                     .ObservesProperty <string>(() => ResultsFileName);


            CVTestCommand = new DelegateCommand(ExecuteCVTest, CanExecuteCVTest)
                            .ObservesProperty <bool>(() => Emulate)
                            .ObservesProperty <bool>(() => Executing)
                            .ObservesProperty <bool>(() => DevicesDiscovered)
                            .ObservesProperty <string>(() => ResultsFileName);

            StopCVTestCommand = new DelegateCommand(StopCVTest, CanExecuteStopCVTest)
                                .ObservesProperty <bool>(() => Executing);
        }