From 2c39a1ef8c13bd8d0321f79b0ce2850d0a590b45 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 27 Jun 2012 22:49:23 +0000 Subject: Done Save, Load and Delete dialogs. --- .../ViewModels/FileDialogViewModel.cs | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'Noddybox.WindowsPhone.Silverlight/ViewModels/FileDialogViewModel.cs') 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 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,10 +95,41 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels } } + /// + /// The file mask to use. + /// + public string Mask + { + get {return mask;} + set + { + SetValue(ref mask, value, "Mask"); + Filename = String.Empty; + GetFileList(); + } + } + #endregion #region Public members + /// + /// Get the path of the selected file. + /// + public string SelectedFile + { + get {return path + Filename;} + } + + /// + /// Refresh the current directory listing. + /// + public void RefreshFileList() + { + Filename = String.Empty; + GetFileList(); + } + /// /// Called when a file is selected. /// @@ -149,6 +181,7 @@ namespace Noddybox.WindowsPhone.Silverlight.ViewModels /// The path to start selecting from. public FileDialogViewModel(string startPath) { + Mask = "*"; path = startPath; Filename = String.Empty; GetFileList(); -- cgit v1.2.3