public void ShouldReadPages() { const int ItemsCount = 101; const int PageSize = 10; const int ExpectedPages = 11; Mock <IItemsProvider <string> > itemsProviderMock = new Mock <IItemsProvider <string> >(); itemsProviderMock.Setup(p => p.GetCount()).Returns(ItemsCount); IList <string> vc = new VirtualizingCollection <string>(itemsProviderMock.Object, PageSize); int count = 0; foreach (var s in vc) { count++; } Assert.AreEqual(ItemsCount, count); Assert.AreEqual(ItemsCount, vc.Count); for (int i = 0; i < ExpectedPages; i++) { itemsProviderMock.Verify(p => p.GetRange(i * PageSize, PageSize), Times.Once()); } }
public VirtualDataCollection(IItemsProvider<IFreeDocument> data, int pageTimeout = 30000) : base() { VirtualData = new VirtualizingCollection<IFreeDocument>(data,pageTimeout); data.AlreadyGetSize += (s, e) => OnPropertyChanged("Count"); }
ListValuesProvider CreateListValuesProvider(ICSharpCode.NRefactory.Ast.Expression targetObject, DebugType iListType, DebugType listItemType) { var listValuesProvider = new ListValuesProvider(targetObject, iListType, listItemType); var virtCollection = new VirtualizingCollection <ObjectValue>(listValuesProvider); this.listView.ItemsSource = virtCollection; return(listValuesProvider); }
public OldMainPageViewModel() { People = new VirtualizingCollection <PersonInfoViewModel>(HasMoreItems, LoadMoreItems); GenerateDummyData(); ShowMessageCommand = new DelegateCommand <object>(ShowMessageAction); ContextMenuItems = ContextMenuItemsDelegate; }
public OldMainPageViewModel() { People = new VirtualizingCollection<PersonInfoViewModel>(HasMoreItems, LoadMoreItems); GenerateDummyData(); ShowMessageCommand = new DelegateCommand<object>(ShowMessageAction); ContextMenuItems = ContextMenuItemsDelegate; }
public void InicializedFilteringAndSortingDataSource() { HttpResponcesList = new VirtualizingCollection <HttpResponce>( _filteringAndSortingHttpResponcesDataSource, ListPageSize, ListPageTimeout); _filteringAndSortingHttpResponcesDataSource.FetchRangeCommand(0, ListPageSize); OnPropertyChanged("HttpResponcesList"); }
public void InicializedItemsChangingDataSource() { HttpResponcesList = new VirtualizingCollection <HttpResponce>( _itemsChangingHttpResponceDataSource, ListPageSize, ListPageTimeout); _itemsChangingHttpResponceDataSource.FetchRangeCommand(0, ListPageSize); OnPropertyChanged("HttpResponcesList"); }
private void CreateNewItemsSource() { var pageTimeout = TimeSpan.FromSeconds(0.2); if (this.virtualizingPdfPages != null) this.virtualizingPdfPages.CleanUpAllPages(); this.virtualizingPdfPages = new AsyncVirtualizingCollection<IEnumerable<PdfImage>>(this.imageProvider, this.parent.GetPagesPerRow(), pageTimeout); this.itemsControl.ItemsSource = this.virtualizingPdfPages; }
private void CreateNewItemsSource() { var pageTimeout = TimeSpan.FromSeconds(2); if (this.virtualizingPdfPages != null) { this.virtualizingPdfPages.CleanUpAllPages(); } this.virtualizingPdfPages = new AsyncVirtualizingCollection <IEnumerable <PdfImage> >(this.imageProvider, this.parent.GetPagesPerRow(), pageTimeout); this.itemsControl.ItemsSource = this.virtualizingPdfPages; }
public void Unload() { scrollViewer.Visibility = Visibility.Collapsed; scrollViewer.ScrollToHorizontalOffset(0); scrollViewer.ScrollToVerticalOffset(0); imageProvider = null; if (virtualizingPdfPages != null) { virtualizingPdfPages.CleanUpAllPages(); virtualizingPdfPages = null; } itemsControl.ItemsSource = null; }
public void Unload() { this.scrollViewer.Visibility = System.Windows.Visibility.Collapsed; this.scrollViewer.ScrollToHorizontalOffset(0); this.scrollViewer.ScrollToVerticalOffset(0); this.imageProvider = null; if (this.virtualizingPdfPages != null) { this.virtualizingPdfPages.CleanUpAllPages(); this.virtualizingPdfPages = null; } this.itemsControl.ItemsSource = null; }
public async void OnNavigatedTo(NavigationContext navigationContext) { if (Produtos == null) { Produtos = new VirtualizingCollection <ProdutoLookupWrapper>( _paginacaoRepository, pageSize: 100); } if (navigationContext.Parameters.ContainsKey(ContantesGlobais.ATUALIZAR_GRID)) { Produtos = new VirtualizingCollection <ProdutoLookupWrapper>( _paginacaoRepository, pageSize: 100); } SetnumeroRegistros(); await SetNumeroREgistrosSincronizarNuvem(); }
public async void LoadData(string logFilePath) { SetStatusCurrentLine(null); SetStatusTotalLines(null); SetStatusProgress(true); SetStatusMessage("Processing file..."); LogFile logFile = await LogFile.LoadFromAsync(logFilePath); var gridView = listView.View as GridView; gridView.Columns[1].Width = logFile.MaxLineLength * listView.FontSize; var provider = new LogLinesItemProvider(logFile); DataContext = new VirtualizingCollection<ModelLine>(provider, PageSize, PageTimeout * 1000); SetStatusTotalLines(logFile.Lines.Count); SetStatusProgress(false); SetStatusMessage("Ready"); }
public void ShouldReadWholeFile() { LogFile logFile = LogFile.LoadFrom(logFilePath); IItemsProvider <string> itemsProvider = new LogItemsProvider(logFile); IList <string> vc = new VirtualizingCollection <string>(itemsProvider, 10); Assert.AreEqual(100, logFile.Lines.Count); Assert.AreEqual(100, itemsProvider.GetCount()); Assert.AreEqual(100, vc.Count); // Read the files side by side using (var stream = new FileStream(logFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) using (var reader = new StreamReader(stream)) { int index = 0; string line; while ((line = reader.ReadLine()) != null) { Debug.WriteLine(index); Assert.AreEqual(line, vc[index], "Failed at index " + index.ToString()); index++; } } }
public void ShouldReadPages() { const int ItemsCount = 101; const int PageSize = 10; const int ExpectedPages = 11; Mock<IItemsProvider<string>> itemsProviderMock = new Mock<IItemsProvider<string>>(); itemsProviderMock.Setup(p => p.GetCount()).Returns(ItemsCount); IList<string> vc = new VirtualizingCollection<string>(itemsProviderMock.Object, PageSize); int count = 0; foreach (var s in vc) { count++; } Assert.AreEqual(ItemsCount, count); Assert.AreEqual(ItemsCount, vc.Count); for (int i = 0; i < ExpectedPages; i++) { itemsProviderMock.Verify(p => p.GetRange(i * PageSize, PageSize), Times.Once()); } }
private void Button_Click(object sender, RoutedEventArgs e) { // create the demo items provider according to specified parameters int numItems = int.Parse(tbNumItems.Text); int fetchDelay = int.Parse(tbFetchDelay.Text); DemoCustomerProvider customerProvider = new DemoCustomerProvider(numItems, fetchDelay); // create the collection according to specified parameters int pageSize = int.Parse(tbPageSize.Text); int pageTimeout = int.Parse(tbPageTimeout.Text); if ( rbNormal.IsChecked.Value ) { DataContext = new List<Customer>(customerProvider.FetchRange(0, customerProvider.FetchCount())); } else if ( rbVirtualizing.IsChecked.Value ) { DataContext = new VirtualizingCollection<Customer>(customerProvider, pageSize); } else if ( rbAsync.IsChecked.Value ) { DataContext = new AsyncVirtualizingCollection<Customer>(customerProvider, pageSize, pageTimeout*1000); } }
public void ShouldReadWholeFile() { LogFile logFile = LogFile.LoadFrom(logFilePath); IItemsProvider<string> itemsProvider = new LogItemsProvider(logFile); IList<string> vc = new VirtualizingCollection<string>(itemsProvider, 10); Assert.AreEqual(100, logFile.Lines.Count); Assert.AreEqual(100, itemsProvider.GetCount()); Assert.AreEqual(100, vc.Count); // Read the files side by side using (var stream = new FileStream(logFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) using (var reader = new StreamReader(stream)) { int index = 0; string line; while ((line = reader.ReadLine()) != null) { Debug.WriteLine(index); Assert.AreEqual(line, vc[index], "Failed at index " + index.ToString()); index++; } } }
ListValuesProvider CreateListValuesProvider(ICSharpCode.NRefactory.Ast.Expression targetObject, DebugType iListType, DebugType listItemType) { var listValuesProvider = new ListValuesProvider(targetObject, iListType, listItemType); var virtCollection = new VirtualizingCollection<ObjectValue>(listValuesProvider); this.listView.ItemsSource = virtCollection; return listValuesProvider; }
public void Refresh() { try { // clear ListView listView.ItemsSource = null; Value shownValue = getValue(); ParameterizedType iListType, iEnumerableType; IType itemType; // Value is IList if (shownValue.Type.ResolveIListImplementation(out iListType, out itemType)) { // Ok } else { // Value is IEnumerable if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) { shownValue = DebuggerHelpers.CreateListFromIEnumerable(shownValue); shownValue.Type.ResolveIListImplementation(out iListType, out itemType); //var ilistDef = iEnumerableType.Compilation.FindType(typeof(List<>)).GetDefinition(); //var ilistType = new ParameterizedType(ilistDef, ienumerableType.TypeArguments); } else { // Not IList or IEnumerable<T> - can't be displayed in GridVisualizer return; } } shownValue = shownValue.GetPermanentReference(WindowsDebugger.EvalThread); var members = itemType.GetFieldsAndNonIndexedProperties().Where(m => m.IsPublic && !m.IsStatic).ToList(); IProperty indexerProperty = iListType.GetProperties(p => p.Name == "Item").Single(); int rowCount = (int)shownValue.GetPropertyValue(WindowsDebugger.EvalThread, iListType.GetProperties(p => p.Name == "Count").Single()).PrimitiveValue; int columnCount = members.Count + 1; var rowCollection = new VirtualizingCollection<VirtualizingCollection<string>>( rowCount, (rowIndex) => new VirtualizingCollection<string>( columnCount, (columnIndex) => { if (columnIndex == columnCount - 1) { return "[" + rowIndex + "]"; } try { var rowValue = shownValue.GetPropertyValue(WindowsDebugger.EvalThread, indexerProperty, Eval.CreateValue(WindowsDebugger.EvalThread, rowIndex)); return rowValue.GetMemberValue(WindowsDebugger.EvalThread, members[columnIndex]).InvokeToString(WindowsDebugger.EvalThread); } catch (GetValueException e) { return "Exception: " + e.Message; } } ) ); this.listView.ItemsSource = rowCollection; InitializeColumns((GridView)this.listView.View, members); GridViewColumnHider columnHider = new GridViewColumnHider((GridView)this.listView.View); cmbColumns.ItemsSource = columnHider.HideableColumns; } catch(GetValueException e) { MessageService.ShowMessage(e.Message); } }
public void SetUp() { // Arrange _dataLoader = new DataProvider <Person>(Constants.LOCAL_DATA_DIRECTORY + Constants.BIG_DATA_PERSONS_PATH); _virtPersons = new VirtualizingCollection <Person>(_dataLoader); }
public void InitializeProviders(object param) { var barInfo = new CostBarInfo(); if (param == null) _history.Push(new CostBarInfo()); else barInfo = (CostBarInfo)param; LittleWindowWidth = 20; int intervalCount = GetIntervalCount(CurrentInterval, barInfo); BarSlides = new VirtualizingCollection<BarSlideItemVm>(new CostBarSlideProvider(intervalCount), 6); var barProvider = new CostBarProvider(intervalCount, 600, CurrentType, CurrentInterval, DataService, barInfo); Bars = new VirtualizingCollection<CostBarVm>(barProvider, 6); Scales.Clear(); ScaleLines.Clear(); ScaleHeight = barProvider.ScaleHeight; for (int i = barProvider.MaxScale; i >= 0; i -= barProvider.StepScale) { Scales.Add(i); ScaleLines.Add(0); } ScaleLines.RemoveAt(0); }
private bool HasMoreItems(VirtualizingCollection <PersonInfoViewModel> arg) { return(HasMoreItemsEnabled); }
private bool HasMoreItems(VirtualizingCollection<PersonInfoViewModel> arg) { return HasMoreItemsEnabled; }
public void Refresh() { try { // clear ListView listView.ItemsSource = null; Value shownValue = getValue(); ParameterizedType iListType, iEnumerableType; IType itemType; // Value is IList if (shownValue.Type.ResolveIListImplementation(out iListType, out itemType)) { // Ok } else { // Value is IEnumerable if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) { shownValue = DebuggerHelpers.CreateListFromIEnumerable(shownValue); shownValue.Type.ResolveIListImplementation(out iListType, out itemType); //var ilistDef = iEnumerableType.Compilation.FindType(typeof(List<>)).GetDefinition(); //var ilistType = new ParameterizedType(ilistDef, ienumerableType.TypeArguments); } else { // Not IList or IEnumerable<T> - can't be displayed in GridVisualizer return; } } shownValue = shownValue.GetPermanentReference(WindowsDebugger.EvalThread); var members = itemType.GetFieldsAndNonIndexedProperties().Where(m => m.IsPublic && !m.IsStatic).ToList(); IProperty indexerProperty = iListType.GetProperties(p => p.Name == "Item").Single(); int rowCount = (int)shownValue.GetPropertyValue(WindowsDebugger.EvalThread, iListType.GetProperties(p => p.Name == "Count").Single()).PrimitiveValue; int columnCount = members.Count + 1; var rowCollection = new VirtualizingCollection <VirtualizingCollection <string> >( rowCount, (rowIndex) => new VirtualizingCollection <string>( columnCount, (columnIndex) => { if (columnIndex == columnCount - 1) { return("[" + rowIndex + "]"); } try { var rowValue = shownValue.GetPropertyValue(WindowsDebugger.EvalThread, indexerProperty, Eval.CreateValue(WindowsDebugger.EvalThread, rowIndex)); return(rowValue.GetMemberValue(WindowsDebugger.EvalThread, members[columnIndex]).InvokeToString(WindowsDebugger.EvalThread)); } catch (GetValueException e) { return("Exception: " + e.Message); } } ) ); this.listView.ItemsSource = rowCollection; InitializeColumns((GridView)this.listView.View, members); GridViewColumnHider columnHider = new GridViewColumnHider((GridView)this.listView.View); cmbColumns.ItemsSource = columnHider.HideableColumns; } catch (GetValueException e) { MessageService.ShowMessage(e.Message); } }
public ContactViewModel() { Contacts = new VirtualizingCollection(Directory.GetContactManager(), 5, 5 * 1000); }
private void FillPatients() { Patients = new VirtualizingCollection <Patient>(this, NumberOfItems); }
public void InitializeProviders(object param) { var barInfo = new OperatorBarInfo {StartDate = StartDate, EndDate = EndDate}; if (param == null) _history.Push(new OperatorBarInfo()); else barInfo = (OperatorBarInfo)param; barInfo.IsCountBase = CurrentType == OEType.CountBased; LittleWindowWidth = 20; int intervalCount = GetIntervalCount(); BarSlides = new VirtualizingCollection<BarSlideItemVm>(new OperatorBarSlideProvider(intervalCount), 100); var barProvider = new OperatorBarProvider(intervalCount, 600, CurrentInterval, DataService, barInfo); Bars = new VirtualizingCollection<OperatorBarVm>(barProvider, 100); Scales.Clear(); ScaleLines.Clear(); ScaleHeight = barProvider.ScaleHeight; for (int i = barProvider.MaxScale; i >= 0; i -= barProvider.StepScale) { Scales.Add(i); ScaleLines.Add(0); } ScaleLines.RemoveAt(0); OnPropertyChanged("ScaleHeaders"); }