コード例 #1
0
        public async static Task UploadAsync(this IMobileServiceClient client, MobileServiceFile file, IMobileServiceFileDataSource dataSource)
        {
            MobileServiceFileMetadata metadata = MobileServiceFileMetadata.FromFile(file);

            IMobileServiceFilesClient filesClient = GetFilesClient(client);
            await filesClient.UploadFileAsync(metadata, dataSource);
        }
コード例 #2
0
        internal MobileServiceFileSyncContext(IMobileServiceClient client, IFileMetadataStore metadataStore, IFileOperationQueue operationsQueue,
                                              IFileSyncTriggerFactory syncTriggerFactory, IFileSyncHandler syncHandler, IMobileServiceFilesClient filesClient)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (metadataStore == null)
            {
                throw new ArgumentNullException("metadataStore");
            }

            if (operationsQueue == null)
            {
                throw new ArgumentNullException("operationsQueue");
            }

            if (syncTriggerFactory == null)
            {
                throw new ArgumentNullException("syncTriggerFactory");
            }

            if (syncHandler == null)
            {
                throw new ArgumentNullException("syncHandler");
            }

            this.metadataStore            = metadataStore;
            this.syncHandler              = syncHandler;
            this.operationsQueue          = operationsQueue;
            this.mobileServiceFilesClient = filesClient ?? new MobileServiceFilesClient(client, new AzureBlobStorageProvider(client));
            this.eventManager             = client.EventManager;
            this.triggers = syncTriggerFactory.CreateTriggers(this);
        }
        internal MobileServiceFileSyncContext(IMobileServiceClient client, IFileMetadataStore metadataStore, IFileOperationQueue operationsQueue, 
            IFileSyncTriggerFactory syncTriggerFactory, IFileSyncHandler syncHandler, IMobileServiceFilesClient filesClient)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (metadataStore == null)
            {
                throw new ArgumentNullException("metadataStore");
            }

            if (operationsQueue == null)
            {
                throw new ArgumentNullException("operationsQueue");
            }

            if (syncTriggerFactory == null)
            {
                throw new ArgumentNullException("syncTriggerFactory");
            }

            if (syncHandler == null)
            {
                throw new ArgumentNullException("syncHandler");
            }

            this.metadataStore = metadataStore;
            this.syncHandler = syncHandler;
            this.operationsQueue = operationsQueue;
            this.mobileServiceFilesClient = filesClient ?? new MobileServiceFilesClient(client, new AzureBlobStorageProvider(client));
            this.eventManager = client.EventManager;
            this.triggers = syncTriggerFactory.CreateTriggers(this);
        }
コード例 #4
0
        public async static Task DeleteFileAsync <T>(this IMobileServiceTable <T> table, MobileServiceFile file)
        {
            MobileServiceFileMetadata metadata = MobileServiceFileMetadata.FromFile(file);

            IMobileServiceFilesClient client = GetFilesClient(table.MobileServiceClient);
            await client.DeleteFileAsync(metadata);
        }
コード例 #5
0
        public async static Task AddFileAsync <T>(this IMobileServiceTable <T> table, MobileServiceFile file, Stream fileStream)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (fileStream == null)
            {
                throw new ArgumentNullException("fileStream");
            }

            IMobileServiceFileDataSource dataSource = new StreamMobileServiceFileDataSource(fileStream);

            IMobileServiceFilesClient client = GetFilesClient(table.MobileServiceClient);
            await client.UploadFileAsync(MobileServiceFileMetadata.FromFile(file), dataSource);
        }
 public MobileServiceExpressFileSyncContext(IMobileServiceClient client, IFileMetadataStore metadataStore, IFileOperationQueue operationsQueue,
     IFileSyncTriggerFactory syncTriggerFactory, IFileSyncHandler syncHandler, IMobileServiceFilesClient filesClient, ILocalStorageProvider localStorage) 
     : base(client, metadataStore, operationsQueue, syncTriggerFactory, syncHandler, filesClient)
 {
     LocalStorage = localStorage;
 }
コード例 #7
0
        public async static Task <Uri> GetFileUri <T>(this IMobileServiceTable <T> table, MobileServiceFile file, StoragePermissions permissions)
        {
            IMobileServiceFilesClient filesClient = GetFilesClient(table.MobileServiceClient);

            return(await filesClient.GetFileUriAsync(file, permissions));
        }
コード例 #8
0
 public async static Task DownloadFileToStreamAsync <T>(this IMobileServiceTable <T> table, MobileServiceFile file, Stream fileStream)
 {
     IMobileServiceFilesClient filesClient = GetFilesClient(table.MobileServiceClient);
     await filesClient.DownloadToStreamAsync(file, fileStream);
 }
 public LocalStorageSyncHandler(ILocalStorageProvider localStorage, IMobileServiceFilesClient client)
 {
     this.localStorage = localStorage;
     this.client = client;
 }