public CartridgeListCell() { var grid = new Grid() { BackgroundColor = App.Colors.Background, Padding = new Thickness(10, 10), ColumnSpacing = 10, ColumnDefinitions = new ColumnDefinitionCollection(), RowDefinitions = new RowDefinitionCollection(), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength((0.25 * DependencyService.Get<IScreen>().Width), GridUnitType.Absolute) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); // var boxPoster = new BoxView() // { // BackgroundColor = App.Colors.DirectionColor, // InputTransparent = true, // HorizontalOptions = LayoutOptions.FillAndExpand, // VerticalOptions = LayoutOptions.FillAndExpand, // }; // // grid.Children.Add(boxPoster, 0, 1, 0, 2); var imagePoster = new Image() { Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, WidthRequest = 48, HeightRequest = 48, }; imagePoster.SetBinding(Image.SourceProperty, CartridgeStore.CartridgeIconPropertyName, BindingMode.Default, convMediaToImageSource); grid.Children.Add(imagePoster, 0, 1, 0, 2); // var boxHeader = new BoxView() // { // BackgroundColor = App.Colors.DirectionBackground, // InputTransparent = true, // HorizontalOptions = LayoutOptions.FillAndExpand, // VerticalOptions = LayoutOptions.FillAndExpand, // }; // // grid.Children.Add(boxHeader, 1, 2, 0, 1); var layoutHeader = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = 0, Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; var labelHeader = new ExtendedLabel() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, XAlign = TextAlignment.Start, YAlign = TextAlignment.Start, LineBreakMode = LineBreakMode.WordWrap, UseMarkdown = false, TextColor = App.Colors.Text, FontSize = Device.OnPlatform<int>(18, 20, 18), }; labelHeader.SetBinding(Label.TextProperty, CartridgeStore.CartridgeNamePropertyName); layoutHeader.Children.Add(labelHeader); grid.Children.Add(layoutHeader, 1, 2, 0, 1); var layoutDetail = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = 0, Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; var labelAuthor = new ExtendedLabel() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Start, LineBreakMode = LineBreakMode.TailTruncation, UseMarkdown = false, TextColor = App.Colors.Text, FontSize = Device.OnPlatform<int>(11, 12, 11), }; labelAuthor.SetBinding(Label.TextProperty, CartridgeStore.CartridgeAuthorNamePropertyName, BindingMode.Default, convStringFormat, Catalog.GetString("Author: {0}")); layoutDetail.Children.Add(labelAuthor); var labelVersion = new ExtendedLabel() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Start, UseMarkdown = false, TextColor = App.Colors.Text, FontSize = Device.OnPlatform<int>(11, 12, 11), }; labelVersion.SetBinding(Label.TextProperty, CartridgeStore.CartridgeVersionPropertyName, BindingMode.Default, convStringFormat, Catalog.GetString("Version: {0}")); layoutDetail.Children.Add(labelVersion); var labelActivityType = new ExtendedLabel() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, UseMarkdown = false, TextColor = App.Colors.Text, FontSize = Device.OnPlatform<int>(11, 12, 11), }; labelActivityType.SetBinding(Label.TextProperty, CartridgeStore.CartridgeActivityTypePropertyName, BindingMode.Default, convStringFormat, Catalog.GetString("Activity: {0}")); layoutDetail.Children.Add(labelActivityType); grid.Children.Add(layoutDetail, 1, 2, 1, 2); View = grid; var update = new MenuItem { Text = Catalog.GetString("Update"), IsDestructive = false, }; // ContextActions.Add(update); var delete = new MenuItem { Text = Catalog.GetString("Delete"), IsDestructive = true, Command = new Command(DeleteCommand), CommandParameter = this, }; ContextActions.Add(delete); }
public AboutPage() { Title = Catalog.GetString("About"); BackgroundColor = App.Colors.Background; NavigationPage.SetTitleIcon(this, "HomeIcon.png"); NavigationPage.SetBackButtonTitle(this, string.Empty); var emptyline = new ExtendedLabel { Text = Catalog.Format("\n"), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 1.4, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; var headline = new ExtendedLabel { Text = Catalog.Format("# WF.Player \nfor {0}", Device.OnPlatform("iOS", "Android", "WinPhone")), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 1.4, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var version = new ExtendedLabel { Text = Catalog.Format("__Version__ \n{0}", ((App)App.Current).PlatformHelper.ClientVersion), TextColor = App.Colors.Text, FontSize = Settings.FontSize, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var copyright = new ExtendedLabel { Text = Catalog.GetString("__Copyright by__ \nWherigo Foundation \nDirk Weltz \nBrice Clocher\n"), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 1.0, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var credits = new ExtendedLabel { Text = Catalog.GetString("__Credits__\nThis app uses the following software or parts of it"), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 0.8, FontAttributes = FontAttributes.Bold, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var xamarin = new ExtendedLabel { Text = Catalog.GetString("__Xamarin.iOS, Xamarin.Android and Xamarin.Forms__\nCopyright by Xamarin, Inc."), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 0.6, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var cdhowie = new ExtendedLabel { Text = Catalog.GetString("__Eluant__\nCopyright by cdhowie"), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 0.6, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var groundspeak = new ExtendedLabel { Text = Catalog.GetString("__Wherigo__\nCopyright by Groundspeak, Inc."), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 0.6, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var layout = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 10, Padding = 20, }; layout.Children.Add(headline); layout.Children.Add(emptyline); layout.Children.Add(version); layout.Children.Add(copyright); layout.Children.Add(emptyline); layout.Children.Add(credits); layout.Children.Add(xamarin); layout.Children.Add(cdhowie); layout.Children.Add(groundspeak); Content = new ScrollView { Content = layout, }; }
/// <summary> /// Initializes a new instance of the <see cref="WF.Player.GameDetailView"/> class. /// </summary> /// <param name="gameDetailViewModel">Game detail view model.</param> public GameDetailView(GameDetailViewModel gameDetailViewModel) : base() { BindingContext = gameDetailViewModel; App.GameNavigation.ShowBackButton = true; this.SetBinding(GameDetailView.TitleProperty, GameDetailViewModel.NamePropertyName); // Set binding for direction this.DirectionLayout.SetBinding(StackLayout.IsVisibleProperty, GameDetailViewModel.HasDirectionPropertyName); this.DirectionSpaceLayout.SetBinding(BoxView.IsVisibleProperty, GameDetailViewModel.HasDirectionPropertyName); this.DirectionView.SetBinding(DirectionArrow.DirectionProperty, GameDetailViewModel.DirectionPropertyName); this.DistanceView.SetBinding(Label.TextProperty, GameDetailViewModel.DistancePropertyName, BindingMode.OneWay, new ConverterToDistance()); #if __HTML__ var webView = new CustomWebView() { BackgroundColor = App.Colors.Background, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; webView.SetBinding(WebView.SourceProperty, GameDetailViewModel.HtmlSourcePropertyName); ((StackLayout)ContentLayout).Children.Add(webView); #else var scrollLayout = new PinchScrollView() { Orientation = ScrollOrientation.Vertical, Padding = new Thickness(0, 0), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var layout = new StackLayout() { BackgroundColor = App.Colors.Background, Orientation = StackOrientation.Vertical, Padding = 10, Spacing = 10, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var image = new ExtendedImage() { Aspect = Aspect.AspectFit, HorizontalOptions = Settings.ImageAlignment.ToLayoutOptions(), }; image.SetBinding(Image.SourceProperty, GameDetailViewModel.ImageSourcePropertyName); image.SetBinding(VisualElement.IsVisibleProperty, GameDetailViewModel.HasImagePropertyName); layout.Children.Add(image); var description = new ExtendedLabel() { TextColor = App.Colors.Text, FontSize = Settings.FontSize, FontFamily = Settings.FontFamily, XAlign = Settings.TextAlignment, UseMarkdown = App.Game.UseMarkdown, }; description.SetBinding(Label.TextProperty, GameDetailViewModel.DescriptionPropertyName); description.SetBinding(VisualElement.IsVisibleProperty, GameDetailViewModel.HasDescriptionPropertyName); layout.Children.Add(description); scrollLayout.Content = layout; ((StackLayout)ContentLayout).Children.Add(scrollLayout); #endif }
public AboutPage() { Title = Catalog.GetString("About"); BackgroundColor = App.Colors.Background; NavigationPage.SetTitleIcon(this, "HomeIcon.png"); NavigationPage.SetBackButtonTitle(this, string.Empty); var headline = new ExtendedLabel { Text = Catalog.GetString("WF.Player"), TextColor = App.Colors.Text, FontAttributes = FontAttributes.Bold, FontSize = Settings.FontSize * 2.8, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; // var platform = new ExtendedLabel // { // #if __IOS__ // Text = Catalog.GetString("for iOS"), // #endif // #if __ANDROID__ // Text = Catalog.GetString("for Android"), // #endif // TextColor = App.Colors.Text, // FontSize = Settings.FontSize * 1.2, // LineBreakMode = LineBreakMode.WordWrap, // XAlign = TextAlignment.Center, // HorizontalOptions = LayoutOptions.FillAndExpand, // VerticalOptions = LayoutOptions.Fill, // }; // var copyright = new ExtendedLabel { Text = Catalog.GetString("Copyright by \nWherigo Foundation \nDirk Weltz \nBrice Clocher"), TextColor = App.Colors.Text, FontSize = Settings.FontSize * 0.8, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var version = new ExtendedLabel { Text = Catalog.Format("Version \n{0}", ((App)App.Current).PlatformHelper.ClientVersion), TextColor = App.Colors.Text, FontSize = Settings.FontSize, LineBreakMode = LineBreakMode.WordWrap, XAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, UseMarkdown = true, }; var layout = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 20, Padding = 20, }; layout.Children.Add(headline); // layout.Children.Add(platform); layout.Children.Add(version); layout.Children.Add(copyright); Content = new ScrollView { Content = layout, }; }
/// <summary> /// Initializes a new instance of the <see cref="WF.Player.GameInputView"/> class. /// </summary> /// <param name="gameInputViewModel">Game input view model.</param> public GameInputView(GameInputViewModel gameInputViewModel) : base() { BindingContext = gameInputViewModel; NavigationPage.SetHasBackButton(this, false); App.GameNavigation.ShowBackButton = false; #if __HTML__ var webView = new CustomWebView () { BackgroundColor = App.Colors.Background, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; webView.SetBinding (WebView.SourceProperty, GameDetailViewModel.HtmlSourcePropertyName); webView.SizeChanged += (object sender, EventArgs e) => { webView.HeightRequest = 1; }; ((StackLayout)ContentLayout).Children.Add(webView); #else ScrollLayout = new PinchScrollView() { Orientation = ScrollOrientation.Vertical, Padding = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var layout = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = 10, Spacing = 10, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var image = new ExtendedImage() { Aspect = Aspect.AspectFit, HorizontalOptions = Settings.ImageAlignment.ToLayoutOptions(), }; image.SetBinding(Image.SourceProperty, GameInputViewModel.ImageSourcePropertyName); image.SetBinding(VisualElement.IsVisibleProperty, GameInputViewModel.HasImagePropertyName); layout.Children.Add(image); var description = new ExtendedLabel() { TextColor = App.Colors.Text, FontSize = Settings.FontSize, FontFamily = Settings.FontFamily, XAlign = Settings.TextAlignment, UseMarkdown = App.Game.UseMarkdown, }; description.SetBinding(Label.TextProperty, GameInputViewModel.TextPropertyName); description.SetBinding(VisualElement.IsVisibleProperty, GameInputViewModel.HasTextPropertyName); layout.Children.Add(description); ScrollLayout.Content = layout; ((StackLayout)ContentLayout).Children.Add(ScrollLayout); #endif var scanner = new Image { BackgroundColor = Color.Transparent, Source = "IconScan.png", Aspect = Aspect.AspectFit, #if __IOS__ // WidthRequest = 42, // FontSize = 20, // FontFamily = Settings.FontFamily, #endif HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, }; var tapRecognizer = new TapGestureRecognizer { Command = ((GameInputViewModel)BindingContext).ScannerClicked, NumberOfTapsRequired = 1 }; scanner.GestureRecognizers.Add(tapRecognizer); var entry = new Entry { #if __IOS__ BackgroundColor = Color.FromRgb(223, 223, 223), TextColor = App.Colors.Tint, #endif HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; entry.SetBinding(Entry.TextProperty, GameInputViewModel.InputTextPropertyName, BindingMode.TwoWay); entry.SetBinding(Entry.PlaceholderProperty, GameInputViewModel.PlaceholderPropertyName); entry.SetBinding(VisualElement.IsVisibleProperty, GameInputViewModel.HasEntryPropertyName); var button = new Button { BackgroundColor = Color.Transparent, Text = Catalog.GetString("Ok"), TextColor = App.Colors.Tint, #if __IOS__ FontSize = 20, FontFamily = Settings.FontFamily, #endif HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, }; button.SetBinding(Button.CommandProperty, GameInputViewModel.ButtonClickedPropertyName); // BottomEntry.Children.Add(button); BottomEntry = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = Device.OnPlatform(new Thickness(6, 6, 6, 6), new Thickness(6, 2, 2, 2), 2), Children = {scanner, entry, button }, }; }
/// <summary> /// Initializes a new instance of the <see cref="WF.Player.GameMessageboxView"/> class. /// </summary> /// <param name="gameMessageboxViewModel">Game messagebox view model.</param> public GameMessageboxView(GameMessageboxViewModel gameMessageboxViewModel) { BindingContext = gameMessageboxViewModel; NavigationPage.SetHasBackButton(this, false); App.GameNavigation.ShowBackButton = false; #if __HTML__ var webView = new CustomWebView() { BackgroundColor = App.Colors.Background, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; webView.SetBinding(WebView.SourceProperty, GameMessageboxViewModel.HtmlSourcePropertyName); ((StackLayout)ContentLayout).Children.Add(webView); #else var scrollLayout = new PinchScrollView() { Orientation = ScrollOrientation.Vertical, Padding = new Thickness(0, 0), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var layout = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = 10, Spacing = 10, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; var image = new ExtendedImage() { Aspect = Aspect.AspectFit, HorizontalOptions = Settings.ImageAlignment.ToLayoutOptions(), }; image.SetBinding(Image.SourceProperty, GameMessageboxViewModel.ImageSourcePropertyName); image.SetBinding(VisualElement.IsVisibleProperty, GameMessageboxViewModel.HasImagePropertyName); layout.Children.Add(image); var description = new ExtendedLabel() { TextColor = App.Colors.Text, FontSize = Settings.FontSize, FontFamily = Settings.FontFamily, XAlign = Settings.TextAlignment, UseMarkdown = App.Game.UseMarkdown, VerticalOptions = LayoutOptions.StartAndExpand, }; description.SetBinding(Label.TextProperty, GameMessageboxViewModel.TextPropertyName); description.SetBinding(VisualElement.IsVisibleProperty, GameMessageboxViewModel.HasTextPropertyName); layout.Children.Add(description); scrollLayout.Content = layout; ((StackLayout)ContentLayout).Children.Add(scrollLayout); #endif }
/// <summary> /// Initializes a new instance of the <see cref="WF.Player.GameMainView"/> class. /// </summary> /// <param name="gameMainViewModel">Game main view model.</param> public GameMainView(GameMainViewModel gameMainViewModel) : base() { BindingContext = gameMainViewModel; NavigationPage.SetBackButtonTitle(this, string.Empty); this.SetBinding(GameMainView.TitleProperty, GameMainViewModel.TitelPropertyName); #if __IOS__ var toolbarMenu = new ToolbarItem(Catalog.GetString("Menu"), null, () => { //"IconMenu.png", () => { App.Click(); var cfg = new WF.Player.Services.UserDialogs.ActionSheetConfig().SetTitle(Catalog.GetString("Game Menu")); cfg.Add(Catalog.GetString("Save"), () => ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Save"))); cfg.Add(Catalog.GetString("Quit"), () => ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Quit"))); cfg.Cancel = new WF.Player.Services.UserDialogs.ActionSheetOption(Catalog.GetString("Cancel"), App.Click); DependencyService.Get<WF.Player.Services.UserDialogs.IUserDialogs>().ActionSheet(cfg); }); this.ToolbarItems.Add (toolbarMenu); #endif #if __ANDROID__ var toolbarSave = new ToolbarItem(Catalog.GetString("Save"), "", () => { App.Click(); ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Save")); }) { Order = ToolbarItemOrder.Secondary, }; ToolbarItems.Add(toolbarSave); var toolbarQuit = new ToolbarItem(Catalog.GetString("Quit"), "", () => { App.Click(); ((GameMainViewModel)BindingContext).HandleMenuAction(this, Catalog.GetString("Quit")); }) { Order = ToolbarItemOrder.Secondary, }; ToolbarItems.Add(toolbarQuit); #endif var grid = new Grid() { RowSpacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; grid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = 60 } }; grid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }; var bottomLayout = new StackLayout() { Spacing = 0, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; #if __IOS__ // Dark grey line on iOS var line = new BoxView () { BackgroundColor = App.Colors.IsDarkTheme ? Color.FromRgb(0x26, 0x26, 0x26) : Color.FromRgb (0xAE, 0xAE, 0xAE), HeightRequest = 0.5f, HorizontalOptions = LayoutOptions.FillAndExpand, }; bottomLayout.Children.Add(line); #endif TapGestureRecognizer tapRecognizer; var buttonLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, BackgroundColor = App.Colors.Bar, HeightRequest = 60, MinimumHeightRequest = 60, HorizontalOptions = LayoutOptions.FillAndExpand, }; // Overview button this.buttonOverview = new GameToolBarButton("IconOverview.png") { HorizontalOptions = LayoutOptions.CenterAndExpand, }; this.buttonOverview.Image.SetBinding(BadgeImage.SelectedProperty, GameMainViewModel.IsOverviewSelectedPropertyName); tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.OverviewCommand, NumberOfTapsRequired = 1 }; this.buttonOverview.GestureRecognizers.Add(tapRecognizer); buttonLayout.Children.Add(this.buttonOverview); // You See button this.buttonYouSee = new GameToolBarButton("IconLocation.png") { HorizontalOptions = LayoutOptions.CenterAndExpand, }; this.buttonYouSee.Image.SetBinding(BadgeImage.SelectedProperty, GameMainViewModel.IsYouSeeSelectedPropertyName); this.buttonYouSee.Image.SetBinding(BadgeImage.NumberProperty, GameMainViewModel.YouSeeNumberPropertyName); tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.YouSeeCommand, NumberOfTapsRequired = 1 }; this.buttonYouSee.GestureRecognizers.Add(tapRecognizer); buttonLayout.Children.Add(this.buttonYouSee); // Inventory button this.buttonInventory = new GameToolBarButton("IconInventory.png") { HorizontalOptions = LayoutOptions.CenterAndExpand, }; this.buttonInventory.Image.SetBinding(BadgeImage.SelectedProperty, GameMainViewModel.IsInventorySelectedPropertyName); this.buttonInventory.Image.SetBinding(BadgeImage.NumberProperty, GameMainViewModel.InventoryNumberPropertyName); tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.InventoryCommand, NumberOfTapsRequired = 1 }; this.buttonInventory.GestureRecognizers.Add(tapRecognizer); buttonLayout.Children.Add(this.buttonInventory); // Tasks button this.buttonTasks = new GameToolBarButton("IconTasks.png") { HorizontalOptions = LayoutOptions.CenterAndExpand, }; this.buttonTasks.Image.SetBinding(BadgeImage.SelectedProperty, GameMainViewModel.IsTasksSelectedPropertyName); this.buttonTasks.Image.SetBinding(BadgeImage.NumberProperty, GameMainViewModel.TasksNumberPropertyName); tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.TasksCommand, NumberOfTapsRequired = 1 }; this.buttonTasks.GestureRecognizers.Add(tapRecognizer); buttonLayout.Children.Add(this.buttonTasks); // Map button this.buttonMap = new GameToolBarButton("IconMap.png") { HorizontalOptions = LayoutOptions.CenterAndExpand, }; this.buttonMap.Image.SetBinding(BadgeImage.SelectedProperty, GameMainViewModel.IsMapSelectedPropertyName); tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.MapCommand, NumberOfTapsRequired = 1 }; this.buttonMap.GestureRecognizers.Add(tapRecognizer); buttonLayout.Children.Add(this.buttonMap); bottomLayout.Children.Add(buttonLayout); var labelEmpty = new Label() { Text = Catalog.GetString("Please wait..."), BackgroundColor = Color.Transparent, TextColor = App.Colors.Text, FontAttributes = FontAttributes.None, FontSize = Settings.FontSize, FontFamily = Settings.FontFamily, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; labelEmpty.SetBinding(Label.TextProperty, GameMainViewModel.EmptyListTextPropertyName); labelEmpty.SetBinding(VisualElement.IsVisibleProperty, GameMainViewModel.IsEmptyListTextVisiblePropertyName); var overviewScroll = new ScrollView() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; overviewScroll.SetBinding(VisualElement.IsVisibleProperty, GameMainViewModel.IsOverviewVisiblePropertyName); var layoutOverview = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; var layoutOverviewYouSee = new StackLayout() { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Spacing = 10, }; tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.YouSeeCommand, NumberOfTapsRequired = 1 }; layoutOverviewYouSee.GestureRecognizers.Add(tapRecognizer); var imageOverviewYouSee = new Image() { Source = "IconLocation.png", VerticalOptions = LayoutOptions.Start, }; layoutOverviewYouSee.Children.Add(imageOverviewYouSee); var labelOverviewYouSee = new ExtendedLabel() { LineBreakMode = LineBreakMode.WordWrap, FontSize = Settings.FontSize * 0.8, FontFamily = Settings.FontFamily, UseMarkdown = true, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, XAlign = TextAlignment.Start, }; labelOverviewYouSee.SetBinding(Label.TextProperty, GameMainViewModel.YouSeeOverviewContentPropertyName); layoutOverviewYouSee.Children.Add(labelOverviewYouSee); layoutOverview.Children.Add(layoutOverviewYouSee); var layoutOverviewInventory = new StackLayout() { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Spacing = 10, }; tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.InventoryCommand, NumberOfTapsRequired = 1 }; layoutOverviewInventory.GestureRecognizers.Add(tapRecognizer); var imageOverviewInventory = new Image() { Source = "IconInventory.png", VerticalOptions = LayoutOptions.Start, }; layoutOverviewInventory.Children.Add(imageOverviewInventory); var labelOverviewInventory = new ExtendedLabel() { LineBreakMode = LineBreakMode.WordWrap, FontSize = Settings.FontSize * 0.8, FontFamily = Settings.FontFamily, UseMarkdown = true, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; labelOverviewInventory.SetBinding(Label.TextProperty, GameMainViewModel.InventoryOverviewContentPropertyName); layoutOverviewInventory.Children.Add(labelOverviewInventory); layoutOverview.Children.Add(layoutOverviewInventory); var layoutOverviewTasks = new StackLayout() { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 10, Spacing = 10, }; tapRecognizer = new TapGestureRecognizer { Command = gameMainViewModel.TasksCommand, NumberOfTapsRequired = 1 }; layoutOverviewTasks.GestureRecognizers.Add(tapRecognizer); var imageOverviewTasks = new Image() { Source = "IconTasks.png", VerticalOptions = LayoutOptions.Start, }; layoutOverviewTasks.Children.Add(imageOverviewTasks); var labelOverviewTasks = new ExtendedLabel() { LineBreakMode = LineBreakMode.WordWrap, FontSize = Settings.FontSize * 0.8, FontFamily = Settings.FontFamily, UseMarkdown = true, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, }; labelOverviewTasks.SetBinding(ExtendedLabel.TextProperty, GameMainViewModel.TasksOverviewContentPropertyName); layoutOverviewTasks.Children.Add(labelOverviewTasks); layoutOverview.Children.Add(layoutOverviewTasks); overviewScroll.Content = layoutOverview; var list = new ListView() { BackgroundColor = Color.Transparent, ItemTemplate = new DataTemplate(typeof(GameMainCellView)), HasUnevenRows = true, SeparatorColor = App.Colors.SeparatorLine, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; list.SetBinding(VisualElement.IsVisibleProperty, GameMainViewModel.IsListVisiblePropertyName); list.SetBinding(ItemsView<Cell>.ItemsSourceProperty, GameMainViewModel.GameMainListPropertyName); list.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { // Get selected MenuEntry GameMainCellViewModel entry = (GameMainCellViewModel)e.SelectedItem; // If MenuEntry is null (unselected item), than leave if (entry == null) { return; } App.Click(); if (entry.UIObject.HasOnClick) { // Object has a OnClick event, so call this entry.UIObject.CallOnClick(); } else { // Show detail screen for object App.Game.ShowScreen(ScreenType.Details, entry.UIObject); } // Deselect MenuEntry list.SelectedItem = null; }; // Map view var mapViewModel = new MapViewModel(); var mapView = new MapView(mapViewModel) { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; mapView.SetBinding(VisualElement.IsVisibleProperty, GameMainViewModel.IsMapSelectedPropertyName); gameMainViewModel.MapViewModel = mapViewModel; var layout = new StackLayout() { BackgroundColor = Color.Transparent, Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; layout.Children.Add(labelEmpty); layout.Children.Add(overviewScroll); layout.Children.Add(list); layout.Children.Add(mapView); grid.Children.Add(layout, 0, 0); grid.Children.Add(bottomLayout, 0, 1); Content = grid; }