async void Initialize() { var ip = await HoloLensConnection.GetLocalIp() ?? "ERROR"; var qrSize = 320; var barcode = new ZXingBarcodeImageView { WidthRequest = qrSize, HeightRequest = qrSize, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, BarcodeFormat = ZXing.BarcodeFormat.QR_CODE, BarcodeOptions = { Width = qrSize, Height = qrSize, }, BarcodeValue = ip, }; BackgroundColor = Color.White; var stack = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Label { TextColor = Color.Black, HorizontalTextAlignment = TextAlignment.Center, Text = $"Waiting for the HoloLens ({ip}):" }, barcode, } }; Content = stack; var connection = new HoloLensConnection(); await connection.WaitForCompanion(); await Navigation.PushAsync(new LightSaberPage(connection)); }
public LightSaberPage(HoloLensConnection connection) { NavigationPage.SetHasNavigationBar(this, false); this.connection = connection; Button redBt = new Button(); redBt.Clicked += OnColorClick; redBt.HorizontalOptions = LayoutOptions.FillAndExpand; redBt.BackgroundColor = Color.Red; Button greenBt = new Button(); greenBt.Clicked += OnColorClick; greenBt.HorizontalOptions = LayoutOptions.FillAndExpand; greenBt.BackgroundColor = Color.Green; Button blueBt = new Button(); blueBt.Clicked += OnColorClick; blueBt.HorizontalOptions = LayoutOptions.FillAndExpand; blueBt.BackgroundColor = Color.Blue; Button purpleBt = new Button(); purpleBt.Clicked += OnColorClick; purpleBt.HorizontalOptions = LayoutOptions.FillAndExpand; purpleBt.BackgroundColor = Color.Purple; StackLayout hStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, HeightRequest = 200, Children = { redBt, greenBt, blueBt, purpleBt } }; Content = hStack; }