private async void ConnectButtonTapped(object sender, System.Windows.Input.GestureEventArgs e) { Debug.WriteLine("" + usernameField.Text + " " + passwordField.Password + " " + hostnameField.Text + " " + rememberField.IsChecked ); var host = new Host("http://"+hostnameField.Text + "/ubus"); bool success = await host.Login(usernameField.Text, passwordField.Password); if (success) { var start = DateTime.UtcNow; var tasks = new List<Task< List<DHCPLease>>>(); int count = 10; for( int i = 0; i < count; i++){ var d = host.DevicesInfo(); tasks.Add(d); } await Task.WhenAll(tasks.ToArray()); var result = tasks[0].Result; var end = DateTime.UtcNow; double ms = (end - start).TotalMilliseconds; Debug.WriteLine("count: " + count + ", total " + ms + " ms, average " + ms/(count*1.0) ); } else { MessageBox.Show("failed to login" + " took: "); } }
public virtual void Initialize() { testHost = new Host(endpoint); }