private void HandleQueryOrDrop(IDropInfo adapter, DragEventArgs e) { if (RunOnVisualTreeSearch.Run(target, method, new[] { adapter }, out var result)) { e.Handled = true; e.Effects = result as DragDropEffects? ?? DragDropEffects.None; } }
private void HandleEvent(object o, EventArgs e) { if (o is DependencyObject dependencyObject) { RunOnVisualTreeSearch.Run(dependencyObject, MethodName, SearchTreeParameterParser.EvalParameters(Parameters, dependencyObject, e), out _); } }
public void RunArbitraryFunc() { var realTb = new TextBlock { Text = "Foo" }; var ret = RunOnVisualTreeSearch.Run(realTb, (TextBlock tb) => tb.Text); Assert.Equal(ret, ret); }
private void ClickUp(object sender, MouseButtonEventArgs args) { target.RemoveHandler(up, (MouseButtonEventHandler)ClickUp); var finalPosition = args.GetPosition(target); if (CheckDimension(finalPosition.X, firstPosition.X) && CheckDimension(finalPosition.Y, firstPosition.Y)) { RunOnVisualTreeSearch.Run(target as DependencyObject, method, new[] { args }, out var _); } }
public void RunArbitraryAction() { var realTB = new TextBlock { Text = "Foo" }; string s = ""; RunOnVisualTreeSearch.Run(realTB, (TextBlock tb) => { s = tb.Text; }); Assert.Equal("Foo", s); }
public void DoCall(object target, DependencyObject frame) { RunOnVisualTreeSearch.TryInvokeMethod(frame, Array.Empty <object>(), target, MethodName, out _); }