summaryrefslogtreecommitdiff
path: root/Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs')
-rw-r--r--Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs35
1 files changed, 34 insertions, 1 deletions
diff --git a/Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs b/Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs
index afc8e63..0dd7e55 100644
--- a/Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs
+++ b/Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs
@@ -39,6 +39,7 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels
private string filename;
private string path;
private List<FileInfo> fileList;
+ private string mask;
#endregion
@@ -46,7 +47,7 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels
private void GetFileList()
{
- FileList = FileInfo.GetFiles(path);
+ FileList = FileInfo.GetFiles(path, Mask);
}
#endregion
@@ -94,11 +95,42 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels
}
}
+ /// <summary>
+ /// The file mask to use.
+ /// </summary>
+ public string Mask
+ {
+ get {return mask;}
+ set
+ {
+ SetValue(ref mask, value, "Mask");
+ Filename = String.Empty;
+ GetFileList();
+ }
+ }
+
#endregion
#region Public members
/// <summary>
+ /// Get the path of the selected file.
+ /// </summary>
+ public string SelectedFile
+ {
+ get {return path + Filename;}
+ }
+
+ /// <summary>
+ /// Refresh the current directory listing.
+ /// </summary>
+ public void RefreshFileList()
+ {
+ Filename = String.Empty;
+ GetFileList();
+ }
+
+ /// <summary>
/// Called when a file is selected.
/// </summary>
/// <param name="file">The selected file.</param>
@@ -149,6 +181,7 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels
/// <param name="startPath">The path to start selecting from.</param>
public FileDialogViewModel(string startPath)
{
+ Mask = "*";
path = startPath;
Filename = String.Empty;
GetFileList();