DSIK_FILEZILLA/sikFtpClient/ViewModel/UploadViewModel.cs

58 lines
1.5 KiB
C#
Raw Normal View History

2019-01-20 14:51:36 +01:00
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);
}
}
}
}