コード例 #1
0
        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());
            }
        }
コード例 #2
0
        public VirtualDataCollection(IItemsProvider<IFreeDocument> data,  int pageTimeout = 30000)
            : base()
        {
            VirtualData = new VirtualizingCollection<IFreeDocument>(data,pageTimeout);

            data.AlreadyGetSize += (s, e) => OnPropertyChanged("Count");
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public OldMainPageViewModel()
        {
            People = new VirtualizingCollection <PersonInfoViewModel>(HasMoreItems, LoadMoreItems);
            GenerateDummyData();

            ShowMessageCommand = new DelegateCommand <object>(ShowMessageAction);

            ContextMenuItems = ContextMenuItemsDelegate;
        }
コード例 #5
0
        public OldMainPageViewModel()
        {
            People = new VirtualizingCollection<PersonInfoViewModel>(HasMoreItems, LoadMoreItems);
            GenerateDummyData();

            ShowMessageCommand = new DelegateCommand<object>(ShowMessageAction);

            ContextMenuItems = ContextMenuItemsDelegate;
        }
コード例 #6
0
 public void InicializedFilteringAndSortingDataSource()
 {
     HttpResponcesList =
         new VirtualizingCollection <HttpResponce>(
             _filteringAndSortingHttpResponcesDataSource,
             ListPageSize,
             ListPageTimeout);
     _filteringAndSortingHttpResponcesDataSource.FetchRangeCommand(0, ListPageSize);
     OnPropertyChanged("HttpResponcesList");
 }
コード例 #7
0
 public void InicializedItemsChangingDataSource()
 {
     HttpResponcesList =
         new VirtualizingCollection <HttpResponce>(
             _itemsChangingHttpResponceDataSource,
             ListPageSize,
             ListPageTimeout);
     _itemsChangingHttpResponceDataSource.FetchRangeCommand(0, ListPageSize);
     OnPropertyChanged("HttpResponcesList");
 }
コード例 #8
0
		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;
		}
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
        }
コード例 #12
0
        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;
        }
コード例 #13
0
        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();
        }
コード例 #14
0
ファイル: LogControl2.xaml.cs プロジェクト: helgihaf/Grocker
        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");
        }
コード例 #15
0
        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++;
                    }
                }
        }
コード例 #16
0
        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());
            }
        }
コード例 #17
0
        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);
            }
        }
コード例 #18
0
        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++;
                }
            }
        }
コード例 #19
0
		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;
		}
コード例 #20
0
		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);
			}
		}
コード例 #21
0
        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;
        }
コード例 #22
0
 public void SetUp()
 {
     // Arrange
     _dataLoader  = new DataProvider <Person>(Constants.LOCAL_DATA_DIRECTORY + Constants.BIG_DATA_PERSONS_PATH);
     _virtPersons = new VirtualizingCollection <Person>(_dataLoader);
 }
コード例 #23
0
ファイル: CostReportsVm.cs プロジェクト: T1Easyware/Soheil
		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);
		}
コード例 #24
0
 private bool HasMoreItems(VirtualizingCollection <PersonInfoViewModel> arg)
 {
     return(HasMoreItemsEnabled);
 }
コード例 #25
0
 private bool HasMoreItems(VirtualizingCollection<PersonInfoViewModel> arg)
 {
     return HasMoreItemsEnabled;
 }
コード例 #26
0
        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);
            }
        }
コード例 #27
0
 public ContactViewModel()
 {
     Contacts = new VirtualizingCollection(Directory.GetContactManager(), 5, 5 * 1000);
 }
コード例 #28
0
 private void FillPatients()
 {
     Patients = new VirtualizingCollection <Patient>(this, NumberOfItems);
 }
コード例 #29
0
		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");
		}