MainPage.xaml.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Xamarin.Forms;
  8. using InABox.Clients;
  9. using System.Threading;
  10. using Xamarin.Essentials;
  11. using Comal.Classes;
  12. using InABox.Core;
  13. namespace ConnectionTest
  14. {
  15. public partial class MainPage : ContentPage
  16. {
  17. List<string> urls = new List<string>
  18. {
  19. "remote.com-al.com.au:8000",
  20. //"remote2.com-al.com.au:8000",
  21. //"remote.prsdigital.com.au:8005",
  22. //"remote2.prsdigital.com.au:8005",
  23. //"remote.com-al.com.au:8020",
  24. };
  25. public MainPage()
  26. {
  27. InitializeComponent();
  28. CoreUtils.RegisterClasses();
  29. ComalUtils.RegisterClasses();
  30. foreach (var url in urls)
  31. {
  32. var test = new ConnectionTestUnit(url);
  33. test.OnRemoveURL += Test_OnRemoveURL;
  34. stacklayout.Children.Add(test);
  35. }
  36. }
  37. private void Test_OnRemoveURL(View view)
  38. {
  39. stacklayout.Children.Remove(view);
  40. }
  41. private void AddButton_Clicked(object sender, EventArgs e)
  42. {
  43. if (!string.IsNullOrWhiteSpace(urlEnt.Text))
  44. {
  45. var test = new ConnectionTestUnit(urlEnt.Text);
  46. test.OnRemoveURL += Test_OnRemoveURL;
  47. stacklayout.Children.Add(test);
  48. urlEnt.Text = "";
  49. }
  50. }
  51. }
  52. }