public void SimpleCaseTest2() { var test2CalledCount = 0; string test2Argument = null; var testObject = new TestViewModel(0, () => { }, s => { test2CalledCount++; test2Argument = s; }); var binder = new MethodBinderWithArgument(); binder.Invoke((object)testObject, "Test2", "a"); test2CalledCount.Is(1); test2Argument.Is("a"); binder.Invoke((object)testObject, "Test2", "b"); test2CalledCount.Is(2); test2Argument.Is("b"); //System.Threading.Thread.Sleep(3000); //キャッシュが更新されないか目視 testObject = new TestViewModel(0, () => { }, s => { test2CalledCount++; test2Argument = s; }); binder.Invoke((object)testObject, "Test2", "a"); test2CalledCount.Is(3); test2Argument.Is("a"); binder.Invoke((object)testObject, "Test2", "b"); test2CalledCount.Is(4); test2Argument.Is("b"); //System.Threading.Thread.Sleep(3000); //キャッシュ辞書からメソッドキャッシュを取得するか目視 binder = new MethodBinderWithArgument(); binder.Invoke((object)testObject, "Test2", "a"); test2CalledCount.Is(5); test2Argument.Is("a"); binder.Invoke((object)testObject, "Test2", "b"); test2CalledCount.Is(6); test2Argument.Is("b"); }
internal void InvokeCallbacks(InteractionMessage message) { if (CallbackCommand != null) { if (CallbackCommand.CanExecute(message)) { CallbackCommand.Execute(message); } } if (CallbackMethodTarget != null && CallbackMethodName != null) { _callbackMethod.Invoke(CallbackMethodTarget, CallbackMethodName, message); } }
internal void InvokeCallbacks([NotNull] InteractionMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (CallbackCommand != null) { if (CallbackCommand.CanExecute(message)) { CallbackCommand.Execute(message); } } if (CallbackMethodTarget != null && CallbackMethodName != null) { _callbackMethod.Invoke(CallbackMethodTarget, CallbackMethodName, message); } }