public MainViewModel( IDragDropService dragDropService, IBackupFileService backupFileService, IWindowService windowService, IFileOpenSaveService fileOpenSaveService, IDialogService dialogService, ISnackbarService snackbarService, IRedactService redactService, IExcelService excelService) { _dragDropService = dragDropService; _backupFileService = backupFileService; _windowService = windowService; _fileOpenSaveService = fileOpenSaveService; _dialogService = dialogService; _snackbarService = snackbarService; _redactService = redactService; _excelService = excelService; Files.CollectionChanged += FilesCollectionChanged; SetTitle(); // subscriptions... Messenger.Default.Register <DragOverMessage>(this, OnDragOver); Messenger.Default.Register <DragDropMessage>(this, OnDragDrop); Messenger.Default.Register <MainWindowClosingMessage>(this, OnMainWindowClosing); AddDesignTimeItems(); InitCommands(); GetVersionData(); }
public DetailViewModel( IBackupFileService backupFileService, IFileOpenSaveService fileOpenSaveService, IDialogService dialogService, IRedactService redactService) { _backupFileService = backupFileService; _fileOpenSaveService = fileOpenSaveService; _dialogService = dialogService; _redactService = redactService; ListItems = CreateListItems(); ImportBibleNotesCommand = new RelayCommand(ImportBibleNotes); RedactNotesCommand = new RelayCommand(RedactNotes); DeleteFavouritesCommand = new RelayCommand(DeleteFavourites); }
public DetailViewModel( IBackupFileService backupFileService, IFileOpenSaveService fileOpenSaveService, IDialogService dialogService, IRedactService redactService) { _backupFileService = backupFileService; _fileOpenSaveService = fileOpenSaveService; _dialogService = dialogService; _redactService = redactService; ListItems = CreateListItems(); ImportBibleNotesCommand = new RelayCommand(async() => await ImportBibleNotes().ConfigureAwait(true)); RedactNotesCommand = new RelayCommand(async() => await RedactNotes().ConfigureAwait(true)); DeleteFavouritesCommand = new RelayCommand(async() => await DeleteFavourites().ConfigureAwait(true)); }
public static Task ExecuteAsync( List<Note> notes, IRedactService redactService, BackupFile backupFile, IBackupFileService backupFileService, string filePath) { return Task.Run(() => { foreach (var note in notes) { if (!string.IsNullOrEmpty(note.Title)) { note.Title = redactService.GetNoteTitle(note.Title.Length); } if (!string.IsNullOrEmpty(note.Content)) { note.Content = redactService.GenerateNoteContent(note.Content.Length); } } backupFileService.WriteNewDatabase(backupFile, filePath, filePath); }); }