public AddOperationViewModel(Action discardAction, Action <string> saveAction, IRecordIdGenerator recordIdGenerator, IFileIdGenerator fileIdGenerator, ISafe safe) { Record = new RecordViewModel(CreateEmptyRecord(recordIdGenerator.GetRecordId()), safe, fileIdGenerator); Record.PropertyChanged += (sender, args) => { CanExecuteSaveCommand = !string.IsNullOrWhiteSpace(Record.Name); }; DiscardCommand = new DelegateCommand (() => { safe.ReorganizeFiles(Record.Id); discardAction.Invoke(); } ); SaveCommand = new DelegateCommand(() => { var record = Record.GetRecord(); safe.UpsertRecord(record); safe.ReorganizeFiles(Record.Id); saveAction.Invoke(Record.Id); }, () => CanExecuteSaveCommand); }
private void GoToSearch() { _safe.ReorganizeFiles(_recordId); _closeAction.Invoke(); }