forked from idg10/prog-cs-8-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueryExpressionJoin.xaml.cs
37 lines (33 loc) · 1.22 KB
/
QueryExpressionJoin.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Reactive;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Input;
namespace LinqQueries
{
/// <summary>
/// Interaction logic for QueryExpressionJoin.xaml
/// </summary>
public partial class QueryExpressionJoin : Window
{
public QueryExpressionJoin()
{
InitializeComponent();
IObservable<EventPattern<MouseEventArgs>> downs =
Observable.FromEventPattern<MouseEventArgs>(
background, nameof(background.MouseDown));
IObservable<EventPattern<MouseEventArgs>> ups =
Observable.FromEventPattern<MouseEventArgs>(
background, nameof(background.MouseUp));
IObservable<EventPattern<MouseEventArgs>> allMoves =
Observable.FromEventPattern<MouseEventArgs>(
background, nameof(background.MouseMove));
IObservable<Point> dragPositions =
from down in downs
join move in allMoves
on ups equals allMoves
select move.EventArgs.GetPosition(background);
dragPositions.Subscribe(point => { line.Points.Add(point); });
}
}
}