/// <summary> /// Initializes a new instance of the <see cref="NoteViewModel"/> class. /// </summary> public NoteViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, SearchableHtmlConverter searchableTextConverter, IRepositoryStorageService repositoryService, IFeedbackService feedbackService, ISettingsService settingsService, ICryptor cryptor, SafeListModel safes, NoteModel noteFromRepository) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _repositoryService = repositoryService; _feedbackService = feedbackService; _settingsService = settingsService; _searchableTextConverter = searchableTextConverter; _cryptor = cryptor; _safes = safes; MarkSearchableContentAsDirty(); PushNoteToOnlineStorageCommand = new RelayCommand(PushNoteToOnlineStorage); PullNoteFromOnlineStorageCommand = new RelayCommand(PullNoteFromOnlineStorage); ToggleShoppingModeCommand = new RelayCommand(ToggleShoppingMode); GoBackCommand = new RelayCommand(GoBack); Model = noteFromRepository; _unlockedContent = IsInSafe ? UnlockIfSafeOpen(Model.HtmlContent) : Model.HtmlContent; }
public OpenSafeViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IFeedbackService feedbackService, ICryptoRandomService randomService, ISettingsService settingsService, IRepositoryStorageService repositoryService, Navigation navigationTarget) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _feedbackService = feedbackService ?? throw new ArgumentNullException(nameof(feedbackService)); _randomService = randomService; _settingsService = settingsService; _repositoryService = repositoryService; _navigationTarget = navigationTarget; _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository); Model = noteRepository; GoBackCommand = new RelayCommand(GoBack); CancelCommand = new RelayCommand(Cancel); OkCommand = new RelayCommand(Ok); ResetSafeCommand = new RelayCommand(ResetSafe); }
/// <inheritdoc/> public ShortenedNoteViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, SearchableHtmlConverter searchableTextConverter, IRepositoryStorageService repositoryService, IFeedbackService feedbackService, ISettingsService settingsService, ICryptor cryptor, SafeListModel safes, NoteModel noteFromRepository) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl, searchableTextConverter, repositoryService, feedbackService, settingsService, cryptor, safes, noteFromRepository) { if (_unlockedContent != null) { // Create a short version for large notes, with only the first part of the note. // This is a performance improvement if there are large notes in the repository. HtmlShortener shortener = new HtmlShortener(); shortener.WantedLength = 600; // Should be enough even for settings with shortener.WantedTagNumber = 20; // small font and very height notes. string shortenedContent = shortener.Shorten(_unlockedContent); if (shortenedContent.Length != _unlockedContent.Length) { // Because the note will be truncated, we have to build the searchable content // first, before overwriting the original content. string dummy = SearchableContent; _unlockedContent = shortenedContent; } } }
/// <summary> /// Initializes a new instance of the <see cref="RecycleBinViewModel"/> class. /// </summary> public RecycleBinViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IFeedbackService feedbackService, ISettingsService settingsService, ICryptoRandomSource randomSource, IRepositoryStorageService repositoryService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _feedbackService = feedbackService; _settingsService = settingsService; _repositoryService = repositoryService; _noteCryptor = new Cryptor(NoteModel.CryptorPackageName, randomSource); RecycledNotes = new List <NoteViewModel>(); _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository); Model = noteRepository; // Initialize commands GoBackCommand = new RelayCommand(GoBack); RestoreNoteCommand = new RelayCommand <object>(RestoreNote); EmptyRecycleBinCommand = new RelayCommand(EmptyRecycleBin); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> public SettingsViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, ISettingsService settingsService, IStoryBoardService storyBoardService, IFeedbackService feedbackService, ICloudStorageClientFactory cloudStorageClientFactory, IFilePickerService filePickerService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _settingsService = settingsService; _storyBoardService = storyBoardService; _feedbackService = feedbackService; _cloudStorageClientFactory = cloudStorageClientFactory; _filePickerService = filePickerService; _fontSizeConverter = new SliderStepConverter(ReferenceFontSize, 1.0); _noteMaxHeightConverter = new SliderStepConverter(ReferenceNoteMaxSize, 20.0); Model = _settingsService.LoadSettingsOrDefault(); EncryptionAlgorithms = new List <DropdownItemViewModel>(); FillAlgorithmList(EncryptionAlgorithms); // Initialize commands GoBackCommand = new RelayCommand(GoBack); ChangeCloudSettingsCommand = new RelayCommand(ChangeCloudSettings); ClearCloudSettingsCommand = new RelayCommand(ClearCloudSettings); TestNewLocalizationCommand = new RelayCommand(TestNewLocalization); }
public StopViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { }
protected ViewModelBase( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl) { _navigationService = navigationService; Language = languageService; Icon = svgIconService; _webviewBaseUrl = webviewBaseUrl; }
public FirstTimeSyncViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService; GoBackCommand = new RelayCommand(GoBack); ContinueCommand = new RelayCommand(Continue); }
/// <summary> /// Initializes a new instance of the <see cref="NoteRepositoryViewModel"/> class. /// </summary> public NoteRepositoryViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, IFeedbackService feedbackService, ISettingsService settingsService, IEnvironmentService environmentService, ICryptoRandomSource randomSource, IRepositoryStorageService repositoryService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _storyBoardService = storyBoardService; _repositoryService = repositoryService; _feedbackService = feedbackService; _settingsService = settingsService; _environmentService = environmentService; _noteCryptor = new Cryptor(NoteModel.CryptorPackageName, randomSource); _searchableTextConverter = new SearchableHtmlConverter(); AllNotes = new List <NoteViewModel>(); FilteredNotes = new ObservableCollection <NoteViewModel>(); _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository); Model = noteRepository; // Initialize commands and events ShowNoteCommand = new RelayCommand <object>(ShowNote); NewNoteCommand = new RelayCommand(NewNote); NewChecklistCommand = new RelayCommand(NewChecklist); DeleteNoteCommand = new RelayCommand <object>(DeleteNote); ClearFilterCommand = new RelayCommand(ClearFilter); SynchronizeCommand = new RelayCommand(Synchronize); ShowTransferCodeCommand = new RelayCommand(ShowTransferCode); ShowSettingsCommand = new RelayCommand(ShowSettings); ShowRecycleBinCommand = new RelayCommand(ShowRecycleBin); ShowExportCommand = new RelayCommand(ShowExport); ShowInfoCommand = new RelayCommand(ShowInfo); OpenSafeCommand = new RelayCommand(OpenSafe); CloseSafeCommand = new RelayCommand(CloseSafe); ChangeSafePasswordCommand = new RelayCommand(ChangeSafePassword); Modified = false; // If a filter was set before e.g. opening a note, set the same filter again. if (!string.IsNullOrEmpty(_lastFilter)) { Filter = _lastFilter; } }
public CloudStorageOauthWaitingViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, IFeedbackService feedbackService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService; feedbackService.ShowBusyIndicator(true); GoBackCommand = new RelayCommand(GoBack); }
public InfoViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IVersionService versionService, INativeBrowserService nativeBrowserService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _versionService = versionService; _nativeBrowserService = nativeBrowserService; GoBackCommand = new RelayCommand(GoBack); OpenHomepageCommand = new RelayCommand(OpenHomepage); }
/// <summary> /// Initializes a new instance of the <see cref="StopViewModel"/> class. /// </summary> public StopViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IRepositoryStorageService repositoryService, IFolderPickerService folderPickerService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _repositoryService = repositoryService; _folderPickerService = folderPickerService; RecoverRepositoryCommand = new RelayCommand(RecoverRepository); }
/// <summary> /// Initializes a new instance of the <see cref="ViewModelBase"/> class. /// </summary> protected ViewModelBase( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl) { _navigationService = navigationService; Language = languageService; Icon = svgIconService; Theme = themeService; _webviewBaseUrl = webviewBaseUrl; HtmlRecource = new HtmlRecourceService(); }
public MergeChoiceViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService; UseMergedRepositoryCommand = new RelayCommand(UseMergedRepository); UseLocalRepositoryCommand = new RelayCommand(UseLocalRepository); UseCloudRepositoryCommand = new RelayCommand(UseCloudRepository); GoBackCommand = new RelayCommand(GoBack); CancelCommand = new RelayCommand(Cancel); }
public NoteRepositoryViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, IFeedbackService feedbackService, ISettingsService settingsService, IEnvironmentService environmentService, ICryptoRandomSource randomSource, IRepositoryStorageService repositoryService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _storyBoardService = storyBoardService; _repositoryService = repositoryService; _feedbackService = feedbackService; _settingsService = settingsService; _environmentService = environmentService; _noteCryptor = new Cryptor(NoteModel.CryptorPackageName, randomSource); _searchableTextConverter = new SearchableHtmlConverter(); AllNotes = new List <NoteViewModel>(); FilteredNotes = new ObservableCollection <NoteViewModel>(); _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository); Model = noteRepository; // Initialize commands and events ShowNoteCommand = new RelayCommand <Guid>(ShowNote); NewNoteCommand = new RelayCommand(NewNote); NewChecklistCommand = new RelayCommand(NewChecklist); DeleteNoteCommand = new RelayCommand <Guid>(DeleteNote); ClearFilterCommand = new RelayCommand(ClearFilter); SynchronizeCommand = new RelayCommand(Synchronize); ShowTransferCodeCommand = new RelayCommand(ShowTransferCode); ShowSettingsCommand = new RelayCommand(ShowSettings); ShowRecycleBinCommand = new RelayCommand(ShowRecycleBin); ShowInfoCommand = new RelayCommand(ShowInfo); OpenSafeCommand = new RelayCommand(OpenSafe); CloseSafeCommand = new RelayCommand(CloseSafe); ChangeSafePasswordCommand = new RelayCommand(ChangeSafePassword); OnPropertyChanged(nameof(FilterButtonMagnifierVisible)); OnPropertyChanged(nameof(FilterButtonCancelVisible)); Modified = false; }
public TransferCodeViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, IFeedbackService feedbackService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService; _feedbackService = feedbackService; // Initialize commands OkCommand = new RelayCommand(Ok); GoBackCommand = new RelayCommand(GoBack); CancelCommand = new RelayCommand(Cancel); }
public TransferCodeHistoryViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, ISettingsService settingsService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { Model = settingsService.LoadSettingsOrDefault(); ShowTransfercodeHistoryVisible = TransferCodeHistory.Count > 0; TransfercodeHistoryVisible = false; // Initialize commands GoBackCommand = new RelayCommand(GoBack); ShowTransfercodeHistoryCommand = new RelayCommand(ShowTransfercodeHistory); }
public CloudStorageChoiceViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, ICloudStorageClientFactory cloudStorageClientFactory) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService; _cloudStorageClientFactory = cloudStorageClientFactory; ServiceChoices = new List <CloudStorageChoiceItemViewModel>(); GoBackCommand = new RelayCommand(GoBack); ChooseCommand = new RelayCommand <string>(Choose); ListChoices(ServiceChoices); }
public NoteViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, SearchableHtmlConverter searchableTextConverter, IRepositoryStorageService repositoryService, ISettingsService settingsService, NoteModel noteFromRepository) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _repositoryService = repositoryService; _settingsService = settingsService; _searchableTextConverter = searchableTextConverter; MarkSearchableContentAsDirty(); GoBackCommand = new RelayCommand(GoBack); Model = noteFromRepository; }
public RecycleBinViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IThemeService themeService, IRepositoryStorageService repositoryService) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _themeService = themeService; _repositoryService = repositoryService; RecycledNotes = new List <NoteViewModel>(); _repositoryService.LoadRepositoryOrDefault(out NoteRepositoryModel noteRepository); Model = noteRepository; // Initialize commands GoBackCommand = new RelayCommand(GoBack); RestoreNoteCommand = new RelayCommand <Guid>(RestoreNote); EmptyRecycleBinCommand = new RelayCommand(EmptyRecycleBin); }
public SettingsViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, ISettingsService settingsService, IStoryBoardService storyBoardService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _settingsService = settingsService; _storyBoardService = storyBoardService; Model = _settingsService.LoadSettingsOrDefault(); EncryptionAlgorithms = new List <DropdownItemViewModel>(); FillAlgorithmList(EncryptionAlgorithms); // Initialize commands GoBackCommand = new RelayCommand(GoBack); ChangeCloudSettingsCommand = new RelayCommand(ChangeCloudSettings); ClearCloudSettingsCommand = new RelayCommand(ClearCloudSettings); }
public CloudStorageAccountViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IBaseUrlService webviewBaseUrl, IStoryBoardService storyBoardService, IFeedbackService feedbackService, ICloudStorageClientFactory cloudStorageClientFactory, SerializeableCloudStorageCredentials model) : base(navigationService, languageService, svgIconService, webviewBaseUrl) { _storyBoardService = storyBoardService ?? throw new ArgumentNullException(nameof(storyBoardService)); _feedbackService = feedbackService ?? throw new ArgumentNullException(nameof(feedbackService)); Model = model; _credentialsRequirements = cloudStorageClientFactory.GetOrCreate(Model.CloudStorageId).CredentialsRequirements; CloudServiceName = cloudStorageClientFactory.GetCloudStorageMetadata(Model.CloudStorageId).Title; GoBackCommand = new RelayCommand(GoBack); CancelCommand = new RelayCommand(Cancel); OkCommand = new RelayCommand(Ok); }
public ExportViewModel( INavigationService navigationService, ILanguageService languageService, ISvgIconService svgIconService, IThemeService themeService, IBaseUrlService webviewBaseUrl, IFeedbackService feedbackService, ICryptoRandomSource randomSource, IRepositoryStorageService repositoryService, IFolderPickerService folderPickerService) : base(navigationService, languageService, svgIconService, themeService, webviewBaseUrl) { _feedbackService = feedbackService; _repositoryService = repositoryService; _folderPickerService = folderPickerService; _noteCryptor = new Cryptor(NoteModel.CryptorPackageName, randomSource); GoBackCommand = new RelayCommand(GoBack); CancelCommand = new RelayCommand(Cancel); OkCommand = new RelayCommand(Ok); ExportUnprotectedNotes = true; }