public override void ViewDidLoad() { base.ViewDidLoad(); NSString[] strings = new NSString[GlobalResources.STANDARD_FILTERS_DROPOFF_INDEX + 1]; for (int i = 0; i < strings.Length; ++i) { strings[i] = new NSString(GlobalResources.LibraryFilters[i].Item1); } strings[strings.Length - 1] = new NSString("Keyword"); ComboBoxSortBy.Add(strings); ComboBoxSortBy.StringValue = "Title"; _sourceSorter = new SourceSorter(GlobalResources.OpenLibrary); sourceFilterDelegate = new DelegateTableViewSourceFilter(DataSourceFilters, _sourceSorter); TableViewSourceFilters.DataSource = DataSourceFilters; TableViewSourceFilters.Delegate = sourceFilterDelegate; var sourcesDataSource = new DataSourceTableViewSources(_sourceSorter); TableViewSources.DataSource = sourcesDataSource; TableViewSources.Delegate = new DelegateTableViewSources(sourcesDataSource); _sourceSorter.SorterUpdated += (sender, e) => { TableViewSources.ReloadData(); } CreateSources(); }
public void Init() { library = new Library("Source Sorter Test Library"); sorter = new SourceSorter(library); CitationFormat format = new CitationFormat("Print"); format.AddField("Title", typeof(WordField), false); format.AddField("Author", typeof(NameField), true); source1 = new Source(format); source1.SetValues("Title", "The Lion, the Witch, and the Wardrobe"); source1.SetValues("Author", "C.S. Lewis"); library.AddSource(source1); source2 = new Source(format); source2.SetValues("Title", "The Lord of the Rings"); source2.SetValues("Author", "J.R.R. Tolkien"); library.AddSource(source2); source3 = new Source(format); source1.SetValues("Title", "The Aspiring Adventures of Joe Bob"); source1.SetValues("Author", "Clive Tolkien", "Justice Beaver", "Mustard Yellow"); library.AddSource(source1); }
public void TestSortingSingle() { sorter.SortByField = "Title"; SourceSorter.FilterSources(sorter); Assert.ReferenceEquals(source3, sorter.GetSources("")); }
public DataSourceTableViewSources(SourceSorter sorter) { DisplayedSources = sorter.DisplayedSources; }
public DelegateTableViewSourceFilter(DataSourceTableViewSourceFilter dataSource, SourceSorter sorter) { _dataSource = dataSource; _sourceSorter = sorter; }