public ReplicationConflictsModel()
        {
            ConflictedFiles =
                new VirtualCollection<ConflictItem>(new ConflictedFilesCollectionSource(), 30, 30);

            SelectedItems = new ItemSelection<VirtualItem<ConflictItem>>();
        }
		public FilesPageModel()
		{
            filesSource = new FileSystemCollectionSource();
            Files = new VirtualCollection<FileSystemModel>(filesSource, DefaultPageSize, DefaultCacheSize);
            SelectedFile = new Observable<VirtualItem<FileSystemModel>>();
            CurrentFolder = new Observable<string>() { Value = "/"};
            CurrentFolder.PropertyChanged += delegate
                                                 {
                                                     filesSource.CurrentFolder = CurrentFolder.Value;
                                                     UpdateBreadCrumbs();
                                                     ApplicationModel.Current.Client.Notifications.FolderChanges(
                                                         CurrentFolder.Value)
                                                         .TakeUntil(Unloaded.Amb(CurrentFolder.ObserveChanged().Select(_ => Unit.Default)))
                                                         .SampleResponsive(TimeSpan.FromSeconds(1))
                                                         .ObserveOn(DispatcherScheduler.Instance)
                                                         .Subscribe(_ => Files.Refresh(RefreshMode.PermitStaleDataWhilstRefreshing));
                                                 };

            SearchPattern = new Observable<string>() { Value=""};
		    SearchPattern.ObserveChanged().Throttle(TimeSpan.FromSeconds(1)).Where(SearchPatternIsValid).Subscribe(value => filesSource.SearchPattern = value);
            SelectedItems = new ItemSelection<VirtualItem<FileSystemModel>>();

            IsSearchVisible = new Observable<bool>();

            BreadcrumbTrail = new ObservableCollection<DirectoryModel>();
		}
 public DataGridAsyncViewModel([NotNull] VirtualCollection itemsProvider)
 {
     if (itemsProvider == null)
     {
         throw new ArgumentNullException(nameof(itemsProvider));
     }
     ItemsProvider = itemsProvider;
 }
 public SynchronizationActivityModel()
 {
     OutgoingQueue = new VirtualCollection<SynchronizationDetails>(new OutgoingSynchronizationQueueCollectionSource(), 25, 3, 
         new KeysComparer<SynchronizationDetails>(d => d.DestinationUrl + "/" + d.FileName));
     IncomingItems =
         new VirtualCollection<SynchronizationReport>(
             new IncomingCompletedSynchronizationTasksCollectionSource(), 25, 4);
 }
 public ConfigurationPageModel()
 {
     var configurationsCollectionSource = new ConfigurationsCollectionSource();
     Configurations = new VirtualCollection<ConfigurationModel>(configurationsCollectionSource, 30, 10);
     SelectedItems = new ItemSelection<VirtualItem<ConfigurationModel>>();
     IsSearchVisible = new Observable<bool>();
     SearchPattern = new Observable<string>() { Value = "" };
     SearchPattern.ObserveChanged().Throttle(TimeSpan.FromSeconds(1)).Subscribe(value => configurationsCollectionSource.Prefix = value);
 }
        public MainViewModel()
        {
            _source = new NorthwindOrderSource();
            Items = new VirtualCollection<Order>(_source, pageSize: 20, cachedPages: 5);

            this.ObservePropertyChanged(() => Search)
                .Throttle(TimeSpan.FromSeconds(0.25))
                .ObserveOnDispatcher()
                .Subscribe(_ => _source.Search = Search);
        }
        public SearchPageModel()
        {
            resultsSource = new SearchResultsCollectionSource();
            resultsSource.SearchError += HandleSearchError;
            Results = new VirtualCollection<FileSystemModel>(resultsSource, 50, 10);
            Query = new Observable<string>();
            SelectedFile = new Observable<VirtualItem<FileSystemModel>>();
            SelectedItems = new ItemSelection<VirtualItem<FileSystemModel>>();
            SearchErrorMessage = new Observable<string>();
            IsErrorVisible = new Observable<bool>();

        }
        public MainViewModel()
        {
            _source = new NetflixTitlesSource();
            Items   = new VirtualCollection <Title>(_source, pageSize: 20, cachedPages: 5);

            this.ObservePropertyChanged(() => Search)
            .Throttle(TimeSpan.FromSeconds(0.25))
            .ObserveOnDispatcher()
            .Subscribe(_ => _source.Search = Search);

            DisplayStyle = "Details";
        }
Esempio n. 9
0
        public DocumentsModel(DocumentsVirtualCollectionSourceBase collectionSource)
        {
            Documents = new VirtualCollection<ViewableDocument>(collectionSource, 30, 30, new KeysComparer<ViewableDocument>(v => v.Id ?? v.DisplayId, v => v.LastModified, v => v.MetadataOnly));
            Documents.PropertyChanged += HandleDocumentsPropertyChanged;

            collectionSource.CollectionChanged += delegate { HandleCollectionRefreshed(); };
            updateColumnsSamplingInvoker = new SamplingInvoker(TimeSpan.FromSeconds(1));
            Documents.ItemsRealized += (sender, e) => HandleItemsRealized(e.StartingIndex, e.Count);

            ItemSelection = new ItemSelection<VirtualItem<ViewableDocument>>();
            DocumentsHaveId = true;

            Context = "Default";
        }
Esempio n. 10
0
        public void Select_Single(int index)
        {
            var collection       = new VirtualCollection(10);
            var selection        = new AsyncDataGridRowSelection(collection);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.Select(index);

            Assert.Equal(R(index), selection.GetSnapshot());
            Assert.Equal(index, collection.FocusIndex);
            Assert.Equal(1, selectionChanged);
        }
Esempio n. 11
0
        public DocumentsModel(DocumentsVirtualCollectionSourceBase collectionSource)
        {
            Documents = new VirtualCollection <ViewableDocument>(collectionSource, 30, 30, new KeysComparer <ViewableDocument>(v => v.Id ?? v.DisplayId, v => v.LastModified, v => v.MetadataOnly));
            Documents.PropertyChanged += HandleDocumentsPropertyChanged;

            collectionSource.CollectionChanged += delegate { HandleCollectionRefreshed(); };
            updateColumnsSamplingInvoker        = new SamplingInvoker(TimeSpan.FromSeconds(1));
            Documents.ItemsRealized            += (sender, e) => HandleItemsRealized(e.StartingIndex, e.Count);

            ItemSelection   = new ItemSelection <VirtualItem <ViewableDocument> >();
            DocumentsHaveId = true;

            Context = "Default";
        }
Esempio n. 12
0
        public DocumentsModel(DocumentsVirtualCollectionSourceBase collectionSource)
        {
            Documents = new VirtualCollection<ViewableDocument>(collectionSource, 30, 30, new KeysComparer<ViewableDocument>(v => v.Id ?? v.DisplayId, v => v.LastModified, v => v.MetadataOnly));
            Documents.PropertyChanged += HandleDocumentsPropertyChanged;

            Observable.FromEventPattern<ItemsRealizedEventArgs>(h => Documents.ItemsRealized += h,
                                                                h => Documents.ItemsRealized -= h)
                .SampleResponsive(TimeSpan.FromSeconds(1))
                .ObserveOnDispatcher()
                .Subscribe(e => HandleItemsRealized(e.Sender, e.EventArgs));

            ItemSelection = new ItemSelection<VirtualItem<ViewableDocument>>();

            Context = "Default";
        }
Esempio n. 13
0
        public DocumentsModel(DocumentsVirtualCollectionSourceBase collectionSource)
        {
            Documents = new VirtualCollection <ViewableDocument>(collectionSource, 30, 30, new KeysComparer <ViewableDocument>(v => v.Id ?? v.DisplayId, v => v.LastModified, v => v.MetadataOnly));
            Documents.PropertyChanged += HandleDocumentsPropertyChanged;

            Observable.FromEventPattern <ItemsRealizedEventArgs>(h => Documents.ItemsRealized += h,
                                                                 h => Documents.ItemsRealized -= h)
            .SampleResponsive(TimeSpan.FromSeconds(1))
            .ObserveOnDispatcher()
            .Subscribe(e => HandleItemsRealized(e.Sender, e.EventArgs));

            ItemSelection = new ItemSelection <VirtualItem <ViewableDocument> >();

            Context = "Default";
        }
Esempio n. 14
0
        public void SelectAll(int size)
        {
            var collection       = new VirtualCollection(size);
            var selection        = new AsyncDataGridRowSelection(collection);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;
            collection.FocusIndex       = 3;

            selection.SelectAll();

            Assert.Equal(R(0, size), selection.GetSnapshot());
            Assert.Equal(3, collection.FocusIndex);
            Assert.Equal(1, selectionChanged);
        }
Esempio n. 15
0
        public void Select_Multiple_NoExtend()
        {
            var collection       = new VirtualCollection(10);
            var selection        = new AsyncDataGridRowSelection(collection);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.Select(1);
            selection.Select(2);

            Assert.Equal(R(2), selection.GetSnapshot());
            Assert.Equal(2, collection.FocusIndex);
            Assert.Equal(2, selectionChanged);
        }
Esempio n. 16
0
        public void Select_IgnoresOutOfRange()
        {
            var collection       = new VirtualCollection(10);
            var selection        = new AsyncDataGridRowSelection(collection);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;
            collection.FocusIndex       = 3;

            selection.Select(10);

            Assert.Equal(new MultiRange(), selection.GetSnapshot());
            Assert.Equal(3, collection.FocusIndex);
            Assert.Equal(0, selectionChanged);
        }
Esempio n. 17
0
        public void SelectRange_NonEmpty()
        {
            var collection = new VirtualCollection(10);
            var selection  = new AsyncDataGridRowSelection(collection);

            selection.Select(5);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.SelectRange(2, 5);

            Assert.Equal(R(2, 6), selection.GetSnapshot());
            Assert.Equal(5, collection.FocusIndex);
            Assert.Equal(1, selectionChanged);
        }
Esempio n. 18
0
        public void SelectRange_Extend()
        {
            var collection = new VirtualCollection(10);
            var selection  = new AsyncDataGridRowSelection(collection);

            selection.Select(7);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.SelectRange(2, 5, true);

            Assert.Equal(R(2, 6, 7, 8), selection.GetSnapshot());
            Assert.Equal(7, collection.FocusIndex);
            Assert.Equal(1, selectionChanged);
        }
Esempio n. 19
0
        public void ToggleSingle_Extend()
        {
            var collection = new VirtualCollection(10);
            var selection  = new AsyncDataGridRowSelection(collection);

            selection.Select(5);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.ToggleSingle(2, true);
            selection.ToggleSingle(3, true);

            Assert.Equal(R(2, 4, 5, 6), selection.GetSnapshot());
            Assert.Equal(3, collection.FocusIndex);
            Assert.Equal(2, selectionChanged);
        }
Esempio n. 20
0
        public void ToggleExtent_ExtendForward()
        {
            var collection = new VirtualCollection(10);
            var selection  = new AsyncDataGridRowSelection(collection);

            selection.Select(1);
            selection.ToggleSingle(3, true);
            int selectionChanged = 0;

            selection.SelectionChanged += (s, e) => ++ selectionChanged;

            selection.ToggleExtent(5, true);

            Assert.Equal(R(1, 2, 3, 6), selection.GetSnapshot());
            Assert.Equal(5, collection.FocusIndex);
            Assert.Equal(1, selectionChanged);
        }
 public VirtualListCollectionView(VirtualCollection collection)
     : base(collection)
 {
     m_collection = collection;
 }
Esempio n. 22
0
 // Root constructor
 internal MetaType(Pointer <MethodTable> mt) : base(mt)
 {
     RuntimeType = Runtime.ResolveType(mt.Cast());
     Fields      = new VirtualCollection <MetaField>(GetField, GetFields);
     Methods     = new VirtualCollection <MetaMethod>(GetMethod, GetMethods);
 }
Esempio n. 23
0
        protected override Size MeasureOverride(Size availableSize)
        {
            int itemIndex, childIndex;
            VirtualListBoxItem item;
            int delta;
            int visibleItemsCount;
            int maxItemIndex;



            visibleItemsCount = GetRowsCount(availableSize.Height);
            itemIndex         = (int)(VerticalOffset / ItemsHeight);

            if (VirtualCollection == null)
            {
                maxItemIndex = -1;
            }
            else
            {
                maxItemIndex = itemIndex + visibleItemsCount - 1;
                if (maxItemIndex >= ItemsCount)
                {
                    maxItemIndex = ItemsCount - 1;
                }
            }

            if (itemIndex >= FirstItemIndex)
            {
                // remove children that are above top
                delta = itemIndex - FirstItemIndex;
                RemoveInternalChildRange(0, delta);

                // measure already created children
                childIndex = 0;
                while ((itemIndex < ItemsCount) && (childIndex < Children.Count) && (itemIndex <= maxItemIndex))
                {
                    item = (VirtualListBoxItem)Children[childIndex];
                    item.Measure(new Size(availableSize.Width, ItemsHeight));
                    itemIndex++; childIndex++;
                }
                // create and measure new children is needed
                while ((itemIndex < ItemsCount) && (itemIndex <= maxItemIndex))
                {
                    item = OnCreateChildItem(VirtualCollection.GetItem(itemIndex), itemIndex);
                    AddInternalChild(item);
                    if (item.IsSelected)
                    {
                        item.Focus();
                    }
                    item.Measure(new Size(availableSize.Width, ItemsHeight));
                    itemIndex++; childIndex++;
                }
                // remove children that are below bottom
                delta = Children.Count - childIndex;
                RemoveInternalChildRange(childIndex, delta);
            }
            else
            {
                // create and measure new children is needed
                childIndex = 0;
                while ((itemIndex < ItemsCount) && (itemIndex < FirstItemIndex) && (itemIndex <= maxItemIndex))
                {
                    item = OnCreateChildItem(VirtualCollection.GetItem(itemIndex), itemIndex);
                    InsertInternalChild(childIndex, item);
                    if (item.IsSelected)
                    {
                        item.Focus();
                    }
                    item.Measure(new Size(availableSize.Width, availableSize.Height));
                    itemIndex++; childIndex++;
                }
                // measure already created children
                while ((itemIndex < ItemsCount) && (childIndex < Children.Count) && (itemIndex <= maxItemIndex))
                {
                    item = (VirtualListBoxItem)Children[childIndex];
                    item.Measure(new Size(availableSize.Width, availableSize.Height));
                    itemIndex++; childIndex++;
                }
                // remove children that are below bottom
                delta = Children.Count - childIndex;
                RemoveInternalChildRange(childIndex, delta);
            }


            FirstItemIndex = (int)(VerticalOffset / ItemsHeight);
            ViewportHeight = visibleItemsCount * ItemsHeight;
            ViewportWidth  = availableSize.Width;
            SetVerticalOffset(VerticalOffset);              // in order to adjust position when sizing control height
            SetHorizontalOffset(HorizontalOffset);          // in order to adjust position when sizing control width

            return(availableSize);
        }
Esempio n. 24
0
 public ConflictsModel()
 {
     ConflictDocuments = new VirtualCollection<ViewableDocument>(new ConflictDocumentsCollectionSource(), 30, 30);
     ItemSelection = new ItemSelection<VirtualItem<ViewableDocument>>();
 }
Esempio n. 25
0
 public ConflictsModel()
 {
     ConflictDocuments = new VirtualCollection <ViewableDocument>(new ConflictDocumentsCollectionSource(), 30, 30);
     ItemSelection     = new ItemSelection <VirtualItem <ViewableDocument> >();
 }