mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 14:37:16 +00:00
Automated downloading exchange rates from HMRC and updating the database. Added function call to the console and form applications. Also added a form to show the console output in form application.
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using ConsoleRedirection;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace bnhtrade.gui
|
|
{
|
|
public partial class FormConsole : Form
|
|
{
|
|
// That's our custom TextWriter class
|
|
TextWriter _writer = null;
|
|
|
|
public FormConsole()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FormConsole_Load(object sender, EventArgs e)
|
|
{
|
|
// Instantiate the writer
|
|
_writer = new TextBoxStreamWriter(txtConsole);
|
|
// Redirect the out Console stream
|
|
Console.SetOut(_writer);
|
|
}
|
|
|
|
// This is called when the "Say Hello" button is clicked
|
|
private void txtSayHello_Click(object sender, EventArgs e)
|
|
{
|
|
// Writing to the Console now causes the text to be displayed in the text box.
|
|
Console.WriteLine("Hello world");
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|