private void editarApunte(object sender, RoutedEventArgs e) { Button boton = sender as Button; if (boton.Content.Equals("MODIFICAR")) { boton.Content = "GUARDAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF7B9763"); cbTipoApuntes.IsEnabled = true; cbTipoApuntes.IsReadOnly = false; txtNombreApuntes.IsEnabled = true; txtNombreApuntes.IsReadOnly = false; txtEnlaceApuntes.IsEnabled = true; txtEnlaceApuntes.IsReadOnly = false; txtDescripcionAputnes.IsEnabled = true; txtDescripcionAputnes.IsReadOnly = false; } else { // PEDIMOS CONFIRMACIÓN MessageBoxResult messageBoxResult = Utils.msgBox("¿Desea guardar los cambios?", "yesno", "question"); if (messageBoxResult == MessageBoxResult.Yes) { // SI EL FORMULARIO SE VALIDA CORRECTAMENTE PROCEDEMOS A REALIZAR EL INSERT if (validarFormulario()) { string nombre = Utils.initCap(txtNombreApuntes.Text, "no"); string tipo = cbTipoApuntes.Text.ToString(); string enlace = txtEnlaceApuntes.Text; string descripcion = txtDescripcionAputnes.Text; WebService webService = new WebService(); EstadoMensajeResponse response = webService.editarApuntes(this.idApunte, this.asignatura.id, nombre, tipo, enlace, descripcion); if (response.estado == 1) { Utils.msgBox(response.mensaje, "ok", "info"); ((MainWindow)this.Owner).cargarApuntesClases(); boton.Content = "MODIFICAR"; boton.Background = (Brush) new BrushConverter().ConvertFrom("#FF979563"); cbTipoApuntes.IsEnabled = false; cbTipoApuntes.IsReadOnly = true; txtNombreApuntes.IsEnabled = false; txtNombreApuntes.IsReadOnly = true; txtEnlaceApuntes.IsEnabled = false; txtEnlaceApuntes.IsReadOnly = true; txtDescripcionAputnes.IsEnabled = false; txtDescripcionAputnes.IsReadOnly = true; } else { Utils.msgBox(response.mensaje, "ok", "warning"); } } } } }