Exemplo n.º 1
0
        private async void ChooselocationButton_Click(object sender, RoutedEventArgs e)
        {
            ContentDialog dialog = new ContentDialog()
            {
                Title = "Település kiválasztása", PrimaryButtonText = "Mégse"
            };
            StackPanel panel = new StackPanel();

            TextBlock block0 = new TextBlock()
            {
                Text = "A következő település játék közben is kiválasztható.\nA jelenlegi települést nem változik."
            };
            //panel.Children.Add(block0);

            // Add buttons of locations
            List <string> Locations;

            if (!Keyboard.IsKeyDown(Key.LeftShift))
            {
                //Locations = gameWindow.mapping.Locations;
                Locations = gameWindow.mapping.GetAllLocations();
            }
            else
            {
                Locations     = gameWindow.mapping.Locations_auto;
                dialog.Title += " (autopilóta)";
            }

            foreach (string loc in Locations)
            {
                XeZrunner.UI.Controls.Buttons.Button button = new XeZrunner.UI.Controls.Buttons.Button()
                {
                    Text = loc, Background = Brushes.Transparent
                };
                button.Click += (s, ev) => { gameWindow.mapping.ChangeTargetLocation(button.Text); dialog.CloseDialog(); };
                panel.Children.Add(button);
            }

            dialog.Content = panel;

            if (await dialogHost.ShowDialogAsync(dialog) == ContentDialogHost.ContentDialogResult.Primary)
            {
                return;
            }
        }