Vue sur les fichiers distants
This commit is contained in:
parent
a20026ccb8
commit
f92591c2ff
15 changed files with 280 additions and 146 deletions
|
|
@ -5,28 +5,71 @@ using XLabs.Forms.Mvvm;
|
|||
|
||||
namespace BookAStar.ViewModels.UserProfile
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using Model.FileSystem;
|
||||
|
||||
public class DirectoryInfoViewModel : ViewModel
|
||||
{
|
||||
public ObservableString SubPath { get; set; }
|
||||
public ObservableCollection<string> SubDirectories { get; set; }
|
||||
public ObservableCollection<UserFileInfo> FileInfo { get; set; }
|
||||
public ICommand RefreshCommand { get; set; }
|
||||
public DirectoryInfoViewModel (UserDirectoryInfo model=null)
|
||||
private string subPath;
|
||||
public string SubPath
|
||||
{
|
||||
Data.DataManager.Current.RemoteFiles.CollectionChanged += RemoteFiles_CollectionChanged;
|
||||
|
||||
if (model == null)
|
||||
model = Data.DataManager.Current.RemoteFiles.CurrentItem;
|
||||
SubDirectories = new ObservableCollection<string> (model.SubDirectories);
|
||||
SubPath = new ObservableString (model.SubPath);
|
||||
FileInfo = new ObservableCollection<Model.FileSystem.UserFileInfo> (model.Files);
|
||||
get { return subPath; }
|
||||
set { SetProperty<string>(ref subPath, value); }
|
||||
}
|
||||
|
||||
private void RemoteFiles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
private string userName;
|
||||
public string UserName
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
get { return userName; }
|
||||
set { SetProperty<string>(ref userName, value); }
|
||||
}
|
||||
|
||||
private ObservableCollection<string> subDirectories;
|
||||
public ObservableCollection<string> SubDirectories
|
||||
{
|
||||
get { return subDirectories; }
|
||||
set { SetProperty< ObservableCollection < string >>( ref subDirectories, value) ; }
|
||||
}
|
||||
|
||||
private ObservableCollection<UserFileInfo> fileInfo;
|
||||
public ObservableCollection<UserFileInfo> FileInfo
|
||||
{
|
||||
get { return fileInfo; }
|
||||
set { SetProperty<ObservableCollection<UserFileInfo>> ( ref fileInfo, value ); }
|
||||
}
|
||||
|
||||
UserDirectoryInfo model;
|
||||
public UserDirectoryInfo InnerModel {
|
||||
get { return model; }
|
||||
set {
|
||||
if (SetProperty<UserDirectoryInfo>(ref model, value))
|
||||
if (model == null)
|
||||
{
|
||||
SubDirectories = new ObservableCollection<string>();
|
||||
FileInfo = new ObservableCollection<UserFileInfo>();
|
||||
SubPath = "<no path>";
|
||||
UserName = "<no user>";
|
||||
}
|
||||
else
|
||||
{
|
||||
SubDirectories = new ObservableCollection<string>(model.SubDirectories);
|
||||
FileInfo = new ObservableCollection<UserFileInfo>(model.Files);
|
||||
SubPath = model.SubPath;
|
||||
UserName = model.UserName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DirectoryInfoViewModel(UserDirectoryInfo model = null)
|
||||
{
|
||||
this.InnerModel = model;
|
||||
}
|
||||
|
||||
private ICommand refreshCommand;
|
||||
public ICommand RefreshCommand
|
||||
{
|
||||
get { return refreshCommand; }
|
||||
set { SetProperty<ICommand>(ref refreshCommand, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue