Ejemplo n.º 1
0
        public void TestVirtualListComplex()
        {
            var r = new Random(0);
            var v = new VirtualList<int>(false, Enumerable.Range(1, 10));
            v.Check();

            for (int i = 11; i < 5000; i++)
            {
                switch (r.Next(2))
                {
                    case 0:
                        var val = r.Next(v.Count + 1);
                        //Debug.Print("{0}: insert {1} @ {2}", v.Count, val, i);
                        v.Insert(val, i);
                        break;
                    case 1:
                        if (v.Count > 0)
                        {
                            var idx = r.Next(v.Count);
                            //Debug.Print("{0}: delete @ {1}", v.Count, idx);
                            v.RemoveAt(idx);
                        }
                        break;
                }

                v.Check();
            }
        }
Ejemplo n.º 2
0
        public void TestVirtualListComplex1()
        {
            var r = new Random();
            var v = new VirtualList<int>(false);

            v.Insert(0, 106);
            v.Check();
            v.Insert(0, 107);
            v.Check();
            v.Insert(0, 108);
            v.Check();
            v.Insert(0, 109);
            v.Check();
            v.Insert(2, 110);
            v.Check();
            v.Insert(2, 111);
            v.Check();

            v.RemoveAt(1);
            v.Check();
            v.RemoveAt(0);
            v.Check();
            v.RemoveAt(3);
            v.Check();
        }
Ejemplo n.º 3
0
 private void InitializeListCount(VirtualList vlist)
 {
     //temp hack for perf issue: see http://discuss.mediacentersandbox.com/forums/thread/9205.aspx
     if (titles.Count > 5)
         ((VirtualList)this.m_listContent).Count = 5;
     else
         ((VirtualList)this.m_listContent).Count = titles.Count;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Performs an operation on a List and VirtualList and makes sure the outcome is the same.
        /// </summary>
        /// <param name="action">The action to perform.</param>
        static void ListTOperation(Action<IList<object>> action)
        {
            var a = new List<object> { _testValues };
            var b = new VirtualList<object> { _testValues };

            action(a);
            action(b);

            AssertEquality(a, b);
        }
    internal EmptyDataItem( int index, VirtualList parentVirtualList )
      : base()
    {
      if( index < 0 )
        throw new ArgumentException( "Index must be greater than or equal to zero.", "index" );

      if( parentVirtualList == null )
        throw new ArgumentNullException( "parentVirtualList" );

      m_index = index;
      m_parentVirtualList = parentVirtualList;
    }
    protected override int OnQueryItemCountCore( VirtualList virtualList )
    {
      if( !this.IsConnected )
        return 0;

      DataGridVirtualizingQueryableCollectionViewGroup collectionViewGroup =
        this.GetLinkedCollectionViewGroup( virtualList ) as DataGridVirtualizingQueryableCollectionViewGroup;

      Debug.Assert( collectionViewGroup != null );

      return collectionViewGroup.QueryItemCount();
    }
    protected override int OnQueryItemCountCore( VirtualList virtualList )
    {
      if( !this.IsConnected )
        return 0;

      DataGridVirtualizingCollectionView collectionView = this.CollectionView as DataGridVirtualizingCollectionView;

      // The VirtualPageManager was Disposed
      if( collectionView == null )
        return 0;

      DataGridVirtualizingCollectionViewGroup collectionViewGroup = this.GetLinkedCollectionViewGroup( virtualList ) as DataGridVirtualizingCollectionViewGroup;
      Debug.Assert( ( collectionViewGroup != null ) && ( collectionView != null ) );

      return collectionView.OnQueryItemCount( collectionViewGroup );
    }
Ejemplo n.º 8
0
        public EntryDataExViewModel_AutoGen()
        {
            RegisterToReceiveMessages <EntryDataEx>(MessageToken.CurrentEntryDataExChanged, OnCurrentEntryDataExChanged);
            RegisterToReceiveMessages(MessageToken.EntryDataExChanged, OnEntryDataExChanged);
            RegisterToReceiveMessages(MessageToken.EntryDataExFilterExpressionChanged, OnEntryDataExFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            EntryDataEx = new VirtualList <EntryDataEx>(vloader);
            EntryDataEx.LoadingStateChanged += EntryDataEx_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(EntryDataEx, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 9
0
 private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
 {
     object commandForItem = null;
     if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
     {
         commandForItem = this.m_listContent[idx];
     }
     else if (((this.titles != null) && (idx >= 0)) && (idx < this.titles.Count))
     {
         OMLEngine.Title item = this.titles[idx] as OMLEngine.Title;
         if (item != null)
         {
             commandForItem = this.GetCommandForItem(item);
         }
     }
     callbackItem(vlist, idx, commandForItem);
 }
        public CounterPointSalesViewModel_AutoGen()
        {
            RegisterToReceiveMessages <CounterPointSales>(MessageToken.CurrentCounterPointSalesChanged, OnCurrentCounterPointSalesChanged);
            RegisterToReceiveMessages(MessageToken.CounterPointSalesChanged, OnCounterPointSalesChanged);
            RegisterToReceiveMessages(MessageToken.CounterPointSalesFilterExpressionChanged, OnCounterPointSalesFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            CounterPointSales = new VirtualList <CounterPointSales>(vloader);
            CounterPointSales.LoadingStateChanged += CounterPointSales_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(CounterPointSales, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 11
0
        public PackageTypeViewModel_AutoGen()
        {
            RegisterToReceiveMessages <PackageType>(MessageToken.CurrentPackageTypeChanged, OnCurrentPackageTypeChanged);
            RegisterToReceiveMessages(MessageToken.PackageTypesChanged, OnPackageTypesChanged);
            RegisterToReceiveMessages(MessageToken.PackageTypesFilterExpressionChanged, OnPackageTypesFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            PackageTypes = new VirtualList <PackageType>(vloader);
            PackageTypes.LoadingStateChanged += PackageTypes_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(PackageTypes, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 12
0
        public OverShortDetailViewModel_AutoGen()
        {
            RegisterToReceiveMessages <OverShortDetail>(MessageToken.CurrentOverShortDetailChanged, OnCurrentOverShortDetailChanged);
            RegisterToReceiveMessages(MessageToken.OverShortDetailsChanged, OnOverShortDetailsChanged);
            RegisterToReceiveMessages(MessageToken.OverShortDetailsFilterExpressionChanged, OnOverShortDetailsFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            OverShortDetails = new VirtualList <OverShortDetail>(vloader);
            OverShortDetails.LoadingStateChanged += OverShortDetails_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(OverShortDetails, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 13
0
        public InventoryItemViewModel_AutoGen()
        {
            RegisterToReceiveMessages <InventoryItem>(MessageToken.CurrentInventoryItemChanged, OnCurrentInventoryItemChanged);
            RegisterToReceiveMessages(MessageToken.InventoryItemsChanged, OnInventoryItemsChanged);
            RegisterToReceiveMessages(MessageToken.InventoryItemsFilterExpressionChanged, OnInventoryItemsFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            InventoryItems = new VirtualList <InventoryItem>(vloader);
            InventoryItems.LoadingStateChanged += InventoryItems_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(InventoryItems, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 14
0
        public AsycudaDocumentViewModel_AutoGen()
        {
            RegisterToReceiveMessages <AsycudaDocument>(MessageToken.CurrentAsycudaDocumentChanged, OnCurrentAsycudaDocumentChanged);
            RegisterToReceiveMessages(MessageToken.AsycudaDocumentsChanged, OnAsycudaDocumentsChanged);
            RegisterToReceiveMessages(MessageToken.AsycudaDocumentsFilterExpressionChanged, OnAsycudaDocumentsFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            AsycudaDocuments = new VirtualList <AsycudaDocument>(vloader);
            AsycudaDocuments.LoadingStateChanged += AsycudaDocuments_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(AsycudaDocuments, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 15
0
        public Document_TypeViewModel_AutoGen()
        {
            RegisterToReceiveMessages <Document_Type>(MessageToken.CurrentDocument_TypeChanged, OnCurrentDocument_TypeChanged);
            RegisterToReceiveMessages(MessageToken.Document_TypeChanged, OnDocument_TypeChanged);
            RegisterToReceiveMessages(MessageToken.Document_TypeFilterExpressionChanged, OnDocument_TypeFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            Document_Type = new VirtualList <Document_Type>(vloader);
            Document_Type.LoadingStateChanged += Document_Type_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(Document_Type, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 16
0
        public EmptyFullCodeViewModel_AutoGen()
        {
            RegisterToReceiveMessages <EmptyFullCode>(MessageToken.CurrentEmptyFullCodeChanged, OnCurrentEmptyFullCodeChanged);
            RegisterToReceiveMessages(MessageToken.EmptyFullCodesChanged, OnEmptyFullCodesChanged);
            RegisterToReceiveMessages(MessageToken.EmptyFullCodesFilterExpressionChanged, OnEmptyFullCodesFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            EmptyFullCodes = new VirtualList <EmptyFullCode>(vloader);
            EmptyFullCodes.LoadingStateChanged += EmptyFullCodes_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(EmptyFullCodes, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 17
0
        private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
        {
            object commandForItem = null;

            if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
            {
                commandForItem = this.m_listContent[idx];
            }
            else if (((this.titles != null) && (idx >= 0)) && (idx < this.titles.Count))
            {
                OMLEngine.Title item = this.titles[idx] as OMLEngine.Title;
                if (item != null)
                {
                    commandForItem = this.GetCommandForItem(item);
                }
            }
            callbackItem(vlist, idx, commandForItem);
        }
Ejemplo n.º 18
0
        public SalesDataViewModel_AutoGen()
        {
            RegisterToReceiveMessages <SalesData>(MessageToken.CurrentSalesDataChanged, OnCurrentSalesDataChanged);
            RegisterToReceiveMessages(MessageToken.SalesDatasChanged, OnSalesDatasChanged);
            RegisterToReceiveMessages(MessageToken.SalesDatasFilterExpressionChanged, OnSalesDatasFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed
            RegisterToReceiveMessages <AsycudaDocument>(CoreEntities.MessageToken.CurrentAsycudaDocumentChanged, OnCurrentAsycudaDocumentChanged);


            SalesDatas = new VirtualList <SalesData>(vloader);
            SalesDatas.LoadingStateChanged += SalesDatas_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(SalesDatas, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 19
0
        private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
        {
            object commandForItem = null;

            if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
            {
                commandForItem = this.m_listContent[idx];
            }
            else if (((this.m_filters != null) && (idx >= 0)) && (idx < this.m_filters.Count))
            {
                UserFilter item = this.m_filters[idx] as UserFilter;
                if (item != null)
                {
                    commandForItem = this.GetCommandForItem(item);
                }
            }
            callbackItem(vlist, idx, commandForItem);
        }
        public ApplicationSettingsViewModel_AutoGen()
        {
            RegisterToReceiveMessages <ApplicationSettings>(MessageToken.CurrentApplicationSettingsChanged, OnCurrentApplicationSettingsChanged);
            RegisterToReceiveMessages(MessageToken.ApplicationSettingsChanged, OnApplicationSettingsChanged);
            RegisterToReceiveMessages(MessageToken.ApplicationSettingsFilterExpressionChanged, OnApplicationSettingsFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            ApplicationSettings = new VirtualList <ApplicationSettings>(vloader);
            ApplicationSettings.LoadingStateChanged += ApplicationSettings_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(ApplicationSettings, lockObject);

            vloader.FilterExpression = "All";
            OnCreated();
            OnTotals();
        }
        public TariffCategoryViewModel_AutoGen()
        {
            RegisterToReceiveMessages <TariffCategory>(MessageToken.CurrentTariffCategoryChanged, OnCurrentTariffCategoryChanged);
            RegisterToReceiveMessages(MessageToken.TariffCategoryChanged, OnTariffCategoryChanged);
            RegisterToReceiveMessages(MessageToken.TariffCategoryFilterExpressionChanged, OnTariffCategoryFilterExpressionChanged);


            // Recieve messages for Core Current Entities Changed


            TariffCategory = new VirtualList <TariffCategory>(vloader);
            TariffCategory.LoadingStateChanged += TariffCategory_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(TariffCategory, lockObject);

            vloader.FilterExpression = "All";
            OnCreated();
            OnTotals();
        }
        public xcuda_Supplementary_unitViewModel_AutoGen()
        {
            RegisterToReceiveMessages <xcuda_Supplementary_unit>(MessageToken.Currentxcuda_Supplementary_unitChanged, OnCurrentxcuda_Supplementary_unitChanged);
            RegisterToReceiveMessages(MessageToken.xcuda_Supplementary_unitChanged, Onxcuda_Supplementary_unitChanged);
            RegisterToReceiveMessages(MessageToken.xcuda_Supplementary_unitFilterExpressionChanged, Onxcuda_Supplementary_unitFilterExpressionChanged);


            RegisterToReceiveMessages <AsycudaDocumentItem>(MessageToken.CurrentAsycudaDocumentItemChanged, OnCurrentAsycudaDocumentItemChanged);

            // Recieve messages for Core Current Entities Changed


            xcuda_Supplementary_unit = new VirtualList <xcuda_Supplementary_unit>(vloader);
            xcuda_Supplementary_unit.LoadingStateChanged += xcuda_Supplementary_unit_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(xcuda_Supplementary_unit, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Create the gallery page for this exprience.
        /// NOTE: This is public to enable debug markup access.
        /// </summary>
        public GalleryPage CreateShowGalleryPage()
        {
            GalleryPage page = new GalleryPage();

            page.Description = Description;


            // Create the virtual list and enable slow data.
            VirtualList galleryList = new VirtualList(page, null);

            galleryList.EnableSlowDataRequests = true;
            galleryList.RequestSlowDataHandler = new RequestSlowDataHandler(CompleteShowGalleryItem);
            page.Content = galleryList;

            // Create and apply the filters.
            CreateShowGalleryFilters(page);

            return(page);
        }
Ejemplo n.º 24
0
        public SubItemsViewModel_AutoGen()
        {
            RegisterToReceiveMessages <SubItems>(MessageToken.CurrentSubItemsChanged, OnCurrentSubItemsChanged);
            RegisterToReceiveMessages(MessageToken.SubItemsChanged, OnSubItemsChanged);
            RegisterToReceiveMessages(MessageToken.SubItemsFilterExpressionChanged, OnSubItemsFilterExpressionChanged);


            RegisterToReceiveMessages <AsycudaDocumentItem>(MessageToken.CurrentAsycudaDocumentItemChanged, OnCurrentAsycudaDocumentItemChanged);

            // Recieve messages for Core Current Entities Changed


            SubItems = new VirtualList <SubItems>(vloader);
            SubItems.LoadingStateChanged += SubItems_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(SubItems, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 25
0
        public LicenceSummaryViewModel_AutoGen()
        {
            RegisterToReceiveMessages <LicenceSummary>(MessageToken.CurrentLicenceSummaryChanged, OnCurrentLicenceSummaryChanged);
            RegisterToReceiveMessages(MessageToken.LicenceSummaryChanged, OnLicenceSummaryChanged);
            RegisterToReceiveMessages(MessageToken.LicenceSummaryFilterExpressionChanged, OnLicenceSummaryFilterExpressionChanged);


            RegisterToReceiveMessages <AsycudaDocumentSetEx>(MessageToken.CurrentAsycudaDocumentSetExChanged, OnCurrentAsycudaDocumentSetExChanged);

            // Recieve messages for Core Current Entities Changed


            LicenceSummary = new VirtualList <LicenceSummary>(vloader);
            LicenceSummary.LoadingStateChanged += LicenceSummary_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(LicenceSummary, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Finishes any slow data for a gallery item.
        /// </summary>
        private void CompleteGalleryItem(VirtualList list, int index)
        {
            MovieItem item = (MovieItem)list[index];

            if (item.LoadedCover)
            {
                return;
            }

            //if (item.MenuCoverArt != MovieItem.NoCoverImage)
            //  return;

            Image image = null;

            // too many threads started, kills the system
            //Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(delegate
            //{
            try
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], load menu art", index, item.Name);
                string imageFile = OMLSettings.UseOriginalCoverArt
                    ? item.TitleObject.FrontCoverPath
                    : item.TitleObject.FrontCoverMenuPath;
                if (!string.IsNullOrEmpty(imageFile) && File.Exists(imageFile))
                {
                    image = GalleryItem.LoadImage(imageFile);
                }
            }
            catch (Exception e)
            {
                OMLApplication.DebugLine("[MovieGallery] Error: {0}\n    {1}", e.Message, e.StackTrace);
            }
            //}, delegate
            //{
            if (image != null)
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], set menu art", index, item.Name);
                item.MenuCoverArt = image;
                item.LoadedCover  = true;
            }
            //}, null);
        }
Ejemplo n.º 27
0
        public void RemoveAt()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 20, 1, 2
            };
            List <int> numbers2 = new List <int> {
                3, 4, 5
            };
            List <int> numbers3 = new List <int> {
                6, 21, 7, 8, 9
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);

            list.RemoveAt(1);
            list.RemoveAt(7);

            Assert.False(numbers1.Contains(20));
            Assert.False(numbers3.Contains(21));
        }
Ejemplo n.º 28
0
        public void RemoveIfDuplicate()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 7, 1, 2
            };
            List <int> numbers2 = new List <int> {
                3, 4, 5
            };
            List <int> numbers3 = new List <int> {
                6, 21, 7, 8, 9
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);

            list.Remove(7);
            list.Remove(21);

            Assert.False(numbers1.Contains(7));
            Assert.True(numbers3.Contains(7));
        }
        public PreviousItemsExViewModel_AutoGen()
        {
            RegisterToReceiveMessages <PreviousItemsEx>(MessageToken.CurrentPreviousItemsExChanged, OnCurrentPreviousItemsExChanged);
            RegisterToReceiveMessages(MessageToken.PreviousItemsExesChanged, OnPreviousItemsExesChanged);
            RegisterToReceiveMessages(MessageToken.PreviousItemsExesFilterExpressionChanged, OnPreviousItemsExesFilterExpressionChanged);


            RegisterToReceiveMessages <PreviousDocumentItem>(MessageToken.CurrentPreviousDocumentItemChanged, OnCurrentPreviousDocumentItemChanged);

            RegisterToReceiveMessages <PreviousDocumentItem>(MessageToken.CurrentPreviousDocumentItemChanged, OnCurrentAsycudaDocumentItemChanged);

            // Recieve messages for Core Current Entities Changed


            PreviousItemsExes = new VirtualList <PreviousItemsEx>(vloader);
            PreviousItemsExes.LoadingStateChanged += PreviousItemsExes_LoadingStateChanged;
            BindingOperations.EnableCollectionSynchronization(PreviousItemsExes, lockObject);

            OnCreated();
            OnTotals();
        }
Ejemplo n.º 30
0
        public void BasicFunctionalityTestWithSupplier()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 1, 2, 3
            };
            List <int> numbers2 = new List <int> {
                4, 5, 6
            };
            List <int> numbers3 = new List <int> {
                7, 8, 9, 10, 11
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);
            Assert.AreEqual(list.Count, 12);
            for (int i = 0; i < 12; i++)
            {
                Assert.AreEqual(list[i], i);
                Assert.AreEqual(list.IndexOf(i), i);
            }
        }
Ejemplo n.º 31
0
        public void AddItems()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 1, 2, 3
            };
            List <int> numbers2 = new List <int> {
                5, 6, 7
            };
            List <int> numbers3 = new List <int> {
                9, 10, 11, 12, 13
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);

            Assert.AreEqual(list.Count, 12);
            list.Add(14);

            Assert.AreEqual(list.Count, 13);
            Assert.AreEqual(list[12], 14);
        }
Ejemplo n.º 32
0
        public void CopyBig()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 1, 2
            };
            List <int> numbers2 = new List <int> {
                3, 4, 5
            };
            List <int> numbers3 = new List <int> {
                6, 7, 8, 9
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);

            int[] ints = new int[20];
            list.CopyTo(ints, 2);
            for (int i = 2; i < 12; i++)
            {
                Assert.AreEqual(ints[i], i - 2);
            }
        }
Ejemplo n.º 33
0
        public void RemoveItems()
        {
            VirtualList <int> list     = new VirtualList <int>();
            List <int>        numbers1 = new List <int> {
                0, 20, 1, 2
            };
            List <int> numbers2 = new List <int> {
                3, 4, 5
            };
            List <int> numbers3 = new List <int> {
                6, 21, 7, 8, 9
            };

            list.AddSuppliers(numbers1, numbers2, numbers3);

            list.Remove(20);
            list.Remove(21);

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(list[i], i);
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Create the main menu category entry for this experience.
        /// </summary>
        public override MenuCategory CreateMenuCategory()
        {
            MenuCategory category = new MenuCategory();

            category.Title = Description;

            //
            // Featured items
            //

            VirtualList items = new VirtualList(category, null);

            items.EnableSlowDataRequests = true;
            items.RequestSlowDataHandler = new RequestSlowDataHandler(CompleteGalleryItem);
            category.Items = items;

            DirectoryInfo directory = GetDirectory(MusicDirectory);

            if (directory != null)
            {
                PopulateGallery(category, items, directory);
            }


            //
            // Set up a handler for when this category is clicked.
            //

            category.Invoked += delegate(object sender, EventArgs args)
            {
                // Go to our root gallery page.
                GalleryPage page = CreateGalleryPage(MusicDirectory);
                Application.Current.GoToGallery(page);
            };

            return(category);
        }
Ejemplo n.º 35
0
 private void Search()
 {
     Total = LoadNextChunkOfProducts(0, 0).Total;
     Products = new VirtualList<Product>(LoadProducts, 100, 10);
     //if (Total > 0) {
     //    SelectedProduct = Products.First();
     //}
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Finishes any slow data for a gallery item.
        /// </summary>
        private void CompleteGalleryItem(VirtualList list, int index)
        {
            MovieItem item = (MovieItem)list[index];

            if (item.LoadedCover)
                return;

            //if (item.MenuCoverArt != MovieItem.NoCoverImage)
            //  return;

            Image image = null;

            // too many threads started, kills the system
            //Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(delegate
            //{
            try
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], load menu art", index, item.Name);
                string imageFile = OMLSettings.UseOriginalCoverArt
                    ? item.TitleObject.FrontCoverPath
                    : item.TitleObject.FrontCoverMenuPath;
                if (!string.IsNullOrEmpty(imageFile) && File.Exists(imageFile))
                    image = GalleryItem.LoadImage(imageFile);
            }
            catch (Exception e)
            {
                OMLApplication.DebugLine("[MovieGallery] Error: {0}\n    {1}", e.Message, e.StackTrace);
            }
            //}, delegate
            //{
            if (image != null)
            {
                // OMLApplication.DebugLine("[MovieGallery] CompleteGalleryItem [index: {0}, name: {1}], set menu art", index, item.Name);
                item.MenuCoverArt = image;
                item.LoadedCover = true;
            }
            //}, null);
        }
Ejemplo n.º 37
0
        //gotta remove this-fired only from actor invoke on movieitem
        public GalleryPage(System.Collections.Generic.IEnumerable<OMLEngine.Title> _titles, string galleryName)
            : this()
        {
            #region v3POC

            //SetPrimaryBackgroundImage();
            //OMLEngine.TitleCollection _titles = new OMLEngine.TitleCollection();
            //_titles.loadTitleCollection();
            //primaryBackgroundImage
            //this is temp to test controls
            OMLProperties properties = new OMLProperties();
            properties.Add("Application", OMLApplication.Current);
            //properties.Add("UISettings", new UISettings());
            //properties.Add("Settings", new Library.Settings());
            properties.Add("I18n", I18n.Instance);
            //v3 main gallery
            Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage();
            //description
            gallery.Description = galleryName;
            //size of the galleryitems
            //DEPRECATED
            //gallery.ItemSize = Library.Code.V3.GalleryItemSize.Small;

            gallery.Model = new Library.Code.V3.BrowseModel(gallery);
            //commands at top of screen
            gallery.Model.Commands = new ArrayListDataSet(gallery);

            //create the context menu
            //Library.Code.V3.ContextMenuData ctx = new Library.Code.V3.ContextMenuData();

            //create the settings cmd
            Library.Code.V3.ThumbnailCommand settingsCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            settingsCmd.Description = "settings";
            settingsCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings");
            settingsCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings_Dormant");
            settingsCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_BrowseCmd_Settings_Focus");
            //no invoke for now
            //settingsCmd.Invoked += new EventHandler(settingsCmd_Invoked);
            gallery.Model.Commands.Add(settingsCmd);

            //create the Search cmd
            Library.Code.V3.ThumbnailCommand searchCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            searchCmd.Description = "search";
            searchCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search");
            searchCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search_Dormant");
            searchCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Search_Focus");
            //searchCmd.Invoked += new EventHandler(searchCmd_Invoked);
            gallery.Model.Commands.Add(searchCmd);

            ////some ctx items
            //Library.Code.V3.ThumbnailCommand viewListCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            //viewListCmd.Description = "View List";
            ////viewListCmd.Invoked += new EventHandler(viewCmd_Invoked);

            //Library.Code.V3.ThumbnailCommand viewSmallCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            ////viewSmallCmd.Invoked += new EventHandler(viewCmd_Invoked);
            //viewSmallCmd.Description = "View Small";

            //Library.Code.V3.ThumbnailCommand viewLargeCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            ////viewLargeCmd.Invoked += new EventHandler(viewCmd_Invoked);

            //viewLargeCmd.Description = "View Large";

            //Library.Code.V3.ThumbnailCommand viewSettingsCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            ////viewSettingsCmd.Invoked += new EventHandler(this.SettingsHandler);
            //viewSettingsCmd.Description = "Settings";

            ////ctx.SharedItems.Add(viewLargeCmd);
            //ctx.SharedItems.Add(viewSmallCmd);
            //ctx.SharedItems.Add(viewListCmd);
            //ctx.SharedItems.Add(viewSettingsCmd);

            //Library.Code.V3.ThumbnailCommand viewMovieDetailsCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            //viewMovieDetailsCmd.Description = "Movie Details";

            //Library.Code.V3.ThumbnailCommand viewPlayCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            //viewPlayCmd.Description = "Play";

            //Library.Code.V3.ThumbnailCommand viewDeleteCmd = new Library.Code.V3.ThumbnailCommand(gallery);
            //viewDeleteCmd.Description = "Delete";

            //ctx.UniqueItems.Add(viewMovieDetailsCmd);
            //ctx.UniqueItems.Add(viewPlayCmd);
            //ctx.UniqueItems.Add(viewDeleteCmd);

            Command CommandContextPopOverlay = new Command();
            properties.Add("CommandContextPopOverlay", CommandContextPopOverlay);

            //properties.Add("MenuData", ctx);
            //gallery.ContextMenu = ctx;
            //the pivots
            gallery.Model.Pivots = new Choice(gallery, "desc", new ArrayListDataSet(gallery));

            //twoRowChangerData

            //#region oneRowChangerData
            //if (this.mediaChangers != null && this.mediaChangers.KnownDiscs.Count > 0)
            //{
            //    VirtualList changerGalleryList = new VirtualList(gallery, null);
            //    foreach (Library.Code.V3.DiscDataEx t in this.mediaChangers.KnownDiscs)
            //    {
            //        //galleryList.Add(this.CreateGalleryItem(t));
            //        if (t.DiscType == DiscType.MovieDvd)
            //            changerGalleryList.Add(new Library.Code.V3.DVDChangerItem(t, changerGalleryList));
            //    }

            //    Library.Code.V3.BrowsePivot changerPivot = new Library.Code.V3.BrowsePivot(gallery, "changer", "loading titles...", changerGalleryList);
            //    changerPivot.ContentLabel = "OML";
            //    changerPivot.SupportsJIL = true;
            //    changerPivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //    changerPivot.ContentItemTemplate = "oneRowGalleryItemPoster";
            //    changerPivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate;
            //    gallery.Model.Pivots.Options.Add(changerPivot);
            //}
            //#endregion oneRowChangerData

            //twoRowGalleryItemPoster
            #region oneRowGalleryItemPoster
            VirtualList galleryList = new VirtualList(gallery, null);
            foreach (OMLEngine.Title t in _titles)
            {
                //galleryList.Add(this.CreateGalleryItem(t));
                galleryList.Add(new Library.Code.V3.MovieItem(t, galleryList));
            }

            Library.Code.V3.BrowsePivot p = new Library.Code.V3.BrowsePivot(gallery, "one row", "loading titles...", galleryList);
            p.ContentLabel = galleryName;
            p.SupportsJIL = true;
            p.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            p.ContentItemTemplate = "oneRowGalleryItemPoster";
            p.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate;
            gallery.Model.Pivots.Options.Add(p);
            #endregion oneRowGalleryItemPoster

            ////twoRowGalleryItemPoster
            //#region twoRowGalleryItemPoster
            //VirtualList galleryListGenres = new VirtualList(gallery, null);
            //foreach (OMLEngine.Title t in _titles)
            //{
            //    galleryListGenres.Add(new Library.Code.V3.MovieItem(t, galleryListGenres));
            //}

            //Library.Code.V3.BrowsePivot p2 = new Library.Code.V3.BrowsePivot(gallery, "two row", "loading genres...", galleryListGenres);
            //p2.ContentLabel = galleryName;
            //p2.SupportsJIL = true;
            //p2.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //p2.ContentItemTemplate = "twoRowGalleryItemPoster";
            //p2.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate;
            //gallery.Model.Pivots.Options.Add(p2);
            //#endregion twoRowGalleryItemPoster

            ////ListViewItem
            //#region ListViewItem
            //VirtualList galleryListListViewItem = new VirtualList(gallery, null);
            //foreach (OMLEngine.Title t in _titles)
            //{
            //    galleryListListViewItem.Add(new Library.Code.V3.MovieItem(t, galleryListListViewItem));
            //}

            //Library.Code.V3.BrowsePivot p3 = new Library.Code.V3.BrowsePivot(gallery, "list", "loading genres...", galleryListListViewItem);
            //p3.ContentLabel = galleryName;
            //p3.SupportsJIL = true;
            //p3.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //p3.ContentItemTemplate = "ListViewItem";
            //p3.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate;
            //gallery.Model.Pivots.Options.Add(p3);
            //#endregion ListViewItem

            ////Grouped
            //#region Grouped

            //VirtualList groupedGalleryListListViewItem = new VirtualList(gallery, null);
            //int i = 1;
            //foreach (OMLEngine.Title t in _titles)
            //{
            //    i++;
            //    groupedGalleryListListViewItem.Add(new Library.Code.V3.MovieItem(t, groupedGalleryListListViewItem));
            //    if (i > 20)
            //        break;
            //}
            //Library.Code.V3.GalleryItem testtgenre = new Library.Code.V3.GalleryItem();
            //testtgenre.Description = "Comedy";
            //testtgenre.Metadata = "12 titles";
            //testtgenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_comedy");
            ////groupedGalleryListListViewItem.Add(testtgenre);

            //Library.Code.V3.BrowseGroup testGroup = new Library.Code.V3.BrowseGroup();//this, "Sample Group", groupedGalleryListListViewItem);
            //testGroup.Owner = gallery;
            //testGroup.Description = "Group 1";
            //testGroup.Metadata = "12 titles";
            //testGroup.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery");
            //testGroup.Content = groupedGalleryListListViewItem;
            //testGroup.ContentLabelTemplate = Library.Code.V3.BrowseGroup.StandardContentLabelTemplate;

            //VirtualList groupListView = new VirtualList(gallery, null);

            ////groupListView.Add(testtgenre);
            //groupListView.Add(testGroup);

            //VirtualList groupedGalleryListListViewItem2 = new VirtualList(gallery, null);

            //foreach (OMLEngine.Title t in _titles)
            //{
            //    i++;
            //    groupedGalleryListListViewItem2.Add(new Library.Code.V3.MovieItem(t, groupedGalleryListListViewItem2));
            //    if (i > 50)
            //        break;
            //}

            //Library.Code.V3.BrowseGroup testGroup2 = new Library.Code.V3.BrowseGroup();//this, "Sample Group", groupedGalleryListListViewItem);
            //testGroup2.Owner = gallery;
            //testGroup2.Description = "Group 2";
            //testGroup2.Metadata = "12 titles";
            //testGroup2.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery");
            //testGroup2.Content = groupedGalleryListListViewItem2;
            //testGroup2.ContentLabelTemplate = Library.Code.V3.BrowseGroup.StandardContentLabelTemplate;

            //groupListView.Add(testGroup2);

            //Library.Code.V3.BrowsePivot group1 = new Library.Code.V3.BrowsePivot(gallery, "group", "grouped...", groupListView);
            //group1.ContentLabel = galleryName;
            //group1.SupportsJIL = false;
            //group1.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //group1.ContentItemTemplate = "GalleryGroup";
            //group1.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate;

            //gallery.Model.Pivots.Options.Add(group1);
            //#endregion grouped

            ////Genres test
            //#region Genres
            //VirtualList galleryListthreeRowGalleryItemPoster = new VirtualList(gallery, null);
            //Library.Code.V3.GalleryItem actionAdventureGenre = new Library.Code.V3.GalleryItem();
            //actionAdventureGenre.Description = "Action/Adventure";
            //actionAdventureGenre.Metadata = "12 titles";
            //actionAdventureGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_actionadventure");
            //galleryListthreeRowGalleryItemPoster.Add(actionAdventureGenre);

            //Library.Code.V3.GalleryItem comedyGenre = new Library.Code.V3.GalleryItem();
            //comedyGenre.Description = "Comedy";
            //comedyGenre.Metadata = "12 titles";
            //comedyGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_comedy");
            //galleryListthreeRowGalleryItemPoster.Add(comedyGenre);

            //Library.Code.V3.GalleryItem documentaryGenre = new Library.Code.V3.GalleryItem();
            //documentaryGenre.Description = "Documentary";
            //documentaryGenre.Metadata = "12 titles";
            //documentaryGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_documentary");
            //galleryListthreeRowGalleryItemPoster.Add(documentaryGenre);

            //Library.Code.V3.GalleryItem dramaGenre = new Library.Code.V3.GalleryItem();
            //dramaGenre.Description = "Drama";
            //dramaGenre.Metadata = "12 titles";
            //dramaGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_drama");
            //galleryListthreeRowGalleryItemPoster.Add(dramaGenre);

            //Library.Code.V3.GalleryItem kidsFamilyGenre = new Library.Code.V3.GalleryItem();
            //kidsFamilyGenre.Description = "Kids/Family";
            //kidsFamilyGenre.Metadata = "12 titles";
            //kidsFamilyGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_kidsfamily");
            //galleryListthreeRowGalleryItemPoster.Add(kidsFamilyGenre);

            //Library.Code.V3.GalleryItem musicalGenre = new Library.Code.V3.GalleryItem();
            //musicalGenre.Description = "Musical";
            //musicalGenre.Metadata = "12 titles";
            //musicalGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_musical");
            //galleryListthreeRowGalleryItemPoster.Add(musicalGenre);

            //Library.Code.V3.GalleryItem mysteryGenre = new Library.Code.V3.GalleryItem();
            //mysteryGenre.Description = "Mystery";
            //mysteryGenre.Metadata = "12 titles";
            //mysteryGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_mystery");
            //galleryListthreeRowGalleryItemPoster.Add(mysteryGenre);

            //Library.Code.V3.GalleryItem otherGenre = new Library.Code.V3.GalleryItem();
            //otherGenre.Description = "Other";
            //otherGenre.Metadata = "12 titles";
            //otherGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_other");
            //galleryListthreeRowGalleryItemPoster.Add(otherGenre);

            //Library.Code.V3.GalleryItem romanceGenre = new Library.Code.V3.GalleryItem();
            //romanceGenre.Description = "Romance";
            //romanceGenre.Metadata = "12 titles";
            //romanceGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_romance");
            //galleryListthreeRowGalleryItemPoster.Add(romanceGenre);

            //Library.Code.V3.GalleryItem scienceFictionGenre = new Library.Code.V3.GalleryItem();
            //scienceFictionGenre.Description = "Science Fiction";
            //scienceFictionGenre.Metadata = "12 titles";
            //scienceFictionGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_sciencefiction");
            //galleryListthreeRowGalleryItemPoster.Add(scienceFictionGenre);

            //Library.Code.V3.GalleryItem westernGenre = new Library.Code.V3.GalleryItem();
            //westernGenre.Description = "Western";
            //westernGenre.Metadata = "12 titles";
            //westernGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_western");
            //galleryListthreeRowGalleryItemPoster.Add(westernGenre);

            //Library.Code.V3.GalleryItem noimageGenre = new Library.Code.V3.GalleryItem();
            //noimageGenre.Description = "No Image ergeg ergege egegeg";
            //noimageGenre.Metadata = "12 titles";
            //noimageGenre.DefaultImage = new Image("resx://Library/Library.Resources/Genre_Sample_noimagegenre");
            //galleryListthreeRowGalleryItemPoster.Add(noimageGenre);

            ////foreach (Title t in _titles)
            ////{
            ////    galleryListthreeRowGalleryItemPoster.Add(this.CreateGalleryItem(t));
            ////}

            //Library.Code.V3.BrowsePivot p4 = new Library.Code.V3.BrowsePivot(gallery, "genres", "loading genres...", galleryListthreeRowGalleryItemPoster);
            //p4.ContentLabel = galleryName;
            //p4.SupportsJIL = true;
            //p4.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //p4.ContentItemTemplate = "twoRowGalleryItemGenre";
            //p4.DetailTemplate = Library.Code.V3.BrowsePivot.StandardDetailTemplate;
            //gallery.Model.Pivots.Options.Add(p4);
            //#endregion Genres

            // add OML filters
            //System.Collections.Specialized.StringCollection filtersToShow =
            //    Properties.Settings.Default.MainFiltersToShow;

            //foreach (string filterName in filtersToShow)
            //{
            //    OMLEngine.TitleFilterType filterType = Filter.FilterStringToTitleType(filterName);
            //    Filter f = new Filter(null, filterType, null);//new MovieGallery()

            //    if (Filter.ShowFilterType(filterType))
            //    {

            //        ////IEnumerable<Title> titles = TitleCollectionManager.GetAllTitles();
            //        //IEnumerable<Title> titles;
            //        //if (filterType == TitleFilterType.DateAdded || filterType == TitleFilterType.VideoFormat)
            //        //{
            //        //    titles = TitleCollectionManager.GetAllTitles();
            //        //}
            //        //else
            //        //{
            //        //    titles = TitleCollectionManager.GetFilteredTitles(filterType, filterName);
            //        //}

            //        //VirtualList filteredGalleryList = new VirtualList(gallery, null);
            //        //foreach (Title t in titles)
            //        //{
            //        //    //galleryList.Add(this.CreateGalleryItem(t));
            //        //    filteredGalleryList.Add(new Library.Code.V3.MovieItem(t, filteredGalleryList));
            //        //}
            //        VirtualList filteredGalleryList = new VirtualList(gallery, null);
            //        System.Collections.Generic.IList<Library.GalleryItem> filteredTitles = f.GetGalleryItems();
            //        foreach (Library.GalleryItem item in filteredTitles)
            //        {
            //            filteredGalleryList.Add(new Library.Code.V3.MovieItem(item, filteredGalleryList));
            //        }

            //        Library.Code.V3.BrowsePivot filteredPivot = new Library.Code.V3.BrowsePivot(gallery, Filter.FilterTypeToString(filterType).ToLower(), "loading titles...", filteredGalleryList);
            //        filteredPivot.ContentLabel = "OML";
            //        filteredPivot.SupportsJIL = true;
            //        filteredPivot.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            //        filteredPivot.ContentItemTemplate = "ListViewItem";
            //        filteredPivot.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate;
            //        gallery.Model.Pivots.Options.Add(filteredPivot);
            //    }
            //}
            //end add OML filters
            //properties.Add("Gallery", new GalleryV2(properties, _titles));
            properties.Add("Page", gallery);

            Library.Code.V3.MovieDetailsSlideDeck deck = new Library.Code.V3.MovieDetailsSlideDeck();
            //Choice c = new Choice();
            VirtualList Options = new VirtualList();
            Library.Code.V3.SlideBlueprint bp = new Library.Code.V3.SlideBlueprint(@"resx://Library/Library.Resources/V3_Slide_Movie_Details_Synopsis", "Synopsis", DateTime.MinValue, DateTime.Now);
            Library.Code.V3.SlideBlueprint bp2 = new Library.Code.V3.SlideBlueprint(@"resx://Library/Library.Resources/V3_Slide_Movie_Details_Actions", "Actions", DateTime.MinValue, DateTime.Now);
            Options.Add(bp);
            Options.Add(bp2);
            deck.Options = Options;
            deck.Commands = new ArrayListDataSet();

            //dummy up some cmds
            Library.Code.V3.ThumbnailCommand deleteCmd = new Library.Code.V3.ThumbnailCommand(deck);
            deleteCmd.Description = "Delete";
            deleteCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove");
            deleteCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove_Dormant");
            deleteCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Remove_Focus");
            deck.Commands.Add(deleteCmd);

            Library.Code.V3.ThumbnailCommand playCmd = new Library.Code.V3.ThumbnailCommand(deck);
            playCmd.Description = "Play";
            playCmd.DefaultImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play");
            playCmd.DormantImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play_Dormant");
            playCmd.FocusImage = new Image("resx://Library/Library.Resources/V3_Controls_Common_Browse_Cmd_Play_Focus");
            deck.Commands.Add(playCmd);

            deck.Description = "descrip";
            deck.Synopsis = "this is a syn adfge rh rhyr yhyr hr hr ge ge gtwt rgwe tgew gr ewg weg ewg wetg wrt g rhtytjuhytgfr er gtwrt her  etju ktjy hgt efr erfgetw";
            deck.AdditionalCommands = new ArrayListDataSet();
            deck.CommandPopOverlay = new Command();
            //deck.CommandPopOverlay.Invoked += new EventHandler(CommandPopOverlay_Invoked);
            deck.CommandClearOverlays = new Command();
            //deck.CommandClearOverlays.Invoked += new EventHandler(CommandClearOverlays_Invoked);
            deck.CommandPushOverlay = new Command();
            //deck.CommandPushOverlay.Invoked += new EventHandler(CommandPushOverlay_Invoked);

            //deck.AdditionalCommands.Add(cmd);
            properties.Add("SlideDeck", deck);
            properties.Add("CommandPopOverlay", deck.CommandPopOverlay);
            properties.Add("CommandClearOverlays", deck.CommandClearOverlays);
            properties.Add("CommandPushOverlay", deck.CommandPushOverlay);

            deck.Context = "hi";
            //_session.GoToPage(@"resx://Library/Library.Resources/V3_SlideDeck_Movie_Details", properties);

            //gallery.Model.Pivots.Chosen = p2;
            //gallery.Model.Pivots.ChosenChanged += new EventHandler(Pivots_ChosenChanged);
            OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties);
            //_page = gallery;
            //_deck = deck;

            #endregion v3POC
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Finishes any slow data for a gallery item.
        /// </summary>
        private void CompleteGalleryItem(VirtualList list, int index)
        {
            ThumbnailCommand item = (ThumbnailCommand)list[index];

            // This is where we would load a thumbnail for this item.
        }
 internal virtual void OnVirtualListPageRestarted( VirtualList virtualList, VirtualPage page )
 {
   Debug.Assert( m_managedLists.Contains( virtualList ) );
   Debug.Assert( m_pageNodes.Contains( page ) );
   this.RemovePage( page );
 }
    internal virtual void OnVirtualListRestarted( VirtualList virtualList )
    {
      Debug.Assert( m_managedLists.Contains( virtualList ) );

      Debug.Assert( this.RestartingManager, "Until CollectionViewGroups can be virtualized, we should not be restarting a leaf list on its own." );

      if( this.RestartingManager )
        m_restartingListsCount--;

      // Make sure that no page nodes belonging to this virtual 
      // list are left in the linked list. Remove all remaining ones
      // since after the manager is restarted, its content is 
      // completely cleared
      LinkedListNode<VirtualPage> pageNode = m_pageNodes.Last;
      while( pageNode != null )
      {
        LinkedListNode<VirtualPage> previousNode = pageNode.Previous;

        if( pageNode.Value.ParentVirtualList == virtualList )
          throw new DataGridInternalException( "A VirtualPage was not remove from its parent VirtualList after it is restarted" );

        pageNode = previousNode;
      }

      this.IncrementVersion();

      // If the manager is restarting, no page left and no more list restarting
      if( this.RestartingManager
          && ( m_pageNodes.Count == 0 )
          && ( m_restartingListsCount == 0 ) )
      {
        this.EndRestart();
      }
    }
 protected abstract int OnQueryItemCountCore( VirtualList virtualList );
Ejemplo n.º 42
0
        public void TestVirtualListSimple2()
        {
            var v = new VirtualList<int>(false);

            v.Insert(2, 100);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 0, 100 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 100 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));

            v.Insert(2, 200);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 0, 200, 100 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 200, 100 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2, 3 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 2, 3 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0, 1 }));

            v.RemoveAt(2);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 0, 100 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 100 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));

            v.RemoveAt(0);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 100 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 100 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 1 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));
        }
Ejemplo n.º 43
0
        public void TestVirtualListSimple3()
        {
            var v = new VirtualList<int>(false, new[] { 1, 2, 3 });

            v.Add(0);

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 1, 2, 3, 0 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 1, 2, 3, 0 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2, 3 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2, 3 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0, 1, 2, 3 }));

            v.Remove(2);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 1, 3, 0 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 1, 3, 0 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0, 1, 2 }));
        }
Ejemplo n.º 44
0
        public void TestVirtualListSimple4()
        {
            var v = new VirtualList<int>(false);

            v.Add(0);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));

            v.RemoveAt(0);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new int[0]));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new int[0]));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new int[0]));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new int[0]));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new int[0]));
        }
Ejemplo n.º 45
0
        private void InitializeListCount(VirtualList vlist)
        {
            this.IsBusy = true;

            Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.loadBackground), null, new TimeSpan(1));
        }
Ejemplo n.º 46
0
        public void TestVirtualListSimple5()
        {
            var v = new VirtualList<int>(false);

            v.Insert(0, 1);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 1 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 1 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));

            v.Insert(1, 2);
            v.Check();
            v.RemoveAt(0);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 2 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 2 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));

            v[0] = 3;
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 3 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 3 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0 }));
        }
Ejemplo n.º 47
0
 private void GetItem(VirtualList vlist, int idx, ItemRequestCallback callbackItem)
 {
     object commandForItem = null;
     if (((VirtualList)this.m_listContent).IsItemAvailable(idx))
     {
         commandForItem = this.m_listContent[idx];
     }
     else if (((this.m_filters != null) && (idx >= 0)) && (idx < this.m_filters.Count))
     {
         UserFilter item = this.m_filters[idx] as UserFilter;
         if (item != null)
         {
             commandForItem = this.GetCommandForItem(item);
         }
     }
     callbackItem(vlist, idx, commandForItem);
 }
    private VirtualList CreateNewVirtualList()
    {
      Debug.Assert( m_isBottomLevel );

      DataGridVirtualizingCollectionViewBase collectionView = this.GetCollectionView();

      DataGridPageManagerBase virtualPageManagerBase = collectionView.RootGroup.GetVirtualPageManager();

      VirtualList virtualItemList = new VirtualList( virtualPageManagerBase, m_virtualItemCount );
      virtualPageManagerBase.LinkVirtualListAndCollectionViewGroup( virtualItemList, this );

      return virtualItemList;
    }
 protected internal virtual int OnQueryItemCount( VirtualList virtualList )
 {
   return this.OnQueryItemCountCore( virtualList );
 }
Ejemplo n.º 50
0
        private void InitializeListCount(VirtualList vlist)
        {
            this.IsBusy = true;

            Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.loadBackground), null, new TimeSpan(1));
        }
    internal virtual void OnVirtualListRestarting( VirtualList virtualList )
    {
      Debug.Assert( m_managedLists.Contains( virtualList ) );

      Debug.Assert( this.RestartingManager, "Until CollectionViewGroups can be virtualized, we should not be restarting a leaf list on its own." );
    }
Ejemplo n.º 52
0
 public CreateMatchViewModel()
 {
     _provider = new TeamDataProvider();
     HomeTeams = new VirtualList <VirtualListItem>(_provider, 20);
     AwayTeams = new VirtualList <VirtualListItem>(_provider, 20);
 }
    internal virtual void OnVirtualListPageRestarting( VirtualList virtualList, VirtualPage page )
    {
      Debug.Assert( m_managedLists.Contains( virtualList ) );

      LinkedListNode<VirtualPage> pageNode = m_pageNodes.Find( page );

      Debug.Assert( pageNode != null );

      // RemovePageNode takes care of either raising the AbortQueryData event or aborting the QueryData Dispatcher Operation altogether.
      // It also takes care of raising the CommitVirtualData event for loaded pages which contains modified data.
      this.QueueCommitDataOrAbortIfRequired( pageNode, false );
    }
Ejemplo n.º 54
0
        public void TestVirtualListSimple1()
        {
            var v = new VirtualList<int>(false);

            v.Insert(0, 0);
            v.Check();
            v.Insert(5, 1);
            v.Check();
            v.Insert(10, 2);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 0, 1, 2 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 5, 10 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0, 1, 2 }));

            v.Insert(2, 3);
            v.Check();

            Assert.IsTrue(v.ToArray().SequenceEqual(new[] { 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 2 }));
            Assert.IsTrue(v.Dense.ToArray().SequenceEqual(new[] { 0, 3, 1, 2 }));
            Assert.IsTrue(v.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.Index).SequenceEqual(new[] { 0, 2, 6, 11 }));
            Assert.IsTrue(v.Dense.Nodes.Select(n => n.DenseIndex).SequenceEqual(new[] { 0, 1, 2, 3 }));
        }
    internal void ManageList( VirtualList virtualList )
    {
      Debug.Assert( !m_managedLists.Contains( virtualList ) );
      Debug.Assert( virtualList.VirtualPagingManager == null );

      virtualList.VirtualPagingManager = this;

      this.m_managedLists.Add( virtualList );
    }
Ejemplo n.º 56
0
        private void Initialize(IEnumerable<Title> titles)
        {
            DateTime start = DateTime.Now;

            _jumpInListText = new EditableText(this);
            _jumpInListText.Value = String.Empty;

            //FocusedItem = new GalleryItem(this, "", "", null);
            _categoryChoice = new Choice(this, "Categories");
            //CreateCategories();
            _moviesVirtualList = new VirtualList(this, null);

            //CreateSortLookup();

            if (_sortFunctionLookup.ContainsKey(OMLSettings.MovieSort))
                _currentSort = _sortFunctionLookup[OMLSettings.MovieSort];
            else
                _currentSort = SortByNameAscending;

            //SetupAlphaCharacters();

            LoadMovies(titles);
            OMLApplication.DebugLine("[MovieGallery] Initialize: time: {0}, items: {1}", DateTime.Now - start, this._movies.Count);
        }
Ejemplo n.º 57
0
        private void CreateVirtualList()
        {
            _moviesVirtualList = new VirtualList(this, null);

            foreach (MovieItem m in _movies)
            {
                _moviesVirtualList.Add(m);
            }
            _moviesVirtualList.EnableSlowDataRequests = true;
            _moviesVirtualList.RequestSlowDataHandler = new RequestSlowDataHandler(CompleteGalleryItem);
        }
Ejemplo n.º 58
0
 public void Init(VirtualList list)
 {
     CurList = list;
     SizeY   = curRectTransform.rect.height;
     SizeX   = curRectTransform.rect.width;
 }