I have the following code in a WPF application using Reactive Extensions for .NET:
public MainWindow()
{
InitializeComponent();
var leftButtonDown = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseLeftButtonDown");
var leftButtonUp = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseLeftButtonUp");
var moveEvents = Observable.FromEvent<MouseEventArgs>(this, "MouseMove")
.SkipUntil(leftButtonDown)
.SkipUntil(leftButtonUp)
.Repeat()
.Select(t => t.EventArgs.GetPosition(this));
moveEvents.Subscribe(point =>
{
textBox1.Text = string.Format(string.Format("X: {0}, Y: {1}", point.X, point.Y));
});
}
Will there be a steady increase of memory while the mouse is moving on this dialog?
Reading the code, I would expect that the moveEvents observable will contain a huge amount of MouseEventArgs after a while? Or is this handled in some smart way I'm unaware of?