public void EditIdioma(DIdiomaHablado idiomaHablado, int id) { var Idi = new MIdiomaHablado().EncontrarIdioma(idiomaHablado.idIdioma)[0]; IdiomaHablado[id] = idiomaHablado; ModelHI[id] = new ModelIdiomaHablado(Idi.nombre, idiomaHablado.nivel); RefreshDGIdiomas(); }
Border CreateRow(ModelIdiomaHablado Model, DIdiomaHablado DIH) { string Nivel = DIH.nivel == 0 ? "Básico" : DIH.nivel == 1 ? "Intermedio" : DIH.nivel == 2 ? "Avanzado" : DIH.nivel == 3 ? "Fluido" : "ERROR"; Border MainBord = new Border(); MainBord.BorderBrush = Brushes.Black; MainBord.BorderThickness = new Thickness(0); Grid Divider = new Grid(); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) } ); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) } ); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) } ); StackPanel SPContent = new StackPanel(); SPContent.SetValue(Grid.ColumnProperty, 1); SPContent.MaxHeight = 50; Divider.Children.Add(SPContent); TextBlock NameText = new TextBlock(); NameText.Text = Model.nombreIdioma.ToUpper(); NameText.MaxHeight = 35; NameText.TextWrapping = TextWrapping.Wrap; NameText.TextTrimming = TextTrimming.CharacterEllipsis; NameText.FontWeight = FontWeights.Bold; NameText.FontSize = 12; NameText.Margin = new Thickness(5, 0, 5, 0); SPContent.Children.Add(NameText); TextBlock LevelText = new TextBlock(); LevelText.Text = Nivel; LevelText.FontSize = 10; LevelText.TextWrapping = TextWrapping.Wrap; LevelText.TextTrimming = TextTrimming.CharacterEllipsis; LevelText.Margin = new Thickness(5, 0, 5, 0); SPContent.Children.Add(LevelText); MainBord.Child = Divider; return(MainBord); }
Border CreateRow(ModelIdiomaHablado Model, DIdiomaHablado DIH) { string Nivel = DIH.nivel == 0 ? "Básico" : DIH.nivel == 1 ? "Intermedio" : DIH.nivel == 2 ? "Avanzado" : DIH.nivel == 3 ? "Fluido" : "ERROR"; Border MainBord = new Border(); MainBord.BorderBrush = Brushes.Black; MainBord.BorderThickness = new Thickness(0); Grid Divider = new Grid(); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) } ); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) } ); Divider.ColumnDefinitions.Add( new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) } ); Button DeleteButton = new Button(); DeleteButton.SetValue(Grid.ColumnProperty, 0); DeleteButton.Background = DeleteButton.BorderBrush = Brushes.Transparent; DeleteButton.Margin = new Thickness(10, 2, 10, 2); DeleteButton.Padding = new Thickness(0); DeleteButton.Height = 17; Image delImg = new Image(); string packUri = @"/Img/delete.png"; delImg.Source = new BitmapImage(new Uri(packUri, UriKind.Relative)); RenderOptions.SetBitmapScalingMode(delImg, BitmapScalingMode.HighQuality); DeleteButton.Click += new RoutedEventHandler(BtnIdiDelete_Click); DeleteButton.CommandParameter = DIH.idIdiomaHablado; DeleteButton.Content = delImg; Divider.Children.Add(DeleteButton); StackPanel SPContent = new StackPanel(); SPContent.SetValue(Grid.ColumnProperty, 1); SPContent.MaxHeight = 50; Divider.Children.Add(SPContent); TextBlock NameText = new TextBlock(); NameText.Text = Model.nombreIdioma.ToUpper(); NameText.MaxHeight = 35; NameText.TextWrapping = TextWrapping.Wrap; NameText.TextTrimming = TextTrimming.CharacterEllipsis; NameText.FontWeight = FontWeights.Bold; NameText.FontSize = 12; NameText.Margin = new Thickness(5, 0, 5, 0); SPContent.Children.Add(NameText); TextBlock LevelText = new TextBlock(); LevelText.Text = Nivel; LevelText.FontSize = 10; LevelText.TextWrapping = TextWrapping.Wrap; LevelText.TextTrimming = TextTrimming.CharacterEllipsis; LevelText.Margin = new Thickness(5, 0, 5, 0); SPContent.Children.Add(LevelText); Button EditButton = new Button(); EditButton.SetValue(Grid.ColumnProperty, 2); EditButton.Background = EditButton.BorderBrush = Brushes.Transparent; EditButton.Margin = new Thickness(10, 3, 10, 3); EditButton.Padding = new Thickness(0); EditButton.Height = 17; Image editImg = new Image(); string packUri2 = @"/Img/edit.png"; editImg.Source = new BitmapImage(new Uri(packUri2, UriKind.Relative)); EditButton.Click += new RoutedEventHandler(BtnIdiUpdate_Click); EditButton.CommandParameter = DIH.idIdiomaHablado; EditButton.Content = editImg; Divider.Children.Add(EditButton); MainBord.Child = Divider; return(MainBord); }