Exemple #1
0
        public async static Task <DropBoxProvider> Instance(DropBoxAccount acc)
        {
            DropBoxProvider provider = new DropBoxProvider();
            await provider.Authenticate(acc);

            return(provider);
        }
        /// <summary>
        /// Returns the appropriate authenticated provider based on the parameters
        /// </summary>
        /// <param name="providerType">Service provider</param>
        /// <param name="acc">User account</param>
        /// <returns></returns>
        private static async Task <IFileTransferProvider> getProvider(ServiceProviders providerType, Account acc)
        {
            IFileTransferProvider retval = null;

            switch (providerType)
            {
            case ServiceProviders.Local:
                retval = LocalStorageProvider.Instance();
                break;

            case ServiceProviders.Google:
                retval = await GoogleDriveProvider.Instance(acc as GoogleDriveAccount);

                break;

            case ServiceProviders.DropBox:
                retval = await DropBoxProvider.Instance(acc as DropBoxAccount);

                break;

            case ServiceProviders.OneDrive:
                retval = await OneDriveProvider.Instance(acc as OneDriveAccount);

                break;

            case ServiceProviders.SSH:
                retval = await SSHProvider.Instance(acc as SSHAccount);

                break;
            }
            return(retval);
        }