Rxを使用してWPFアプリケーションでドラッグアンドドロップしようとしましたが、EntryPointNotFindExceptionがサブミットしようとしたとき誰かがこれで助けてくれますか?EntryPointNotFoundは、IObservable経由でイベントを購読するとき
WPFアプリケーションコード
<Window x:Class="RxDragDropPOC.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="300" Width="300">
<Canvas Name="canvas">
<TextBlock Name="textBlock" Text="Test" />
<Image Canvas.Left="0" Canvas.Top="25" Height="100" Name="image" Width="100" Source="C:/Users/guilherme.dias/Desktop/images.jpg" />
</Canvas>
C#コード
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var mouseDown = from evt in Observable.FromEvent<MouseButtonEventArgs>(image, "MouseLeftButtonDown")
select evt.EventArgs.GetPosition(this);
var mouseUp = from evt in Observable.FromEvent<MouseButtonEventArgs>(image, "MouseLeftButtonUp")
select evt.EventArgs.GetPosition(this);
var mouseMove = from evt in Observable.FromEvent<MouseEventArgs>(image, "MouseMove")
select evt.EventArgs.GetPosition(this);
var q = from start in mouseDown
from pos in mouseMove.StartWith(start).TakeUntil(mouseUp).
Let(mm => mm.Zip(mm.Skip(1), (prev, cur) =>
new { X = cur.X - prev.X, Y = cur.Y - prev.Y }))
select pos;
//THIS IS THE LINE THAT THROWS EntryPointNotFound
q.ObserveOnDispatcher().Subscribe(value =>
{
Canvas.SetLeft(image, Canvas.GetLeft(image) + value.X);
Canvas.SetTop(image, Canvas.GetTop(image) + value.Y);
});
}
}
EDIT 1つの
例外の詳細
System.EntryPointNotFoundException was caught
Message=Entry point was not found.
Source=mscorlib
TypeName=""
StackTrace:
at System.IObservable`1.Subscribe(IObserver`1 observer)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)
at System.Linq.Observable.<>c__DisplayClass3dd`2.<Select>b__3db(IObserver`1 observer)
at System.Collections.Generic.AnonymousObservable`1.<>c__DisplayClass1.<Subscribe>b__0()
at System.Concurrency.CurrentThreadScheduler.EnsureTrampoline(Action action)
at System.Collections.Generic.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)
at System.Linq.Observable.<>c__DisplayClass3dd`2.<Select>b__3db(IObserver`1 observer)
at System.Collections.Generic.AnonymousObservable`1.<>c__DisplayClass1.<Subscribe>b__0()
at System.Concurrency.CurrentThreadScheduler.EnsureTrampoline(Action action)
at System.Collections.Generic.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)
at System.Linq.Observable.<>c__DisplayClass2e5`1.<Merge>b__2de(IObserver`1 observer)
at System.Collections.Generic.AnonymousObservable`1.<>c__DisplayClass1.<Subscribe>b__0()
at System.Concurrency.CurrentThreadScheduler.EnsureTrampoline(Action action)
at System.Collections.Generic.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)
at System.Linq.Observable.<>c__DisplayClass27b`1.<ObserveOn>b__274(IObserver`1 observer)
at System.Collections.Generic.AnonymousObservable`1.<>c__DisplayClass1.<Subscribe>b__0()
at System.Concurrency.CurrentThreadScheduler.EnsureTrampoline(Action action)
at System.Collections.Generic.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext, Action`1 onError, Action onCompleted)
at System.ObservableExtensions.Subscribe[TSource](IObservable`1 source, Action`1 onNext)
at RxDragDropPOC.MainWindow..ctor() in C:\Semantic Framework\POC\RxDragDropPOC\RxDragDropPOC\MainWindow.xaml.cs:line 46
例外の詳細を記載してください。今のところ、コンパイルエラーやアセンブリの参照が間違っているようです。 –