public void Dispose()
 {
     if (_linesProvider != null)
     {
         _linesProvider.Dispose();
         _linesProvider = null;
     }
 }
        /// <summary>
        /// Opens the file with a specified maxium number of rows with a default value that insures
        /// the max this code can handle isn't reached.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="maxRows"></param>
        public void OpenFile(string filename, int maxRows = Int32.MaxValue)
        {
            ColumnSelectorsVisible = false;
            if (_linesProvider != null)
            {
                _linesProvider.Dispose();
                _linesProvider = null;
            }
            // Select low level lines provider as being a binary lines provider, or a text line provider
            BigFileLine lineConverter = _binaryMode ? (BigFileLine)(new BigBinFileLine()) : (BigFileLine)(new BigTextFileLine());

            OpenProvider(new FileLinesProvider(filename, maxRows, lineConverter));
        }
        public void OpenProvider(LinesProvider linesProvider)
        {
            _linesProvider = linesProvider;
            // Handles when the number of columns we need to display the data changes
            _linesProvider.MaxColumnsChanged += (s, e) => ColumnCount = e.MaxColumns;
            ColumnCount = 0;
            var fileLines = new VirtualizingCollectionDynamicAsync <BigFileLine>(_linesProvider, 100 /*page size*/, 60000 /*timeout*/, 1000 /* loadCountInterval*/);

            FileLines = fileLines;
            fileLines.CountChanged += (s, e) =>
            {
                CountChanged?.Invoke(this, e);
                OnPropertyChanged("RowCount");
            };
        }