54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using EBS_POC.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using System.Net.Sockets;
|
|
using System.Net;
|
|
|
|
namespace EBS_POC.Controls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for Connect_Page.xaml
|
|
/// </summary>
|
|
public partial class Connect_Page : UserControl
|
|
{
|
|
public Connect_Page()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private async void buttonConnect_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!File.Exists(textBox.Text.Replace("\"", "")))
|
|
{
|
|
MessageBox.Show("File not found.");
|
|
return;
|
|
}
|
|
if (await Sockets.InitHostConnection(textBox.Text.Replace("\"", "")))
|
|
{
|
|
Sockets.ConnectAsHost();
|
|
}
|
|
else if (await Sockets.InitClientConnection(textBox.Text.Replace("\"", "")))
|
|
{
|
|
Sockets.ConnectAsClient();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Couldn't connect.");
|
|
}
|
|
}
|
|
}
|
|
}
|