Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | Visual C# (55 exercises) |
Topic ==> | Interfaces (2 exercises) |
Level ==> | Harder than average |
Subject ==> | C# training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Create a new project called InterfaceGames. Add all of the files in the above folder into your project apart from the images.
Choose to create a resources file - one way to do this is via your project's properties:
Click on the link shown to create a resources file called Resources.resx.
Change the type of this resources file to hold images:
You can now drag the owl images onto this resources file.
You may well need to spend some time resolving compilation errors to do with namespaces and class names before continuing - nothing ever seems to import first time correctly!
Try running the project with 3 different start forms. This is what you should see:
Start form | What you should see |
---|---|
frmStart | A form with two buttons on, to play Countdown or Pairs. |
frmCountdownLetters | A form for playing the letters game in Countdown. |
frmPairsGame | A form for playing pairs. |
Write an interface so that the following code works (note that the games are quite basic, and aren't the point of this exercise)!
private void btnCountdown_Click(object sender, EventArgs e) {
// button to play Countdown
Countdown g = new Countdown();
RunGame(g);
}
private void btnPairs_Click(object sender, EventArgs e) {
// button to play Pairs
Pairs p = new Pairs();
RunGame(p);
}
private void RunGame(IGame game) {
// play any game which implements IGame interface
game.Play();
MessageBox.Show(game.Results);
}
You'll need to create an IGame interface and Countdown and Pairs classes which implement it.
If you have any spare time, you could always improve on the two games' code!
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.