Exemplo n.º 1
0
        private void ButtonFile_Click(object sender, RoutedEventArgs e)
        {
            string source, destination;

            source      = TextBoxFileSource.Text;
            destination = TextBoxFileDestination.Text;

            if (string.IsNullOrEmpty(source))
            {
                throw new Exception("Source cannot be empty.");
            }
            if (string.IsNullOrEmpty(destination))
            {
                throw new Exception("Destination cannot be empty.");
            }

            try
            {
                Task.Run(() => _listener.SendFileAsync(_client.Id, source, destination, false));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }