Exemplo n.º 1
0
 public FilesService(
     IDropboxService dropboxService,
     IDeletableEntityRepository <File> fileRepository)
 {
     this.dropboxService = dropboxService;
     this.fileRepository = fileRepository;
 }
 public DropboxAuthenticationWindowViewModel(IDropboxService dropboxService, DropboxAppData dropboxAppData, DropboxAuthenticationWindowTranslation translation)
 {
     _dropboxService     = dropboxService;
     _dropboxData        = dropboxAppData;
     Translation         = translation;
     CancelDialogCommand = new DelegateCommand(CancelInputDialog);
 }
Exemplo n.º 3
0
            public DropboxConsumerTokenManager(int userId,IDropboxService dropboxService, IUserService userService)
            {
                _userService = userService;
                _userId = userId;

                ConsumerKey = dropboxService.GetConsumerKey();
                ConsumerSecret = dropboxService.GetConsumerSecret();
            }
 public DropboxUserInfoManager(IDropboxService dropboxService, DropboxAppData dropboxAppData,
                               IDropboxHttpListener dropboxHttpListener, IDropboxCodeExchanger dropboxCodeExchanger)
 {
     _dropboxService       = dropboxService;
     _dropboxAppData       = dropboxAppData;
     _dropboxHttpListener  = dropboxHttpListener;
     _dropboxCodeExchanger = dropboxCodeExchanger;
 }
        public DropboxAuthenticationController(IDropboxService dropbox,
                                               IOrchardServices orchard,
                                               IHttpContextAccessor httpContext) {
            _dropbox = dropbox;
            _orchard = orchard;
            _httpContext = httpContext;

            Logger = NullLogger.Instance;
        }
        public DropboxStorageController(IDropboxService dropbox,
                                        IOrchardServices orchard,
                                        IMediaLibraryService media) {
            _dropbox = dropbox;
            _orchard = orchard;
            _media = media;

            Logger = NullLogger.Instance;
        }
        public DropboxAccountRemoveCommand(IInteractionRequest interactionRequest, ICurrentSettingsProvider currentSettingsProvider, IDropboxService dropboxService, ITranslationUpdater translationUpdater)
            : base(translationUpdater)
        {
            _interactionRequest = interactionRequest;
            _dropboxService     = dropboxService;
            _profiles           = currentSettingsProvider?.Profiles;

            _dropboxAccounts = currentSettingsProvider?.Settings?.ApplicationSettings?.Accounts?.DropboxAccounts ?? new ObservableCollection <DropboxAccount>();
            _dropboxAccounts.CollectionChanged += (sender, args) => RaiseCanExecuteChanged();
        }
        public DropboxAuthenticationController(IDropboxService dropbox,
                                               IOrchardServices orchard,
                                               IHttpContextAccessor httpContext)
        {
            _dropbox     = dropbox;
            _orchard     = orchard;
            _httpContext = httpContext;

            Logger = NullLogger.Instance;
        }
        public DropboxStorageController(IDropboxService dropbox,
                                        IOrchardServices orchard,
                                        IMediaLibraryService media)
        {
            _dropbox = dropbox;
            _orchard = orchard;
            _media   = media;

            Logger = NullLogger.Instance;
        }
Exemplo n.º 10
0
        public DropboxFileSystemProvider(IDropboxService dropbox,IZinOSDesktopDropboxAccount zinOSDesktopDropboxAccount)
        {
            _dropboxService = dropbox;
            _zinOSDesktopDropboxAccount = zinOSDesktopDropboxAccount;

            _rootFileSystemItem = new FileSystemItem {
                IsDirectory = true,
                Path =  String.Format(@"\{0}", DropboxProviderName),
                Name = DropboxProviderName
            };
        }
        public void Setup()
        {
            var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());

            _translation    = new DropboxTranslation();
            _dropboxService = Substitute.For <IDropboxService>();
            _dropboxService.ParseAccessToken(Arg.Any <Uri>()).Returns("AccessAccount");
            _dropboxAppData     = new DropboxAppData("DummieAppKeyForTest", _redirectUri);
            _viewModel          = new DropboxAccountViewModel(_dropboxService, _dropboxAppData, translationUpdater);
            _accountInteraction = new DropboxAccountInteraction();
            _viewModel.SetInteraction(_accountInteraction);
        }
Exemplo n.º 12
0
 public DropboxAccountRemoveCommand(IInteractionRequest interactionRequest,
                                    ICurrentSettings <Accounts> accountsProvider,
                                    ICurrentSettings <ObservableCollection <ConversionProfile> > profilesProvider,
                                    IDropboxService dropboxService,
                                    ITranslationUpdater translationUpdater)
     : base(translationUpdater)
 {
     _interactionRequest = interactionRequest;
     _accountsProvider   = accountsProvider;
     _profilesProvider   = profilesProvider;
     _dropboxService     = dropboxService;
 }
Exemplo n.º 13
0
 public DropboxActionViewModel(DropboxSettingsAndActionTranslation translation, IInteractionInvoker interactionInvoker, IDropboxService dropboxService, TokenHelper tokenHelper)
 {
     Translation                 = translation;
     _interactionInvoker         = interactionInvoker;
     _dropboxService             = dropboxService;
     AddDropboxAccountCommand    = new DelegateCommand(AuthoriseDropboxUser);
     _accountsCollection         = new SynchronizedCollection <DropboxAccount>(new List <DropboxAccount>());
     RemoveDropboxAccountCommand = new DelegateCommand(RemoveDropboxAccount, RemoveDropboxCanExecute);
     TokenReplacer               = tokenHelper.TokenReplacerWithPlaceHolders;
     TokenViewModel              = new TokenViewModel(x => CurrentProfile.DropboxSettings.SharedFolder = x, () => CurrentProfile?.DropboxSettings.SharedFolder,
                                                      tokenHelper.GetTokenListForDirectory());
     DisplayName = translation.DisplayName;
 }
Exemplo n.º 14
0
 public DropBoxControlViewModel(IInteractionInvoker interactionInvoker, IDropboxService dropboxService, TokenHelper tokenHelper, ITranslationUpdater translationUpdater, ISelectedProfileProvider profile) : base(translationUpdater, profile)
 {
     _interactionInvoker         = interactionInvoker;
     _dropboxService             = dropboxService;
     AddDropboxAccountCommand    = new DelegateCommand(AuthoriseDropboxUser);
     _accountsCollection         = new Helper.SynchronizedCollection <DropboxAccount>(new List <DropboxAccount>());
     RemoveDropboxAccountCommand = new DelegateCommand(RemoveDropboxAccount, RemoveDropboxCanExecute);
     if (tokenHelper != null)
     {
         TokenReplacer  = tokenHelper.TokenReplacerWithPlaceHolders;
         TokenViewModel = new TokenViewModel(x => CurrentProfile.DropboxSettings.SharedFolder = x, () => CurrentProfile?.DropboxSettings.SharedFolder, tokenHelper.GetTokenListForDirectory(), ReplaceTokens);
     }
 }
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            _translation        = new DropboxTranslation();

            _dropboxAccounts = new ObservableCollection <DropboxAccount>();

            _usedAccount             = new DropboxAccount();
            _usedAccount.AccountId   = nameof(_usedAccount);
            _usedAccount.AccountInfo = "AI1";
            _usedAccount.AccessToken = "AT1";
            _dropboxAccounts.Add(_usedAccount);

            _unusedAccount             = new DropboxAccount();
            _unusedAccount.AccountId   = nameof(_unusedAccount);
            _unusedAccount.AccountInfo = "AI2";
            _unusedAccount.AccessToken = "AT2";
            _dropboxAccounts.Add(_unusedAccount);

            _profilesProvider = Substitute.For <ICurrentSettings <ObservableCollection <ConversionProfile> > >();
            _profiles         = new ObservableCollection <ConversionProfile>();

            _profileWithDropboxActionEnabled      = new ConversionProfile();
            _profileWithDropboxActionEnabled.Name = nameof(_profileWithDropboxActionEnabled);
            _profileWithDropboxActionEnabled.DropboxSettings.Enabled   = true;
            _profileWithDropboxActionEnabled.DropboxSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithDropboxActionEnabled);

            _profileWithDropboxActionDisabled      = new ConversionProfile();
            _profileWithDropboxActionDisabled.Name = nameof(_profileWithDropboxActionDisabled);
            _profileWithDropboxActionDisabled.DropboxSettings.Enabled   = false;
            _profileWithDropboxActionDisabled.DropboxSettings.AccountId = _usedAccount.AccountId;
            _profiles.Add(_profileWithDropboxActionDisabled);

            var settings = new PdfCreatorSettings();

            settings.ApplicationSettings.Accounts.DropboxAccounts = _dropboxAccounts;
            settings.ConversionProfiles = _profiles;
            _accountsProvider           = Substitute.For <ICurrentSettings <Accounts> >();
            _accountsProvider.Settings.Returns(settings.ApplicationSettings.Accounts);
            _profilesProvider.Settings.Returns(_profiles);

            var translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());

            _dropboxService = Substitute.For <IDropboxService>();

            _dropboxAccountRemoveCommand = new DropboxAccountRemoveCommand(_interactionRequest, _accountsProvider, _profilesProvider, _dropboxService, translationUpdater);
        }
Exemplo n.º 16
0
        public void SetUp()
        {
            _profile = new ConversionProfile();
            _profile.DropboxSettings.Enabled   = true;
            _profile.DropboxSettings.AccountId = _accountId;

            _dropboxService = Substitute.For <IDropboxService>();

            _dropboxAccount             = new DropboxAccount();
            _dropboxAccount.AccountId   = _accountId;
            _dropboxAccount.AccessToken = _accessToken;

            _accounts = new Accounts();
            _accounts.DropboxAccounts.Add(_dropboxAccount);

            _dropboxAction = new DropboxAction(_dropboxService);
        }
Exemplo n.º 17
0
        public DropboxOAuthConsumer(int userId, IDropboxService dropboxService, IUserService userService)
        {
            var dropboxEnpoints = dropboxService.GetDroboxOAuthEndpoints();

            ServiceProviderDescription = new ServiceProviderDescription
            {
                RequestTokenEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.RequestToken,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest),
                UserAuthorizationEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.UserAuthorization,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest),
                AccessTokenEndpoint = new MessageReceivingEndpoint(dropboxEnpoints.AccessToken,
                                                HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest),
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },

                ProtocolVersion = ProtocolVersion.V10
            };

            WebConsumer = new WebConsumer(ServiceProviderDescription, new DropboxConsumerTokenManager(userId, dropboxService, userService));
        }
Exemplo n.º 18
0
        public MainViewModel(ICryptographyService cryptographyService, IMessenger messenger, IDataAccessLayer database,
            IDropboxService dropboxService)
        {
            _cryptographyService = cryptographyService;
            _messenger = messenger;
            _database = database;
            _dropboxService = dropboxService;

            //register for messages
            _messenger.Register<AssignNewKeysConfirmMsg>(this, OnAssignNewKeysConfirmMsg);
            _messenger.Register<ExportPublicKeyConfirmMsg>(this, OnExportPublicKeyConfirmMsg);
            _messenger.Register<ContactsViewClosedMsg>(this, OnContactsViewClosedMsg);
            _messenger.Register<ChooseSourceConfirmMsg>(this, OnChooseSourceConfirmMsg);
            _messenger.Register<ChooseTargetConfirmMsg>(this, OnChooseTargetConfirmMsg);
            _messenger.Register<ContactSelectedMsg>(this, OnContactSelectedMsg);
            _messenger.Register<ConnectDropboxViewClosedMsg>(this, OnConnectDropboxViewClosedMsg);
            _messenger.Register<DropboxAccessTokenSavedMsg>(this, OnDropboxAccessTokenSavedMsg);
            _messenger.Register<FileListViewClosedMsg>(this, OnFileListViewClosedMsg);
            _messenger.Register<DropboxFileDownloadFinishedMsg>(this, OnDropboxFileDownloadFinishedMsg);

            _messenger.Register<EncryptionSuccsessMsg>(this, OnEncryptionSuccsessMsg);

            CheckDropboxAccess();
        }
Exemplo n.º 19
0
        public MainViewModel(ICryptographyService cryptographyService, IMessenger messenger, IDataAccessLayer database,
                             IDropboxService dropboxService)
        {
            _cryptographyService = cryptographyService;
            _messenger           = messenger;
            _database            = database;
            _dropboxService      = dropboxService;

            //register for messages
            _messenger.Register <AssignNewKeysConfirmMsg>(this, OnAssignNewKeysConfirmMsg);
            _messenger.Register <ExportPublicKeyConfirmMsg>(this, OnExportPublicKeyConfirmMsg);
            _messenger.Register <ContactsViewClosedMsg>(this, OnContactsViewClosedMsg);
            _messenger.Register <ChooseSourceConfirmMsg>(this, OnChooseSourceConfirmMsg);
            _messenger.Register <ChooseTargetConfirmMsg>(this, OnChooseTargetConfirmMsg);
            _messenger.Register <ContactSelectedMsg>(this, OnContactSelectedMsg);
            _messenger.Register <ConnectDropboxViewClosedMsg>(this, OnConnectDropboxViewClosedMsg);
            _messenger.Register <DropboxAccessTokenSavedMsg>(this, OnDropboxAccessTokenSavedMsg);
            _messenger.Register <FileListViewClosedMsg>(this, OnFileListViewClosedMsg);
            _messenger.Register <DropboxFileDownloadFinishedMsg>(this, OnDropboxFileDownloadFinishedMsg);

            _messenger.Register <EncryptionSuccsessMsg>(this, OnEncryptionSuccsessMsg);

            CheckDropboxAccess();
        }
 public FileListViewModel(IDataAccessLayer database, IDropboxService dropboxService, IMessenger messenger)
 {
     _database       = database;
     _dropboxService = dropboxService;
     _messenger      = messenger;
 }
Exemplo n.º 21
0
 public Get_File_List_v1(ICrateManager crateManager, IDropboxService dropboxService)
     : base(crateManager)
 {
     _dropboxService = dropboxService;
 }
 public FileListViewModel(IDataAccessLayer database, IDropboxService dropboxService, IMessenger messenger)
 {
     _database = database;
     _dropboxService = dropboxService;
     _messenger = messenger;
 }
Exemplo n.º 23
0
 public ConnectDropboxViewModel(IDataAccessLayer database, IMessenger messenger, IDropboxService dropboxService)
 {
     _database       = database;
     _messenger      = messenger;
     _dropboxService = dropboxService;
 }
Exemplo n.º 24
0
 public DropboxAction(IDropboxService dropboxService)
 {
     _dropboxService = dropboxService;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DropboxVirtualFile"/> class.
 /// </summary>
 /// <param name="virtualPath">The virtual path.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="dropboxService"></param>
 public DropboxVirtualFile(string virtualPath, DropboxVirtualPathProvider provider, IDropboxService dropboxService)
     : base(virtualPath) {
     _dropboxService = dropboxService;
     _provider = provider;
 }
Exemplo n.º 26
0
 public UserController(IUserService userService, IDropboxService dropboxService)
 {
     _userService = userService;
     _dropboxService = dropboxService;
 }
Exemplo n.º 27
0
 public HomeController(IDropboxService dropboxService)
 {
     _dropboxService = dropboxService;
 }
Exemplo n.º 28
0
 public DropboxAccountViewModel(IDropboxService dropboxService, DropboxAppData dropboxAppData, ITranslationUpdater translationUpdater)
     : base(translationUpdater)
 {
     _dropboxService = dropboxService;
     _dropboxData    = dropboxAppData;
 }
Exemplo n.º 29
0
 public DropboxAction(IDropboxService dropboxService, IDropboxSharedLinksProvider dropboxSharedLinksProvider)
 {
     _dropboxService             = dropboxService;
     _dropboxSharedLinksProvider = dropboxSharedLinksProvider;
 }
 /// <summary>
 /// Initializes a new instance of the <b>DropboxVirtualPathProvider</b> class.
 /// </summary>
 /// <param name="service"></param>
 public DropboxVirtualPathProvider(IDropboxService service) {
     _service=service;
 }
 public ConnectDropboxViewModel(IDataAccessLayer database, IMessenger messenger, IDropboxService dropboxService)
 {
     _database = database;
     _messenger = messenger;
     _dropboxService = dropboxService;
 }