Exemple #1
0
        /// <summary>
        /// Construct which takes the underlying list and its associated context.
        /// </summary>
        /// <param name="list"></param>
        /// <param name="context"></param>
        public ModelList(DefaultScope.List list, ListSampleOfflineContext context)
        {
            this.list    = list;
            this.context = context;
            items        = null;

            // Register for the property changed event
            list.PropertyChanged += new PropertyChangedEventHandler(list_PropertyChanged);
        }
Exemple #2
0
        /// <summary>
        /// Creates and initializes the context
        /// </summary>
        /// <param name="cachePath"></param>
        /// <param name="uri"></param>
        private void CreateContext(string cachePath, Uri uri)
        {
            context = new ListSampleOfflineContext(cachePath, uri);

            // Need to specify the filter paramters.
            context.CacheController.ControllerBehavior.AddScopeParameters("userid", UserID.ToString("D"));

            context.LoadCompleted += new EventHandler <LoadCompletedEventArgs>(ContextLoadCompleted);
            context.CacheController.RefreshCompleted += new EventHandler <RefreshCompletedEventArgs>(CacheController_RefreshCompleted);
        }
Exemple #3
0
        /// <summary>
        /// Constructor which takes the context Item that is being wrapped and its associated context.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="context"></param>
        public ModelItem(Item item, ListSampleOfflineContext context)
        {
            this.item    = item;
            this.context = context;
            tags         = null;
            unusedTags   = null;
            usedTags     = new Dictionary <int, int>();
            list         = null;

            // Materialize the priority and status from the ids in the item
            UpdatePriority();
            UpdateStatus();

            // Register for any events that occur on the item
            item.PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged);

            // Register for any changes to the tag item mappings
            ((INotifyCollectionChanged)context.TagItemMappingCollection).CollectionChanged += new NotifyCollectionChangedEventHandler(ModelItem_CollectionChanged);
        }