private void b_disconnect_Click(object sender, RoutedEventArgs e) { TClientProfile selected = (TClientProfile)l_profiles.SelectedItem; if (selected.State == ConnectionState.Connected || selected.State == ConnectionState.LackOfResponse) { client.Close(selected); } appbar.IsOpen = false; }
public void Disconnect() { TClient.Client.Disconnect(false); // Disconnect the client TClient.Close(); // Close the client Stream = null; // Remove the stream PacketThread.Abort(); // Abort the packet update thread Variables.MainForm.IsClientConnected = false; }
private void l_profiles_ItemClick(object sender, ItemClickEventArgs e) { TClientProfile profile = (TClientProfile)e.ClickedItem; if (profile.State == ConnectionState.Disconnected) { Task.Run(() => client.ConnectAsync(profile.LastIPAddress)); } else { client.Close(profile); } }