Change from KeywordFilter property to ICustomSearch
This commit is contained in:
parent
28333b5926
commit
f88b04b7bc
11 changed files with 78 additions and 47 deletions
|
|
@ -90,20 +90,6 @@ namespace MatterHackers.MatterControl.Library
|
|||
base.Deactivate();
|
||||
}
|
||||
|
||||
private string keywordFilter = "";
|
||||
public override string KeywordFilter
|
||||
{
|
||||
get => keywordFilter;
|
||||
set
|
||||
{
|
||||
if (keywordFilter != value)
|
||||
{
|
||||
keywordFilter = value;
|
||||
this.ReloadContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (directoryWatcher != null)
|
||||
|
|
@ -159,7 +145,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
try
|
||||
{
|
||||
string filter = this.KeywordFilter.Trim();
|
||||
string filter = ""; // keywordFilter.Trim();
|
||||
|
||||
var allFiles = Directory.GetFiles(FullPath, "*.*", searchDepth);
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,11 @@ namespace MatterHackers.MatterControl.Library
|
|||
{
|
||||
activeContainer.Deactivate();
|
||||
activeContainer.ContentChanged -= ActiveContainer_ContentChanged;
|
||||
activeContainer.KeywordFilter = "";
|
||||
|
||||
if (activeContainer.CustomSearch is ICustomSearch customSearch)
|
||||
{
|
||||
customSearch.ClearFilter();
|
||||
}
|
||||
|
||||
// If the new container is an ancestor of the active container we need to Dispose everyone up to that point
|
||||
if (activeContainer.Ancestors().Where(p => p == newContainer).Any())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2017, John Lewin
|
||||
Copyright (c) 2018, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public string StatusMessage { get; set; } = "";
|
||||
|
||||
public virtual string KeywordFilter { get; set; } = "";
|
||||
public ICustomSearch CustomSearch { get; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the container when contents have changes and fires ContentChanged to notify listeners
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public event EventHandler<ItemChangedEventArgs> ItemContentChanged;
|
||||
|
||||
public bool AllowAction(ContainerActions containerActions)
|
||||
public override bool AllowAction(ContainerActions containerActions)
|
||||
{
|
||||
switch(containerActions)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,27 +68,15 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public int CollectionID { get; private set; }
|
||||
|
||||
public override string KeywordFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.KeywordFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (base.KeywordFilter != value)
|
||||
{
|
||||
base.KeywordFilter = value;
|
||||
this.ReloadContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
private string keywordFilter = "";
|
||||
|
||||
public ICustomSearch CustomSearch { get; } = null;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
var childCollections = this.GetChildCollections();
|
||||
|
||||
var allFiles = this.GetLibraryItems(KeywordFilter);
|
||||
var allFiles = this.GetLibraryItems(keywordFilter);
|
||||
|
||||
var zipFiles = allFiles.Where(f => string.Equals(Path.GetExtension(f.FileLocation), ".zip", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public string StatusMessage { get; set; }
|
||||
|
||||
public string KeywordFilter { get; set; } = "";
|
||||
public ICustomSearch CustomSearch { get; } = null;
|
||||
|
||||
public Task<ImageBuffer> GetThumbnail(ILibraryItem item, int width, int height)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue