DSIK_FILEZILLA/sikFtpClient/ViewModel/ConnectionViewModel.cs

89 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace sikFtpClient.ViewModel
{
public class ConnectionViewModel : BaseViewModel
{
public ConnectionViewModel()
{
Address = "";
Port = "";
IsConnected = false;
}
private string address;
private string port;
private bool isConnected;
public string Address
{
get
{
return address;
}
set
{
address = value;
OnPropertyChanged();
}
}
public string Port
{
get
{
return port;
}
set
{
port = value;
OnPropertyChanged();
}
}
public bool IsConnected
{
get
{
return isConnected;
}
set
{
isConnected = value;
OnPropertyChanged();
}
}
public void Connect()
{
//int port = Int32.Parse(Port);
IsConnected = true;
}
public bool CanConnect()
{
if(Address != "" && Port != "")
{
return true;
}
return false;
}
RelayCommand connectCommand;
public ICommand ConnectCommand
{
get
{
if (connectCommand == null)
{
connectCommand = new RelayCommand(param => this.Connect(),
param => true);
}
return connectCommand;
}
}
}
}