Example #1
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);
        }
Example #3
0
        public static IFileSyncContext InitializeFileSyncContext(this IMobileServiceClient client, IFileSyncHandler syncHandler,
                                                                 IMobileServiceLocalStore store, IFileSyncTriggerFactory fileSyncTriggerFactory)
        {
            lock (contextsSyncRoot)
            {
                IFileSyncContext context;

                if (!contexts.TryGetValue(client, out context))
                {
                    context = new MobileServiceFileSyncContext(client, new FileMetadataStore(store), new FileOperationQueue(store), fileSyncTriggerFactory, syncHandler);
                    contexts.Add(client, context);
                }

                return(context);
            }
        }
Example #4
0
 public MobileServiceFileSyncContext(IMobileServiceClient client, IFileMetadataStore metadataStore, IFileOperationQueue operationsQueue,
                                     IFileSyncTriggerFactory syncTriggerFactory, IFileSyncHandler syncHandler)
     : this(client, metadataStore, operationsQueue, syncTriggerFactory, syncHandler, null)
 {
 }
 /// <summary>
 /// FileStore plugin configuration constructor
 /// </summary>
 /// <param name="fileFolderShortPath">Local folder relative path to store files</param>
 /// <param name="fileManagementService">File management service</param>
 /// <param name="globalFileSyncTriggerFactory">Global file sync trigger</param>
 public AptkAmaFileStorePluginConfiguration(string fileFolderShortPath, IAptkAmaFileManagementService fileManagementService, IFileSyncTriggerFactory globalFileSyncTriggerFactory)
 {
     FileFolderShortPath          = fileFolderShortPath;
     FileManagementService        = fileManagementService;
     GlobalFileSyncTriggerFactory = globalFileSyncTriggerFactory;
 }
 /// <summary>
 /// FileStore plugin configuration constructor
 /// </summary>
 /// <param name="globalFileSyncTriggerFactory">Global file sync trigger</param>
 public AptkAmaFileStorePluginConfiguration(IFileSyncTriggerFactory globalFileSyncTriggerFactory)
 {
     GlobalFileSyncTriggerFactory = globalFileSyncTriggerFactory;
 }
 /// <summary>
 /// Initializes the file synchronization capabilities of the <see cref="IMobileServiceClient"/>. Offline sync must also be initialized by calling
 /// IMobileServiceClient.SyncContext.InitializeAsync.
 /// </summary>
 /// <param name="client">IMobileServiceClient instance</param>
 /// <param name="syncHandler">An instance of <see cref="IFileSyncHandler"/> that specifies how to handle changes to stored files</param>
 /// <param name="store">The <see cref="IMobileServiceLocalStore"/> for storing file metadata locally</param>
 /// <param name="fileSyncTriggerFactory">An instance of <see cref="IFileSyncTriggerFactory"/> that generates <see cref="IFileSyncTrigger"/> objects for triggering synchronisation of file metadata and content</param>
 /// <returns>An instance of <see cref="IFileSyncContext"/></returns>
 public static IFileSyncContext InitializeFileSyncContext(this IMobileServiceClient client, IFileSyncHandler syncHandler, IMobileServiceLocalStore store, IFileSyncTriggerFactory fileSyncTriggerFactory)
 {
     return client.InitializeFileSyncContext(new MobileServiceFileSyncContext(client, new FileMetadataStore(store), new FileOperationQueue(store), fileSyncTriggerFactory, syncHandler));
 }
 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;
 }
 public MobileServiceFileSyncContext(IMobileServiceClient client, IFileMetadataStore metadataStore, IFileOperationQueue operationsQueue,
     IFileSyncTriggerFactory syncTriggerFactory, IFileSyncHandler syncHandler)
     : this(client, metadataStore, operationsQueue, syncTriggerFactory, syncHandler, null)
 { }