Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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);
            });
        }