aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Explorer
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-11-25 17:52:49 +0200
commit9277bbd2fa070c69b83904f8fe5628fab2b947b8 (patch)
tree3099f9ce92f04c28517eb13938e913a1e376b3fe /Software/Visual_Studio/Tango.Explorer
parentf779e2b6f0bb1dedc7644c64651b59e31ce62c00 (diff)
downloadTango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.tar.gz
Tango-9277bbd2fa070c69b83904f8fe5628fab2b947b8.zip
Working on job export import to storage.
Diffstat (limited to 'Software/Visual_Studio/Tango.Explorer')
-rw-r--r--Software/Visual_Studio/Tango.Explorer/ExplorerControl.cs25
-rw-r--r--Software/Visual_Studio/Tango.Explorer/ExplorerFileItem.cs8
-rw-r--r--Software/Visual_Studio/Tango.Explorer/ExplorerFolderItem.cs11
3 files changed, 36 insertions, 8 deletions
diff --git a/Software/Visual_Studio/Tango.Explorer/ExplorerControl.cs b/Software/Visual_Studio/Tango.Explorer/ExplorerControl.cs
index d84138e0f..77116e94c 100644
--- a/Software/Visual_Studio/Tango.Explorer/ExplorerControl.cs
+++ b/Software/Visual_Studio/Tango.Explorer/ExplorerControl.cs
@@ -61,6 +61,23 @@ namespace Tango.Explorer
public static readonly DependencyProperty FileSelectedCommandProperty =
DependencyProperty.Register("FileSelectedCommand", typeof(RelayCommand<ExplorerFileItem>), typeof(ExplorerControl), new PropertyMetadata(null));
+ public String Filter
+ {
+ get { return (String)GetValue(FilterProperty); }
+ set { SetValue(FilterProperty, value); }
+ }
+ public static readonly DependencyProperty FilterProperty =
+ DependencyProperty.Register("Filter", typeof(String), typeof(ExplorerControl), new PropertyMetadata(null));
+
+ public bool EnableFileSelection
+ {
+ get { return (bool)GetValue(EnableFileSelectionProperty); }
+ set { SetValue(EnableFileSelectionProperty, value); }
+ }
+ public static readonly DependencyProperty EnableFileSelectionProperty =
+ DependencyProperty.Register("EnableFileSelection", typeof(bool), typeof(ExplorerControl), new PropertyMetadata(true));
+
+
static ExplorerControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ExplorerControl), new FrameworkPropertyMetadata(typeof(ExplorerControl)));
@@ -83,7 +100,7 @@ namespace Tango.Explorer
}
else if (Directory.Exists(CurrentPath))
{
- CurrentFolder = ExplorerFolderItem.LoadFromPath(CurrentPath);
+ CurrentFolder = ExplorerFolderItem.LoadFromPath(CurrentPath, Filter);
}
_changing_current_path = false;
@@ -107,11 +124,11 @@ namespace Tango.Explorer
if (SelectedItem is ExplorerFolderItem)
{
var folder = SelectedItem as ExplorerFolderItem;
- folder = ExplorerFolderItem.LoadFromPath(folder.Path);
+ folder = ExplorerFolderItem.LoadFromPath(folder.Path, Filter);
CurrentFolder = folder;
SelectedItem = null;
}
- else if (SelectedItem is ExplorerFileItem)
+ else if (SelectedItem is ExplorerFileItem && EnableFileSelection)
{
FileSelectedCommand?.Execute(SelectedItem);
}
@@ -126,7 +143,7 @@ namespace Tango.Explorer
if (parentPath != null)
{
- CurrentFolder = ExplorerFolderItem.LoadFromPath(parentPath);
+ CurrentFolder = ExplorerFolderItem.LoadFromPath(parentPath, Filter);
}
}
}
diff --git a/Software/Visual_Studio/Tango.Explorer/ExplorerFileItem.cs b/Software/Visual_Studio/Tango.Explorer/ExplorerFileItem.cs
index 6340ea848..046b7a740 100644
--- a/Software/Visual_Studio/Tango.Explorer/ExplorerFileItem.cs
+++ b/Software/Visual_Studio/Tango.Explorer/ExplorerFileItem.cs
@@ -23,5 +23,13 @@ namespace Tango.Explorer
return fileItem;
}
+
+ /// <summary>
+ /// Gets the file extension.
+ /// </summary>
+ public String Extension
+ {
+ get { return System.IO.Path.GetExtension(Path).ToLower(); }
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Explorer/ExplorerFolderItem.cs b/Software/Visual_Studio/Tango.Explorer/ExplorerFolderItem.cs
index 48f870b20..dde105767 100644
--- a/Software/Visual_Studio/Tango.Explorer/ExplorerFolderItem.cs
+++ b/Software/Visual_Studio/Tango.Explorer/ExplorerFolderItem.cs
@@ -12,7 +12,7 @@ namespace Tango.Explorer
{
public class ExplorerFolderItem : ExplorerItem
{
- private static List<String> extensions = ExplorerFileDefinition.GetSupportedExtensions().Select(x => x.Replace(".","")).ToList();
+ private static List<String> extensions = ExplorerFileDefinition.GetSupportedExtensions().Select(x => x.Replace(".", "")).ToList();
public List<ExplorerItem> Items { get; set; }
@@ -21,7 +21,7 @@ namespace Tango.Explorer
Items = new List<ExplorerItem>();
}
- public static ExplorerFolderItem LoadFromPath(String path)
+ public static ExplorerFolderItem LoadFromPath(String path, String filter)
{
ExplorerFolderItem folderItem = new ExplorerFolderItem();
@@ -38,9 +38,12 @@ namespace Tango.Explorer
folderItem.Items.Add(fItem);
}
- foreach (var file in Directory.GetFiles(path,"*.*").Where(f => extensions.Contains(f.Split('.').Last().ToLower())).ToArray())
+ foreach (var file in Directory.GetFiles(path, "*.*").Where(f => extensions.Contains(f.Split('.').Last().ToLower())).ToArray())
{
- folderItem.Items.Add(ExplorerFileItem.LoadFromPath(file));
+ if (filter == null || filter.ToLower().Replace("*", "").Replace(";", "").Split('|').Contains(System.IO.Path.GetExtension(file).ToLower()))
+ {
+ folderItem.Items.Add(ExplorerFileItem.LoadFromPath(file));
+ }
}
return folderItem;