private async void connectButton_Click(object sender, EventArgs e) { connectButton.Enabled = false; string input = ipInput.Text; if (input.IsIPv4Format() && IPAddress.TryParse(input, out IPAddress ip)) { LSClient client = new LSClient(); resultLabel.Text = "Connecting..."; if (await client.TryConnectAsync(ip, 1337)) { ConnectionMade?.Invoke(client); resultLabel.Text = ""; } else { resultLabel.Text = "Connection failed"; } } else { resultLabel.Text = "Invalid IP entered"; } connectButton.Enabled = true; }
public FileOperationUpdateReceiver( FileOperationType operationType, LSClient client) { OperationType = operationType; Client = client; Decoder = new MessageDecoder(); }
public ConnectedClientForm(LSClient client, ServerInfoMessage serverInfo) { InitializeComponent(); this.client = client; categorySelector.Categories = serverInfo.FileCategories; requestManager = new RequestManager(client); }
public TransferOperationUpdateReceiver( LSClient client, string folderPath, bool zipLocal) : base(FileOperationType.Transfer, client) { this.folderPath = folderPath; this.zipLocal = zipLocal; autoEvent = new AutoResetEvent(false); operationMessageQueue = new ConcurrentQueue <TransferOperationMessage>(); }
private async void connectButton_Click(object sender, EventArgs e) { connectButton.Enabled = false; LSClient client = new LSClient(); if (await client.TryConnectAsync(IPAddress.Parse(selectedConnection.ConnectionIP), 1337)) { Console.WriteLine("Waiting for server info..."); ServerInfoMessage serverInfo = await new RequestManager(client).RetrieveServerInfo(); //Console.WriteLine("Received server info: " + // JsonConvert.SerializeObject(serverInfo, Formatting.Indented)); new ConnectedClientForm(client, serverInfo).ShowDialog(this); client.Close(); } connectButton.Enabled = true; }
public RequestManager(LSClient client) { this.client = client; decoder = new MessageDecoder(); }
public ZipOperationUpdateReceiver(LSClient client) : base(FileOperationType.Zip, client) { }