mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-21 07:17:15 +00:00
feature exchange rate update automation
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.
This commit is contained in:
44
src/bnhtrade.gui/FormConsole.cs
Normal file
44
src/bnhtrade.gui/FormConsole.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user