Debian Codegraph @

external/rx/Rx/NET/Samples/HOL/CS/Excercise3/Step04/Program.cs

raw
1 using System;
2 using System.Reactive.Linq;
3 using System.Windows.Forms;
4
5 namespace Excercise3
6 {
7 class Program
8 {
9 static void Main()
10 {
11 var lbl = new Label();
12 var frm = new Form()
13 {
14 Controls = { lbl }
15 };
16
17 var moves = Observable.FromEventPattern<MouseEventArgs>(frm, "MouseMove");
18
19 using (moves.Subscribe(evt =>
20 {
21 lbl.Text = evt.EventArgs.Location.ToString();
22 }))
23 {
24 Application.Run(frm);
25 }
26 }
27 }
28 }