Lego.Ev3.Core.Brick.ConnectAsync C# (CSharp) Method

ConnectAsync() private method

private ConnectAsync ( ) : Task
return Task
		ConnectAsync()
		{
			return ConnectAsyncInternal(TimeSpan.FromMilliseconds(100))
#if WINRT
			.AsAsyncAction()
#endif
			;
		}

Same methods

Brick::ConnectAsync ( TimeSpan pollingTime ) : Task

Usage Example

コード例 #1
0
		private void TryToConnect(object sender, RoutedEventArgs e)
		{
			Overlay.Show("Connecting");

			ConnControl.Visibility = Visibility.Visible;

			var conType = CreateConnection();

			Dispatcher.Invoke(new Action(async () =>
			{
				if (conType != null)
				{
					_brick = new Brick(conType, true);
					_brick.BrickChanged += _brick_BrickChanged;
					try
					{
						await _brick.ConnectAsync();
						ConnControl.Visibility = Visibility.Collapsed;

						ConnTypeRun.Text = ConnControl.GetConnectionType().ToString();

					}
					catch (Exception)
					{
						MessageBox.Show("Could not connect", "Error", MessageBoxButton.OK);
					}
				}
				else
				{
					MessageBox.Show("Invalid connection type for this device", "Error", MessageBoxButton.OK);
				}

				Overlay.Hide();
			}));
		}
All Usage Examples Of Lego.Ev3.Core.Brick::ConnectAsync