public MemoryViewModel(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; ToggleConnectionCommand = new DelegateCommand(ToggleConnection, CanToggleConnection); SetInputCommand = new DelegateCommand(SetInput, CanSetInput); PeekCommand = new DelegateCommand(Peek, CanPeek).ObservesProperty(() => GeckoConnected).ObservesProperty(() => InputCSV); PokeCommand = new DelegateCommand(Poke, CanPoke).ObservesProperty(() => GeckoConnected).ObservesProperty(() => InputCSV); ToggleAutoPeekCommand = new DelegateCommand(ToggleAutoPeek, CanToggleAutoPeek).ObservesProperty(() => GeckoConnected).ObservesProperty(() => InputCSV); if (InputCSV != "") { MemoryAddresses = MemoryAddressService.CollectFromCSV(InputCSV); } }
private void SetInput() { // create OpenFileDialog. OpenFileDialog dlg = new OpenFileDialog(); // set filter for file extension and default file extension to show only csv files. dlg.DefaultExt = ".csv"; dlg.Filter = "CSV Files (*.csv)|*.csv"; // display OpenFileDialog. Nullable <bool> result = dlg.ShowDialog(); // check if user selected a file. if (result == true) { // update components. InputCSV = dlg.FileName; //Title = InputCSV; MemoryAddresses = MemoryAddressService.CollectFromCSV(InputCSV); //dbgMemoryAddresses.ItemsSource = memoryAddresses; //txtStatus.Text = inputCSV + " opened as input."; } }