DSIK_FILEZILLA/sikFtpClient/ViewModel/UploadViewModel.cs

58 lines
1.5 KiB
C#

using sikFtpClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace sikFtpClient.ViewModel
{
public class UploadViewModel : BaseViewModel
{
public UploadViewModel()
{
this.LocalDiscElementViewModels = new ObservableCollection<LocalDiscElementViewModel>();
CurrentPath = @"C:\Program Files (x86)";
}
public ObservableCollection<LocalDiscElementViewModel> LocalDiscElementViewModels { get; set; }
private string currentPath;
public string CurrentPath
{
get
{
return currentPath;
}
set
{
currentPath = value;
OnPropertyChanged();
UpdateContent();
}
}
public void UpdateContent()
{
if (LocalDiscElementViewModels != null)
{
LocalDiscElementViewModels.Clear();
}
var content = LocalDirectoryModel.GetContent(CurrentPath);
foreach(var element in content)
{
var localDiscElementViewModel = new LocalDiscElementViewModel()
{
Name = element.Name,
Path = element.Path,
IsSent = false
};
LocalDiscElementViewModels.Add(localDiscElementViewModel);
}
}
}
}