private void createAirline()
        {
            string name = txtName.Text.Trim();
            string iata = txtIATA.Text.Trim().ToUpper();
            string ceo  = txtCEO.Text.Trim();

            Airline tAirline = Airlines.GetAirline(iata);

            if (tAirline != null)
            {
                Airlines.RemoveAirline(tAirline);
            }

            Country country = (Country)cbCountry.SelectedItem;
            string  color   = ((PropertyInfo)cbColor.SelectedItem).Name;

            AirlineProfile profile = new AirlineProfile(name, iata, color, ceo, false, 1950, 2199);

            profile.Countries = new List <Country>()
            {
                country
            };
            profile.Country = country;
            profile.addLogo(new AirlineLogo(logoPath));
            profile.PreferedAirport = cbAirport.SelectedItem != null ? (Airport)cbAirport.SelectedItem : null;

            Route.RouteType focus = rbPassengerType.IsChecked.Value ? Route.RouteType.Passenger : Route.RouteType.Cargo;

            Airline airline = new Airline(profile, Airline.AirlineMentality.Aggressive, Airline.AirlineFocus.Local, Airline.AirlineLicense.Domestic, focus);

            Airlines.AddAirline(airline);

            WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2405"), Translator.GetInstance().GetString("MessageBox", "2405", "message"), WPFMessageBoxButtons.Ok);
        }
        //creates the airline
        private void createAirline()
        {
            Airline tAirline = Airlines.GetAirline(txtIATA.Text.Trim().ToUpper());

            if (tAirline != null)
            {
                Airlines.RemoveAirline(tAirline);
            }

            string  name    = txtAirlineName.Text.Trim();
            string  iata    = txtIATA.Text.Trim().ToUpper();
            Country country = (Country)cbCountry.SelectedItem;
            string  color   = ((PropertyInfo)cbColor.SelectedItem).Name;

            AirlineProfile profile = new AirlineProfile(name, iata, color, "Unknown", false, 1950, 2199);

            profile.Countries = new List <Country>()
            {
                country
            };
            profile.Country = country;
            profile.addLogo(new AirlineLogo(logoPath));

            Airline airline = new Airline(profile, Airline.AirlineMentality.Aggressive, Airline.AirlineFocus.Local, Airline.AirlineLicense.Domestic, airlinerType);

            Airlines.AddAirline(airline);


            PageNavigator.NavigateTo(new PageNewGame());
        }
        private void btnLoadAirline_Click(object sender, RoutedEventArgs e)
        {
            string directory = AppSettings.getCommonApplicationDataPath() + "\\custom airlines";

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.DefaultExt       = ".xml";
            dlg.Filter           = "Airline XMLs (.xml)|*.xml";
            dlg.InitialDirectory = System.IO.Path.GetFullPath(directory);
            dlg.Multiselect      = false;

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                string path = dlg.FileName;

                Airline airline = Setup.LoadAirline(path);

                string imagePath = string.Format("{0}\\{1}.png", directory, airline.Profile.IATACode);

                if (File.Exists(imagePath))
                {
                    airline.Profile.addLogo(new AirlineLogo(imagePath));
                }
                else
                {
                    airline.Profile.addLogo(new AirlineLogo(AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png"));
                }

                if (Airlines.GetAirline(airline.Profile.IATACode) != null)
                {
                    Airlines.RemoveAirlines(a => a.Profile.IATACode == airline.Profile.IATACode);
                }

                Airlines.AddAirline(airline);

                var airlines = Airlines.GetAirlines(a => (a.Profile.Country.Region == this.StartData.Region || (this.StartData.Region.Uid == "100" && this.StartData.Continent.Uid == "100") || (this.StartData.Region.Uid == "100" && this.StartData.Continent.hasRegion(a.Profile.Country.Region))) && a.Profile.Founded <= this.StartData.Year && a.Profile.Folded > this.StartData.Year).OrderBy(a => a.Profile.Name).ToList();

                cbAirline.ItemsSource = airlines;

                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2409"), Translator.GetInstance().GetString("MessageBox", "2409", "message"), WPFMessageBoxButtons.Ok);

                if (cbAirline.Items.Contains(airline))
                {
                    cbAirline.SelectedItem = airline;
                }
            }
        }
        //creates the link for a news link
        private Hyperlink getNewsLink(string text)
        {
            string linkType   = text.Substring(3).Split('=')[0];
            string linkObject = text.Split('=')[1];
            object o          = null;

            string objectText = "";

            switch (linkType)
            {
            case "airline":
                o          = Airlines.GetAirline(linkObject);
                objectText = ((Airline)o).Profile.Name;
                break;

            case "airport":
                o          = Airports.GetAirport(linkObject);
                objectText = ((Airport)o).Profile.Name;
                break;

            case "airliner":
                o          = Airlines.GetAllAirlines().SelectMany(a => a.Fleet).ToList().Find(f => f.Airliner.TailNumber == linkObject);
                objectText = ((FleetAirliner)o).Name;
                break;
            }


            Run run = new Run(objectText);

            Hyperlink hyperLink = new Hyperlink(run);

            hyperLink.Tag             = o;
            hyperLink.TextDecorations = TextDecorations.Underline;
            hyperLink.TargetName      = linkType;
            hyperLink.Click          += new RoutedEventHandler(hyperLink_Click);

            return(hyperLink);
        }
        private void btnCreateAndSave_Click(object sender, RoutedEventArgs e)
        {
            string name = txtName.Text.Trim();
            string iata = txtIATA.Text.Trim().ToUpper();

            string pattern = @"^[A-Za-z0-9]+$";
            Regex  regex   = new Regex(pattern);

            if (name.Length > 0 && iata.Length == 2 && regex.IsMatch(iata))
            {
                Airline airline = Airlines.GetAirline(iata);

                if (airline != null)
                {
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2401"), string.Format(Translator.GetInstance().GetString("MessageBox", "2401", "message"), airline.Profile.Name), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        Airline nAirline = createAirline();
                        saveAirline(nAirline);
                    }
                }
                else
                {
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2402"), Translator.GetInstance().GetString("MessageBox", "2402", "message"), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        Airline nAirline = createAirline();
                        saveAirline(nAirline);
                    }
                }
            }
            else
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2404"), Translator.GetInstance().GetString("MessageBox", "2404", "message"), WPFMessageBoxButtons.Ok);
            }
        }
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Airline airline = Airlines.GetAirline(txtIATA.Text.Trim().ToUpper());

            if (airline != null)
            {
                WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2401"), string.Format(Translator.GetInstance().GetString("MessageBox", "2401", "message"), airline.Profile.Name), WPFMessageBoxButtons.YesNo);

                if (result == WPFMessageBoxResult.Yes)
                {
                    createAirline();
                }
            }
            else
            {
                WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2402"), Translator.GetInstance().GetString("MessageBox", "2402", "message"), WPFMessageBoxButtons.YesNo);

                if (result == WPFMessageBoxResult.Yes)
                {
                    createAirline();
                }
            }
        }
Example #7
0
        public PageNewGame()
        {
            OpponentType = OpponentSelect.Random;

            InitializeComponent();

            popUpSplash = new Popup();

            popUpSplash.Child           = UICreator.CreateSplashWindow();
            popUpSplash.Placement       = PlacementMode.Center;
            popUpSplash.PlacementTarget = PageNavigator.MainWindow;
            popUpSplash.IsOpen          = false;

            StackPanel panelContent = new StackPanel();

            panelContent.Margin = new Thickness(10, 0, 10, 0);
            panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

            Panel panelLogo = UICreator.CreateGameLogo();

            panelLogo.Margin = new Thickness(0, 0, 0, 20);

            panelContent.Children.Add(panelLogo);

            TextBlock txtHeader = new TextBlock();

            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtHeader.FontWeight = FontWeights.Bold;
            txtHeader.Uid        = "1001";
            txtHeader.Text       = Translator.GetInstance().GetString("PageNewGame", txtHeader.Uid);
            panelContent.Children.Add(txtHeader);

            lbContentBasics = new ListBox();
            lbContentBasics.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbContentBasics.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbContentBasics.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;

            txtNarrative = new TextBox();
            txtNarrative.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            txtNarrative.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            txtNarrative.Background          = Brushes.Transparent;
            txtNarrative.TextWrapping        = TextWrapping.Wrap;
            txtNarrative.FontStyle           = FontStyles.Italic;
            txtNarrative.Width      = 500;
            txtNarrative.Height     = 100;
            txtNarrative.Uid        = "1015";
            txtNarrative.IsReadOnly = true;
            txtNarrative.Text       = Translator.GetInstance().GetString("PageNewGame", txtNarrative.Uid);
            txtNarrative.Visibility = System.Windows.Visibility.Collapsed;

            panelContent.Children.Add(txtNarrative);

            panelContent.Children.Add(lbContentBasics);

            lbContentHuman            = new ListBox();
            lbContentHuman.Visibility = System.Windows.Visibility.Collapsed;
            lbContentHuman.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            lbContentHuman.MaxHeight  = GraphicsHelpers.GetContentHeight() / 2;
            lbContentHuman.Visibility = System.Windows.Visibility.Collapsed;

            panelContent.Children.Add(lbContentHuman);

            cbContinent = new ComboBox();
            cbContinent.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbContinent.Width             = 200;
            cbContinent.DisplayMemberPath = "Name";
            cbContinent.SelectedValuePath = "Name";

            cbContinent.Items.Add(new Continent("100", "All continents"));

            foreach (Continent continent in Continents.GetContinents().OrderBy(c => c.Name))
            {
                cbContinent.Items.Add(continent);
            }

            cbContinent.SelectionChanged += cbContinent_SelectionChanged;
            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1022"), cbContinent));

            cbRegion = new ComboBox();
            cbRegion.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbRegion.Width             = 200;
            cbRegion.DisplayMemberPath = "Name";
            cbRegion.SelectedValuePath = "Name";

            cbRegion.Items.Add(Regions.GetRegion("100"));
            foreach (Region region in Regions.GetRegions().FindAll(r => Airlines.GetAirlines(r).Count > 0).OrderBy(r => r.Name))
            {
                cbRegion.Items.Add(region);
            }

            cbRegion.SelectionChanged += new SelectionChangedEventHandler(cbRegion_SelectionChanged);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1012"), cbRegion));
            // chs, 2011-19-10 added for the possibility of creating a new airline
            WrapPanel panelAirline = new WrapPanel();

            cbAirline = new ComboBox();
            cbAirline.SetResourceReference(ComboBox.ItemTemplateProperty, "AirlineLogoItem");
            cbAirline.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirline.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirline.SelectionChanged   += new SelectionChangedEventHandler(cbAirline_SelectionChanged);
            cbAirline.Width = 200;

            List <Airline> airlines = Airlines.GetAllAirlines();

            airlines.Sort((delegate(Airline a1, Airline a2) { return(a1.Profile.Name.CompareTo(a2.Profile.Name)); }));

            cbAirline.ItemsSource = airlines;

            panelAirline.Children.Add(cbAirline);

            Button btnAddAirline = new Button();

            btnAddAirline.Margin     = new Thickness(5, 0, 0, 0);
            btnAddAirline.Background = Brushes.Transparent;
            btnAddAirline.Click     += new RoutedEventHandler(btnAddAirline_Click);

            Image imgAddAirline = new Image();

            imgAddAirline.Source = new BitmapImage(new Uri(@"/Data/images/add.png", UriKind.RelativeOrAbsolute));
            imgAddAirline.Height = 16;
            RenderOptions.SetBitmapScalingMode(imgAddAirline, BitmapScalingMode.HighQuality);

            btnAddAirline.Content = imgAddAirline;

            panelAirline.Children.Add(btnAddAirline);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1002"), panelAirline));

            txtIATA = UICreator.CreateTextBlock("");
            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1003"), txtIATA));

            txtAirlineType = UICreator.CreateTextBlock("");
            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1021"), txtAirlineType));

            StackPanel panelCountry = new StackPanel();

            cbCountry = new ComboBox();
            cbCountry.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbCountry.SetResourceReference(ComboBox.ItemTemplateProperty, "CountryFlagLongItem");
            cbCountry.Width             = 150;
            cbCountry.SelectionChanged += cbCountry_SelectionChanged;

            panelCountry.Children.Add(cbCountry);

            cbLocalCurrency = new CheckBox();
            cbLocalCurrency.FlowDirection       = System.Windows.FlowDirection.RightToLeft;
            cbLocalCurrency.Content             = Translator.GetInstance().GetString("PageNewGame", "1014");
            cbLocalCurrency.VerticalAlignment   = System.Windows.VerticalAlignment.Bottom;
            cbLocalCurrency.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

            panelCountry.Children.Add(cbLocalCurrency);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1004"), panelCountry));


            txtName             = new TextBox();
            txtName.Background  = Brushes.Transparent;
            txtName.BorderBrush = Brushes.Black;
            txtName.Width       = 200;


            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1005"), txtName));

            // chs, 2011-19-10 added to show the airline color
            airlineColorRect                 = new Rectangle();
            airlineColorRect.Width           = 40;
            airlineColorRect.Height          = 20;
            airlineColorRect.StrokeThickness = 1;
            airlineColorRect.Stroke          = Brushes.Black;
            airlineColorRect.Fill            = new AirlineBrushConverter().Convert(Airlines.GetAirline("ZA")) as Brush;
            airlineColorRect.Margin          = new Thickness(0, 2, 0, 2);

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1006"), airlineColorRect));

            cbAirport = new ComboBox();
            cbAirport.SetResourceReference(ComboBox.ItemTemplateProperty, "AirportCountryItem");
            cbAirport.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirport.IsSynchronizedWithCurrentItem = true;
            cbAirport.HorizontalAlignment           = System.Windows.HorizontalAlignment.Left;
            cbAirport.SelectionChanged += new SelectionChangedEventHandler(cbAirports_SelectionChanged);

            List <Airport> airportsList = Airports.GetAllAirports();

            airportsView = CollectionViewSource.GetDefaultView(airportsList);
            airportsView.SortDescriptions.Add(new SortDescription("Profile.Name", ListSortDirection.Ascending));

            cbAirport.ItemsSource = airportsView;

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1007"), cbAirport));

            cbStartYear = new ComboBox();
            cbStartYear.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbStartYear.Width = 60;
            for (int i = GameObject.StartYear; i < DateTime.Now.Year + 2; i++)
            {
                cbStartYear.Items.Add(i);
            }

            cbStartYear.SelectionChanged += new SelectionChangedEventHandler(cbStartYear_SelectionChanged);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1008"), cbStartYear));

            cbTimeZone = new ComboBox();
            cbTimeZone.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbTimeZone.Width             = 300;
            cbTimeZone.DisplayMemberPath = "DisplayName";
            cbTimeZone.SelectedValuePath = "DisplayName";


            foreach (GameTimeZone gtz in TimeZones.GetTimeZones())
            {
                cbTimeZone.Items.Add(gtz);
            }

            cbTimeZone.SelectedItem = TimeZones.GetTimeZones().Find(delegate(GameTimeZone gtz) { return(gtz.UTCOffset == new TimeSpan(0, 0, 0)); });

            lbContentHuman.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1009"), cbTimeZone));

            cbFocus = new ComboBox();
            cbFocus.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbFocus.Width = 100;

            foreach (Airline.AirlineFocus focus in Enum.GetValues(typeof(Airline.AirlineFocus)))
            {
                cbFocus.Items.Add(focus);
            }

            cbFocus.SelectedIndex = 0;

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1013"), cbFocus));

            WrapPanel panelDifficulty = new WrapPanel();

            cbDifficulty = new ComboBox();
            cbDifficulty.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbDifficulty.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbDifficulty.Width             = 100;
            cbDifficulty.DisplayMemberPath = "Name";
            cbDifficulty.SelectedValuePath = "Name";

            foreach (DifficultyLevel difficulty in DifficultyLevels.GetDifficultyLevels())
            {
                cbDifficulty.Items.Add(difficulty);
            }

            cbDifficulty.SelectedIndex = 0;

            panelDifficulty.Children.Add(cbDifficulty);

            Button btnAddDifficulty = new Button();

            btnAddDifficulty.Margin     = new Thickness(5, 0, 0, 0);
            btnAddDifficulty.Background = Brushes.Transparent;
            btnAddDifficulty.Click     += new RoutedEventHandler(btnAddDifficulty_Click);

            Image imgAddDifficulty = new Image();

            imgAddDifficulty.Source = new BitmapImage(new Uri(@"/Data/images/add.png", UriKind.RelativeOrAbsolute));
            imgAddDifficulty.Height = 16;
            RenderOptions.SetBitmapScalingMode(imgAddDifficulty, BitmapScalingMode.HighQuality);

            btnAddDifficulty.Content = imgAddDifficulty;

            panelDifficulty.Children.Add(btnAddDifficulty);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1011"), panelDifficulty));

            WrapPanel panelOpponents = new WrapPanel();

            cbOpponents = new ComboBox();
            cbOpponents.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbOpponents.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbOpponents.Width = 50;
            cbOpponents.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
            for (int i = 0; i < Airlines.GetAllAirlines().Count; i++)
            {
                cbOpponents.Items.Add(i);
            }

            cbOpponents.SelectedIndex = 3;

            panelOpponents.Children.Add(cbOpponents);

            cbSameRegion = new CheckBox();
            cbSameRegion.FlowDirection     = System.Windows.FlowDirection.RightToLeft;
            cbSameRegion.Content           = Translator.GetInstance().GetString("PageNewGame", "1017");
            cbSameRegion.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            cbSameRegion.Margin            = new Thickness(5, 0, 0, 0);

            panelOpponents.Children.Add(cbSameRegion);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1010"), panelOpponents));

            WrapPanel panelOpponentSelect = new WrapPanel();

            RadioButton rbRandomOpponents = new RadioButton();

            rbRandomOpponents.IsChecked = true;
            rbRandomOpponents.GroupName = "Opponent";
            rbRandomOpponents.Content   = Translator.GetInstance().GetString("PageNewGame", "1018");
            rbRandomOpponents.Checked  += rbRandomOpponents_Checked;

            panelOpponentSelect.Children.Add(rbRandomOpponents);

            RadioButton rbSelectOpponents = new RadioButton();

            rbSelectOpponents.GroupName = "Opponent";
            rbSelectOpponents.Content   = Translator.GetInstance().GetString("PageNewGame", "1019");
            rbSelectOpponents.Checked  += rbSelectOpponents_Checked;
            rbSelectOpponents.Margin    = new Thickness(5, 0, 0, 0);

            panelOpponentSelect.Children.Add(rbSelectOpponents);

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1020"), panelOpponentSelect));

            cbDayTurnEnabled = new CheckBox();
            cbDayTurnEnabled.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            cbDayTurnEnabled.IsChecked         = true;

            lbContentBasics.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageNewGame", "1016"), cbDayTurnEnabled));

            WrapPanel panelButtons = new WrapPanel();

            panelButtons.Margin = new Thickness(0, 5, 0, 0);
            panelContent.Children.Add(panelButtons);

            btnCreate = new Button();
            btnCreate.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnCreate.Click  += new RoutedEventHandler(btnCreate_Click);
            btnCreate.Height  = Double.NaN;
            btnCreate.Width   = Double.NaN;
            btnCreate.Uid     = "203";
            btnCreate.Content = Translator.GetInstance().GetString("PageNewGame", btnCreate.Uid);
            btnCreate.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelButtons.Children.Add(btnCreate);

            btnBack = new Button();
            btnBack.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnBack.Height  = Double.NaN;
            btnBack.Width   = Double.NaN;
            btnBack.Uid     = "119";
            btnBack.Content = Translator.GetInstance().GetString("General", btnBack.Uid);
            btnBack.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            btnBack.Margin     = new Thickness(5, 0, 0, 0);
            btnBack.Click     += btnBack_Click;
            btnBack.Visibility = System.Windows.Visibility.Collapsed;
            panelButtons.Children.Add(btnBack);

            Button btnExit = new Button();

            btnExit.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnExit.Height  = double.NaN;
            btnExit.Width   = double.NaN;
            btnExit.Uid     = "202";
            btnExit.Content = Translator.GetInstance().GetString("PageNewGame", btnExit.Uid);
            btnExit.Margin  = new Thickness(5, 0, 0, 0);
            btnExit.Click  += new RoutedEventHandler(btnCancel_Click);
            btnExit.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
            panelButtons.Children.Add(btnExit);

            base.setTopMenu(new PageTopMenu());

            base.hideNavigator();

            base.hideBottomMenu();

            base.setContent(panelContent);

            base.setHeaderContent(Translator.GetInstance().GetString("PageNewGame", "200"));

            cbStartYear.SelectedItem = DateTime.Now.Year;



            showPage(this);
        }