/// <summary> /// /// </summary> public FormatsViewModel( IDopyTranslations dopyTranslations, IDopyConfiguration dopyConfiguration) { DopyTranslations = dopyTranslations; DopyConfiguration = dopyConfiguration; dopyTranslations.CreateDisplayNameBinding(this, nameof(IDopyTranslations.FormatsConfigTitle)); Id = "F_Formats"; SelectedFormats = new ObservableCollection <string>(DopyConfiguration.IncludeFormats); using var clipboardAccessToken = ClipboardNative.Access(); AvailableFormats = new ObservableCollection <string>(clipboardAccessToken.AvailableFormats()); }
/// <summary> /// Initializes the needed dependencies /// </summary> /// <param name="clipRepository">IClipRepository</param> /// <param name="sessionRepository">ISessionRepository</param> /// <param name="dopyConfiguration">Configuration</param> /// <param name="uiSynchronizationContext">SynchronizationContext to register the Clipboard Monitor with</param> public ClipboardStoreService( IClipRepository clipRepository, ISessionRepository sessionRepository, IDopyConfiguration dopyConfiguration, [KeyFilter("ui")] SynchronizationContext uiSynchronizationContext) { _clipRepository = clipRepository; _uiSynchronizationContext = uiSynchronizationContext ?? throw new ArgumentNullException(nameof(uiSynchronizationContext)); _dopyConfiguration = dopyConfiguration; var currentSession = CreateSession(); _currentSession = sessionRepository.Find(session => session.SessionSid == currentSession.SessionSid).FirstOrDefault(); if (_currentSession != null) { return; } sessionRepository.Create(currentSession); _currentSession = currentSession; }