public override void createview() { Grid mg = new Grid(); RowDefinition rd1 = new RowDefinition(); rd1.Height = new GridLength(4, GridUnitType.Star); mg.RowDefinitions.Add(rd1); mg.RowDefinitions.Add(new RowDefinition()); mg.ColumnDefinitions.Add(new ColumnDefinition()); mg.ColumnDefinitions.Add(new ColumnDefinition()); StackPanel stp = new StackPanel(); TextBlock tb = new TextBlock(); tb.Name = "choose_resolution_text"; tb.Text = SettingsApply.applylangtoel(tb); stp.Children.Add(tb); resolution.Margin = new Thickness(0, 0, 180, 0); TextBlock tb1 = new TextBlock(); tb1.Text = "1024x768"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1280x720"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1280x768"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1280x800"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1280x1024"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1360x768"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1366x768"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1680x1050"; resolution.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "1920x1080"; resolution.Items.Add(tb1); stp.Children.Add(resolution); fullscreen.Name = "fullscreen_check"; fullscreen.Margin = new Thickness(0, 10, 5, 0); fullscreen.HorizontalAlignment = HorizontalAlignment.Right; fullscreen.Content = SettingsApply.applylangtoel(fullscreen); string res = Properties.Settings.Default.Width + "x" + Properties.Settings.Default.Height; for (int i = 0; i < resolution.Items.Count; i++) { TextBlock tx = (TextBlock)resolution.Items[i]; if (tx.Text == res) { resolution.SelectedIndex = i; } } fullscreen.IsChecked = Properties.Settings.Default.Fullscreen; stp.Children.Add(fullscreen); mg.Children.Add(stp); StackPanel stp2 = new StackPanel(); Grid.SetColumn(stp2, 1); TextBlock tb2 = new TextBlock(); tb2.Name = "choose_language_text"; tb2.Text = SettingsApply.applylangtoel(tb2); stp2.Children.Add(tb2); language.Margin = new Thickness(0, 0, 80, 0); tb1 = new TextBlock(); tb1.Text = "English"; tb1.Name = "english"; language.Items.Add(tb1); tb1 = new TextBlock(); tb1.Text = "Українська"; tb1.Name = "ukrainian"; language.Items.Add(tb1); for (int i = 0; i < language.Items.Count; i++) { TextBlock tx = (TextBlock)language.Items[i]; if (tx.Name == Properties.Settings.Default.Language) { language.SelectedIndex = i; } } stp2.Children.Add(language); mg.Children.Add(stp2); Button clb = new Button(); Grid.SetRow(clb, 1); clb.Name = "close_button"; clb.Content = SettingsApply.applylangtoel(clb); clb.Margin = new Thickness(40, 10, 50, 10); clb.Click += new RoutedEventHandler(cancel_button_Click); mg.Children.Add(clb); Button sb = new Button(); Grid.SetRow(sb, 1); Grid.SetColumn(sb, 1); sb.Name = "save_changes_button"; sb.Content = SettingsApply.applylangtoel(sb); sb.Margin = new Thickness(50, 10, 40, 10); sb.Click += new RoutedEventHandler(save_changes_button_Click); mg.Children.Add(sb); maintab.Content = mg; }
public override void createview() { Grid mg = new Grid(); RowDefinition rd1 = new RowDefinition(); rd1.Height = new GridLength(0.5, GridUnitType.Star); mg.RowDefinitions.Add(rd1); mg.RowDefinitions.Add(new RowDefinition()); rd1 = new RowDefinition(); rd1.Height = new GridLength(0.2, GridUnitType.Star); mg.RowDefinitions.Add(rd1); mg.RowDefinitions.Add(new RowDefinition()); rd1 = new RowDefinition(); rd1.Height = new GridLength(0.2, GridUnitType.Star); mg.RowDefinitions.Add(rd1); mg.RowDefinitions.Add(new RowDefinition()); rd1 = new RowDefinition(); rd1.Height = new GridLength(0.2, GridUnitType.Star); mg.RowDefinitions.Add(rd1); mg.RowDefinitions.Add(new RowDefinition()); rd1 = new RowDefinition(); rd1.Height = new GridLength(0.5, GridUnitType.Star); mg.RowDefinitions.Add(rd1); ColumnDefinition cd = new ColumnDefinition(); cd.Width = new GridLength(0.3, GridUnitType.Star); mg.ColumnDefinitions.Add(cd); mg.ColumnDefinitions.Add(new ColumnDefinition()); cd = new ColumnDefinition(); cd.Width = new GridLength(0.3, GridUnitType.Star); mg.ColumnDefinitions.Add(cd); Button ng = new Button(); Grid.SetColumn(ng, 1); Grid.SetRow(ng, 1); ng.Name = "new_game_button"; ng.Content = SettingsApply.applylangtoel(ng); ng.Click += new RoutedEventHandler(New_Game_Click); mg.Children.Add(ng); Button lg = new Button(); Grid.SetColumn(lg, 1); Grid.SetRow(lg, 3); lg.Name = "load_game_button"; lg.Content = SettingsApply.applylangtoel(lg); //ng.Click += new RoutedEventHandler(New_Game_Click); mg.Children.Add(lg); Button set = new Button(); Grid.SetColumn(set, 1); Grid.SetRow(set, 5); set.Name = "settings_button"; set.Content = SettingsApply.applylangtoel(set); set.Click += new RoutedEventHandler(Settings_Click); mg.Children.Add(set); Button ex = new Button(); Grid.SetColumn(ex, 1); Grid.SetRow(ex, 7); ex.Name = "exit_button"; ex.Content = SettingsApply.applylangtoel(ex); ex.Click += new RoutedEventHandler(Exit_Click); mg.Children.Add(ex); maintab.Content = mg; }