public override void Execute(object parameter) { if (parameter is VMSecciones) { VMSecciones Seccion = this.viewModelPadre.ventanaPadre.ComboSecciones.SelectedItem as VMSecciones; string TextoSeccion = viewModelPadre.TextoSeccion; string[] TextoSeparado = TextoSeccion.Split('\n'); TextoSeccion = String.Empty; string TextoParrafo = @"<p class='SeccionesParrafo'>"; for (int i = 0; i < TextoSeparado.Length; i++) { TextoSeccion += (i == 0?TextoParrafo:"<p>") + TextoSeparado[i] + "</p>"; } this.viewModelPadre.SeccionElegida = new VMSecciones { IdSeccion = Seccion.IdSeccion, TextoSeccion = TextoSeccion }; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(this.GuardaSeccionDoWork); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.GuardaSeccionCompleted); worker.RunWorkerAsync(); } }
public CommandSecciones(VMSecciones instancia) { viewModelPadre = instancia; }