public MainWindowViewModel() { Messenger.Default.Register <HeaderEnable>(this, (o) => IsHeaderEnabled = o.IsEnabled); _log = Log.GetInstance(); _log.Write($"Отчет {DateTime.Now.ToShortDateString()}\n", false); new FTDI().GetNumberOfDevices(ref _numDevices); #if DEBUG Console.WriteLine($"NUMBER OF DEVICES ---- {_numDevices}"); #endif if (_numDevices == 2) { _devices = new FtdiDevice[_numDevices]; for (uint i = 0; i < _devices.Length; i++) { _devices[i] = new FtdiDevice(i); _devices[i].Open(); } } MainMenuItems = new ObservableCollection <MainMenuItem>(GenerateMainMenuItems()); DefaultMenuIndex = Properties.Settings.Default.DefaultMenuIndex; }
public MainWindowViewModel(TestViewModel testViewModel, SettingsViewModel settingsViewModel, PassingInformationViewModel passingInformationViewModel, OutputInformationViewModel outputInformationViewModel, OtherTestsViewModel otherTestsViewModel) { Messenger.Default.Register <CheckModeParameters>(this, (o) => { _modeTitle = o.CheckModeTitle; _modeNumber = o.CheckMode; }); Messenger.Default.Register <NavBarEnabled>(this, (o) => NavBarEnabled = o.IsEnabled); _testViewModel = testViewModel; _settingsViewModel = settingsViewModel; _passingInformationViewModel = passingInformationViewModel; _outputInformationViewModel = outputInformationViewModel; _otherTestsViewModel = otherTestsViewModel; _log.Content.AppendLine($"Отчет {DateTime.Now}"); new FTDI().GetNumberOfDevices(ref _numDevices); #if DEBUG Console.WriteLine($"NUMBER OF DEVICES ---- {_numDevices}"); #endif if (_numDevices > 0) { _devices = new FtdiDevice[_numDevices]; for (uint i = 0; i < _devices.Length; i++) { _devices[i] = new FtdiDevice(i); _devices[i].Open(); } Messenger.Default.Send(_devices); } var _settings = new SettingsModel { Address1 = Properties.Settings.Default.Address1, Address2 = Properties.Settings.Default.Address2, Address3 = Properties.Settings.Default.Address3, Frequency = Properties.Settings.Default.Frequency, BitsCount = Properties.Settings.Default.BitsCount, IsInfiniteFT = Properties.Settings.Default.IsInfiniteFT, WordLength = Properties.Settings.Default.WordLength, }; Messenger.Default.Send(_settings); }