public ZXingDefaultOverlay ()
{
VerticalOptions = LayoutOptions.FillAndExpand;
HorizontalOptions = LayoutOptions.FillAndExpand;
RowDefinitions.Add (new RowDefinition { Height = new GridLength (1, GridUnitType.Star) });
RowDefinitions.Add (new RowDefinition { Height = new GridLength (2, GridUnitType.Star) });
RowDefinitions.Add (new RowDefinition { Height = new GridLength (1, GridUnitType.Star) });
ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) });
Children.Add (new BoxView {
VerticalOptions = LayoutOptions.Fill,
HorizontalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Black,
Opacity = 0.7,
}, 0, 0);
Children.Add (new BoxView {
VerticalOptions = LayoutOptions.Fill,
HorizontalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Black,
Opacity = 0.7,
}, 0, 2);
Children.Add (new BoxView {
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.FillAndExpand,
HeightRequest = 3,
BackgroundColor = Color.Red,
Opacity = 0.6,
}, 0, 1);
topText = new Label {
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextColor = Color.White,
AutomationId = "zxingDefaultOverlay_TopTextLabel",
};
topText.SetBinding( Label.TextProperty, new Binding( nameof( TopText ) ) );
Children.Add (topText, 0, 0);
botText = new Label {
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextColor = Color.White,
AutomationId = "zxingDefaultOverlay_BottomTextLabel",
};
botText.SetBinding( Label.TextProperty, new Binding( nameof( BottomText ) ) );
Children.Add (botText, 0, 2);
flash = new Button {
HorizontalOptions = LayoutOptions.End,
VerticalOptions = LayoutOptions.Start,
Text = "Flash",
TextColor = Color.White,
AutomationId = "zxingDefaultOverlay_FlashButton",
};
flash.SetBinding( Button.IsVisibleProperty, new Binding( nameof( ShowFlashButton ) ) );
flash.Clicked += (sender, e) => {
FlashButtonClicked?.Invoke( flash, e );
};
Children.Add (flash, 0, 0);
}