Skip to content

Commit bc143cd

Browse files
authored
After stream demos (#80)
1 parent 5db3541 commit bc143cd

File tree

17 files changed

+900
-0
lines changed

17 files changed

+900
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Session 0501 - Introduction to WinForms
2+
3+
Let's learn a little about the history of Windows Forms, how you should get started with it today, and its purpose going forward.
4+
5+
## WinForms History and Future
6+
7+
### NETFX
8+
9+
### NetCore 3+
10+
11+
### The Future
12+
13+
### Pros and Cons
14+
15+
- Windows Only
16+
- With NetFx, all machines running Windows can run your app with minimal installation
17+
- Designer friendly: Easy to start putting controls on a form and provide immediate value
18+
- Battleship Gray FTW!
19+
- Event-driven application framework
20+
21+
## Building our first application - A Calculator
22+
23+
### The default template
24+
25+
### Visual Studio Designer and Toolbox
26+
27+
- Properties box
28+
29+
### Startup and Program.cs
30+
31+
### The Form
32+
33+
- Designer file
34+
- Title
35+
- Modal
36+
-
37+
38+
### Controls
39+
40+
- Label
41+
- Textbox
42+
- Button
43+
44+
### Control Docking
45+
46+
### Event Handlers
47+
48+
## Adding Style
49+

sessions/Season-05/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Season 5 - Windows Application Development with Winforms and WPF
2+
3+
In this season, we will look at the two technologies that have been predominantly used to build Windows applications over the last 20 years: Windows Forms and WPF. Chances are, you are using a number of Windows Forms and WPF applications every day as these frameworks dominate the windows application space.
4+

sessions/Season-05/src/MyApp/Form1.Designer.cs

Lines changed: 258 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sessions/Season-05/src/MyApp/Form1.cs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Transactions;
10+
using System.Windows.Forms;
11+
12+
namespace MyApp
13+
{
14+
15+
public partial class Form1 : Form
16+
{
17+
18+
private decimal _Buffer = 0;
19+
private char _Operation = ' ';
20+
21+
public Form1()
22+
{
23+
InitializeComponent();
24+
}
25+
26+
private void NumberButton_Click(object sender, EventArgs e)
27+
{
28+
29+
var button = sender as Button;
30+
31+
if (CalculatorScreen.Text == "0.")
32+
{
33+
CalculatorScreen.Text = button.Text;
34+
}
35+
else
36+
{
37+
CalculatorScreen.Text += button.Text;
38+
}
39+
40+
}
41+
42+
private void button13_Click(object sender, EventArgs e)
43+
{
44+
45+
if (_Operation == ' ') {
46+
_Operation = '+';
47+
_Buffer = decimal.Parse(CalculatorScreen.Text);
48+
CalculatorScreen.Text = "0.";
49+
} else {
50+
51+
decimal currentValue = decimal.Parse(CalculatorScreen.Text);
52+
53+
CalculatorScreen.Text = _Operation switch
54+
{
55+
'+' => (_Buffer + currentValue).ToString(),
56+
'-' => (_Buffer - currentValue).ToString(),
57+
'x' => (_Buffer * currentValue).ToString(),
58+
'/' => (_Buffer / currentValue).ToString(),
59+
_ => "0."
60+
};
61+
62+
_Buffer = 0;
63+
_Operation = ' ';
64+
65+
}
66+
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)