You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/FileTransferServer/MainWindow.xaml.cs

46 lines
1.1 KiB

using System.IO;
using System.Windows;
5 years ago
using ZeroLevel.Network.FileTransfer;
namespace FileTransferServer
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private IFileServer _server;
private void Button_Click(object sender, RoutedEventArgs e)
{
int port = -1;
if (!int.TryParse(tbPort.Text, out port)) port = -1;
if (!Directory.Exists(tbFolder.Text))
{
try
{
Directory.CreateDirectory(tbFolder.Text);
}
catch { }
}
if (port == -1 || !Directory.Exists(tbFolder.Text))
{
MessageBox.Show("Incorrect parameters");
return;
}
_server = FileServerFactory.Create(port, tbFolder.Text);
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
_server = null;
}
}
}

Powered by TurnKey Linux.