티스토리 뷰
Reactive Extensions for .NET (Rx) - Forums
http://social.msdn.microsoft.com/Forums/pl-pl/rx/threads
Introducing Pushqa-Queryable Push Messages over OData
http://blog.petegoo.com/index.php/tag/signalr/
Home > C#, Programming, Rx, WPF > Building an Auto Complete control with Reactive Extensions (Rx)
http://blog.petegoo.com/index.php/2011/11/22/building-an-auto-complete-control-with-reactive-extensions-rx/
Rx: Curing Your Asynchronous Programming Blues
http://www.slideshare.net/jibyjohnc/rx-curing-your-asynchronous-programming-blues-qcon-london
Rx Workshop
http://www.slideshare.net/panesofglass/rx-workshop
Reactive Extensions v2.0 Release Candidate available now!
관찰자 디자인 패턴(Observer Design Pattern)
http://msdn.microsoft.com/ko-kr/library/ee850490.aspx
1) windows Form Rx mouse event operation.....
var up = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseUp")
select evt.EventArgs.Location;
var move = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseMove")
select evt.EventArgs.Location;
var down = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseDown")
select evt.EventArgs.Location;
up.Subscribe(x => heleleText.Text=x.X.ToString());
down.Subscribe(x => heveleText.Text = x.Y.ToString());
move.Subscribe(x => hevoleText.Text = x.Y.ToString()+":"+x.Y.ToString());
2) WPF(XAML) mouse event operation..........
[XAML]
<Grid>
<StackPanel>
<TextBlock x:Name="heleleText" Text="helele and hevele"/>
<TextBox x:Name="heveleText"/>
<StackPanel Orientation="Horizontal">
<ListBox x:Name="heleleList"/>
<ListBox x:Name="heveleList"/>
</StackPanel>
</StackPanel>
</Grid>
[CS]
var move = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseMove")
select evt.EventArgs.GetPosition(this);
var up = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseUp")
select evt.EventArgs.GetPosition(this);
var down = from evt in Observable.FromEventPattern<MouseEventArgs>(this, "MouseDown")
select evt.EventArgs.GetPosition(this);
var q = from start in down
from pos in move.StartWith(start).TakeUntil(up)
select pos;
// q.ObserveOnDispatcher().Subscribe(s => this.Title = s.ToString());
q.Subscribe(s => this.Title = s.ToString());
var helele = Observable.Interval(TimeSpan.FromSeconds(1)).StartWith(-1);
helele.ObserveOnDispatcher()
.Subscribe(s => this.Title = s.ToString());
// helele.Subscribe(s => this.Title = s.ToString());
var changed = Observable.FromEventPattern<TextChangedEventArgs>(heveleText, "TextChanged");
var input = (from e2 in changed
let text = ((TextBox)e2.Sender).Text
where text.Length >= 3
select text)
.DistinctUntilChanged()
.Throttle(TimeSpan.FromSeconds(1));
input.ObserveOnDispatcher().Subscribe(
x =>
{
heleleList.Items.Add(x);
}
);
var input2 = Observable.FromEventPattern(heveleText, "TextChanged")
.Select(evt => ((TextBox)evt.Sender).Text)
.Timestamp()
.Do((Timestamped<string> evt) => heveleList.Items.Add(evt))
.Select(evt => evt.Value)
.Where(evt => evt.Length > 4)
.Do(evt => heveleList.Items.Add( evt) );
input2.ObserveOnDispatcher().Subscribe(_ => { });
3) App(WinRT) mouse event operation..........<PointerEventArgs>(this, "PointerMoved")
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<StackPanel>
<TextBlock x:Name="heleleText" Text="helele and hevele"/>
<TextBox x:Name="heveleText"/>
<TextBox x:Name="hevoleText"/>
<StackPanel Orientation="Horizontal">
<ListBox x:Name="heleleList"/>
<ListBox x:Name="heveleList"/>
</StackPanel>
</StackPanel>
</Grid>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var move = from evt in Observable.FromEventPattern<PointerEventArgs>(this, "PointerMoved")
select evt.EventArgs.GetCurrentPoint(this);
var up = from evt in Observable.FromEventPattern<PointerEventArgs>(this, "PointerReleased")
select evt.EventArgs.GetCurrentPoint(this);
var down = from evt in Observable.FromEventPattern<PointerEventArgs>(this, "PointerPressed")
select evt.EventArgs.GetCurrentPoint(this);
var q = from start in down
from pos in move.StartWith(start).TakeUntil(up)
select pos;
q.Subscribe(s => heleleText.Text = s.Position.ToString()); //위와 동일, 잘됨
var helele = Observable.Interval(TimeSpan.FromSeconds(1)).StartWith(-1);
helele.ObserveOnDispatcher()
.Subscribe(s => heveleText.Text = s.ToString());
//helele.Subscribe(s => heveleText.Text = s.ToString()); //Thread Error
var changed = Observable.FromEventPattern<TextChangedEventArgs>(hevoleText, "TextChanged");
var input = (from e2 in changed
let text = ((TextBox)e2.Sender).Text
where text.Length >= 3
select text)
.DistinctUntilChanged()
.Throttle(TimeSpan.FromSeconds(1));
input.ObserveOnDispatcher().Subscribe(x =>
{
heleleList.Items.Add(x);
}
);
var input2 = Observable.FromEventPattern(hevoleText, "TextChanged")
.Select(evt => ((TextBox)evt.Sender).Text)
.Timestamp()
.Do((Timestamped<string> evt) => heveleList.Items.Add(evt))
.Select(evt => evt.Value)
.Where(evt => evt.Length > 4)
.Do(evt => heveleList.Items.Add(evt));
input2.ObserveOnDispatcher().Subscribe(_ => { });
}
'Previous Platforms' 카테고리의 다른 글
SkySearch Help (4) | 2012.09.03 |
---|---|
Korea Bus Information 1.2.0.1 Help (4) | 2012.07.18 |
Prism 4.0 Tips (0) | 2012.06.13 |
Telerik Report Tips (2) | 2012.06.08 |
개인정보 보호 정책 안내 (2) | 2012.05.25 |
- Total
- Today
- Yesterday
- Windows 10
- Build 2016
- Visual Studio 2022
- Microsoft
- #MVVM
- .net 5.0
- WPF
- ef core
- #prism
- IOT
- C#
- .net
- Always Encrypted
- Behavior
- uno platform
- #Windows Template Studio
- UWP
- windows 11
- kiosk
- LINQ
- XAML
- PRISM
- visual studio 2019
- uno-platform
- dotNETconf
- Cross-platform
- ComboBox
- #uwp
- Bot Framework
- MVVM
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |