internal async Task PutViewAsync(SynchronizedView view, CancellationToken cancelToken)
 {
     using (await CrossThreadLockScope.Enter(m_metadataLock))
     {
         await m_metadataStore.PutAsync(MakeViewKey(view.Name), view.Data);
     }
 }
        public IAsyncAction PutViewAsync(SynchronizedView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            view.Name.ValidateRequired("view");

            return(AsyncInfo.Run(async cancelToken =>
            {
                await this.PutViewAsync(view, cancelToken);
            }));
        }
示例#3
0
        public IAsyncAction PutViewAsync(SynchronizedView view)
        {
            return AsyncInfo.Run(
                async cancelToken =>
                      {
                          if (view == null)
                          {
                              throw new ArgumentNullException("view");
                          }
                          view.Name.ValidateRequired("view");

                          using (await CrossThreadLockScope.Enter(m_metadataLock))
                          {
                              await m_metadataStore.PutAsync(MakeViewKey(view.Name), view.Data);
                          }
                      });
        }
示例#4
0
        internal async Task Load()
        {
            string viewName = SynchronizedType.MakeViewName(m_typeID);

            m_items = await this.Store.GetViewAsync(viewName);

            if (m_items == null)
            {
                m_items = this.Store.CreateView(viewName, ItemQuery.QueryForTypeID(m_typeID));
                await this.SaveAsync();
            }

            m_items.PublicSyncDisabled = true;
            m_items.ItemsAvailable    += OnItemsAvailable;
            m_items.ItemsNotFound     += OnItemsNotFound;
            m_items.Error += OnError;
        }
        public IAsyncOperation <IList <SynchronizedView> > GetViewsAsync(IList <string> viewNames)
        {
            if (viewNames.IsNullOrEmpty())
            {
                throw new ArgumentException("viewNames");
            }

            return(AsyncInfo.Run <IList <SynchronizedView> >(async cancelToken =>
            {
                LazyList <SynchronizedView> views = new LazyList <SynchronizedView>();
                foreach (string viewName in viewNames)
                {
                    SynchronizedView view = await this.GetViewAsync(viewName, cancelToken);
                    if (view != null)
                    {
                        views.Add(view);
                    }
                }

                return views.HasValue ? views.Value : null;
            }));
        }
        internal async Task Load()
        {
            string viewName = SynchronizedType.MakeViewName(m_typeID);
            m_items = await this.Store.GetViewAsync(viewName);
            if (m_items == null)
            {
                m_items = this.Store.CreateView(viewName, ItemQuery.QueryForTypeID(m_typeID));
                await this.SaveAsync();
            }

            m_items.PublicSyncDisabled = true;
            m_items.ItemsAvailable += OnItemsAvailable;
            m_items.ItemsNotFound += OnItemsNotFound;
            m_items.Error += OnError;
        }