Currency converter with GUI#
I assume you have gone through section Avalonia GUI framework.
GUIs provide a more intuitive interaction with most users. In next weeks, our projects will be GUI-based.
Activity 32 (Converting currency converter to a GUI app)
In section A currency converter with input we created a currency converter that inputs DKK and outputs EUR equivalent.
What is the input and output to the currency converter?
How does your GUI look like? Sketch it on paper or xaml.io
Browse the controls of the GUI framework. Which controls could be used to implement your GUI?
Create a new GUI project and create your XAML.
Use an event that is associated with your chosen GUI control/s that should trigger the currency conversion process, e.g.,
Click, orTextChanged.Add the corresponding function to the code-behind.
Copy the code from A currency converter with input, paste it to your code (where does it belong to?) and modify it.
Remove
Console-related functions and connect the data input and output to your GUI instead.
Hints
TextBoxhas an event calledTextChangedthat is fired every time the input changes.Use
Double.TryParsethat we learned in section Conversion between datatypes