private void RealizarGuardadoTxt() { if (this.btnGuardarTxt.InvokeRequired) { CrearDelegate d = new CrearDelegate(RealizarGuardadoTxt); this.Invoke(d); } else { using (StreamWriter sw = new StreamWriter("..\\..\\..\\Listado_Companions.txt", true, Encoding.UTF8)) { sw.WriteLine(this.lblHora.Text + "\n"); sw.WriteLine(Factory.MostrarListado <Companion>()); sw.Write("==============================\n"); } } }
/// <summary> /// Escribe el listado de Companions en un archivo de texto. /// </summary> public void RealizarGuardadoTxt() { if (this.btnGuardarTxt.InvokeRequired) { CrearDelegate d = new CrearDelegate(RealizarGuardadoTxt); this.Invoke(d); } else { using (StreamWriter sw = new StreamWriter("Archivos\\listado_companions.txt", true, Encoding.UTF8)) { sw.WriteLine(this.lblHora.Text + "\n"); sw.WriteLine(Factory.MostrarListado <Companion>()); sw.Write("==============================\n\n"); } MessageBox.Show($"Companion agregado al archivo de texto.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } }