public void Reset(BibTexDatabase database)
        {
            if (database == null)
            {
                database = new BibTexDatabase();
            }

            this.database = database;

            allEntries = new List <SelectableReference>(database.EntryCount);

            var yearList = new List <string>();

            foreach (var entry in database.Entries)
            {
                var selectableReference = new SelectableReference
                {
                    Selected  = false,
                    ID        = entry.Name,
                    Title     = entry["title", TagEntry.Empty].Display,
                    Authors   = entry["author", TagEntry.Empty].Display,
                    Year      = entry["year", TagEntry.Empty].Display,
                    Timestamp = entry["timestamp", TagEntry.Empty].Display,
                    Pages     = string.Empty
                };

                allEntries.Add(selectableReference);

                if (selectableReference.Year.Length == 4 && !yearList.Contains(selectableReference.Year))
                {
                    yearList.Add(selectableReference.Year);
                }
            }

            source = new BindingListAce <SelectableReference>(allEntries)
            {
                AllowNew    = false,
                AllowRemove = false
            };


            bsSelectableReferences.DataSource = source;

            grid.AutoResizeColumns();

            bsSelectableReferences.ListChanged +=
                (sender, args) =>
            {
                Debug.WriteLine("bsSelectableReferences.ListChanged.ListChanged " + args.ListChangedType);
                UpdateAddButton();
            };

            yearList.Sort();
            yearList.Insert(0, "(any)");
            cmbYear.Items.AddRange(yearList.ToArray());
            cmbYear.SelectedIndex = 0;

            UpdateFilter();

            btnChooseDatabase.Visible = Settings.Instance.AllowPerDocumentDatabases;
        }
		public void Reset(BibTexDatabase database)
		{
			if (database == null)
			{
				database = new BibTexDatabase();
			}

			this.database = database;

			allEntries = new List<SelectableReference>(database.EntryCount);

			var yearList = new List<string>();

			foreach(var entry in database.Entries)
			{
				var selectableReference = new SelectableReference
				                         	{
				                         		Selected = false,
												ID = entry.Name,
				                         		Title = entry["title", TagEntry.Empty].Display,
				                         		Authors = entry["author", TagEntry.Empty].Display,
				                         		Year = entry["year", TagEntry.Empty].Display,
				                         		Timestamp = entry["timestamp", TagEntry.Empty].Display,
												Pages = string.Empty
				                         	};

				allEntries.Add(selectableReference);

				if (selectableReference.Year.Length == 4 && !yearList.Contains(selectableReference.Year))
				{
					yearList.Add(selectableReference.Year);
				}
			}

			source = new BindingListAce<SelectableReference>(allEntries)
			             	{
			             		AllowNew = false,
			             		AllowRemove = false
			             	};


			bsSelectableReferences.DataSource = source;

			grid.AutoResizeColumns();

			bsSelectableReferences.ListChanged +=
				(sender, args) =>
					{
						Debug.WriteLine("bsSelectableReferences.ListChanged.ListChanged " + args.ListChangedType);
						UpdateAddButton();
					};

			yearList.Sort();
			yearList.Insert(0, "(any)");
			cmbYear.Items.AddRange(yearList.ToArray());
			cmbYear.SelectedIndex = 0;

			UpdateFilter();

			btnChooseDatabase.Visible = Settings.Instance.AllowPerDocumentDatabases;
		}