Esempio n. 1
0
        public DropboxFileMetaData UploadFileWithSharing(string accessToken, string folder, IEnumerable <string> listOfFilePaths, bool ensureUniqueFilenames, string subFolderForMultipleFiles)
        {
            try
            {
                var result         = new DropboxFileMetaData();
                var dbxClient      = MakeInstanceOfClient(accessToken);
                var folderToUpload = GetFullFolderToUpload(folder, Path.GetFileNameWithoutExtension(subFolderForMultipleFiles), listOfFilePaths.Count());
                foreach (var pathOfCurrentItem in listOfFilePaths)
                {
                    var currentFileName  = Path.GetFileName(pathOfCurrentItem);
                    var fullPuthToUpload = folderToUpload + currentFileName;
                    var fileMetaData     = UploadOneFile(ensureUniqueFilenames, pathOfCurrentItem, dbxClient, fullPuthToUpload);
                    if (listOfFilePaths.Count() == 1)
                    {
                        result = MakeSharedLinksOfFile(dbxClient, fileMetaData);
                    }
                }
                if (string.IsNullOrEmpty(result.Filename) || string.IsNullOrEmpty(result.ShareUrl))
                {
                    result = MakeSharedLinksOfFolder(dbxClient, folderToUpload);
                }

                return(result);
            }
            catch (Exception ex)
            {
                Logger.Error("Exception while uploading and sharing file to DropBox:\r\n" + ex.Message);
                return(new DropboxFileMetaData());
            }
        }
Esempio n. 2
0
        public void ShowSharedLinks(DropboxFileMetaData sharedLinks)
        {
            _logger.Debug("DropboxSharedLinks started");
            var interaction = new DropboxSharedLinksInteraction(sharedLinks);

            _interactionInvoker.Invoke(interaction);
        }
Esempio n. 3
0
        public DesignTimeDropboxSharedLinksViewModel() : base(new DropboxSharedLinksWindowTranslation(), new ProcessStarter())
        {
            var interaction = new DropboxSharedLinksInteraction(new DropboxFileMetaData());

            SetInteraction(interaction);
            SharedLink = new DropboxFileMetaData();
            var link = new DropboxFileMetaData()
            {
                SharedUrl = "https://www.dropbox.com/test/SharedFile.pdf"
            };

            SharedLink = link;
        }
 public DropboxSharedLinksInteraction(DropboxFileMetaData sharedLink)
 {
     SharedLink = sharedLink;
 }