public static T GetNewValue <T>(HandleRef cPtr) { int type = Extend.GetNativePropertyType(typeof(T)); IntPtr value = Noesis_RoutedPropertyChangedEventArgs_GetNewValue(cPtr, type); return((T)Extend.GetProxy(value, true)); }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { CanExecuteRoutedEventHandler handler_ = (CanExecuteRoutedEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new CanExecuteRoutedEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { DoubleTappedEventHandler handler_ = (DoubleTappedEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new DoubleTappedEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { GiveFeedbackEventHandler handler_ = (GiveFeedbackEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new GiveFeedbackEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { DataObjectCopyingEventHandler handler_ = (DataObjectCopyingEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new DataObjectCopyingEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { ManipulationInertiaStartingEventHandler handler_ = (ManipulationInertiaStartingEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new ManipulationInertiaStartingEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { MouseWheelEventHandler handler_ = (MouseWheelEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new MouseWheelEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { RoutedPropertyChangedEventHandler <T> handler_ = (RoutedPropertyChangedEventHandler <T>)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new RoutedPropertyChangedEventArgs <T>(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { TextCompositionEventHandler handler_ = (TextCompositionEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new TextCompositionEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { QueryCursorEventHandler handler_ = (QueryCursorEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new QueryCursorEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { KeyboardFocusChangedEventHandler handler_ = (KeyboardFocusChangedEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new KeyboardFocusChangedEventArgs(args, false)); } }
internal static void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { DependencyPropertyChangedEventHandler handler_ = (DependencyPropertyChangedEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new DependencyPropertyChangedEventArgs(args, false)); } }
internal static void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { NoesisEventHandler handler_ = (NoesisEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new NoesisEventArgs(args, false)); } }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { RequestNavigateEventHandler handler_ = (RequestNavigateEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new RequestNavigateEventArgs(args, false)); } }
private static RoutedEvent AddRoutedEvent(string name, RoutingStrategy routingStrategy, Type handlerType, Type ownerType) { IntPtr routedEventPtr = Noesis_EventManager_RegisterRoutedEvent(name, (int)routingStrategy, Extend.GetNativeType(ownerType)); RoutedEvent routedEvent = (RoutedEvent)Extend.GetProxy(routedEventPtr, false); RegisterRoutedEvent(routedEvent, handlerType, GetInvoker(handlerType)); return(routedEvent); }
private static HitTestFilterBehavior OnHitTestFilter(int callbacksId, IntPtr targetPtr) { try { HitTestCallbackInfo info = _hitTestCallbacks[callbacksId]; return(info.Filter((Visual)Extend.GetProxy(targetPtr, false))); } catch (Exception e) { Noesis.Error.UnhandledException(e); return(HitTestFilterBehavior.Stop); } }
private static void OnDragDropCompleted(int callbackId, IntPtr source, IntPtr data, IntPtr target, IntPtr dropPoint, int effects) { try { DragDropCallbackInfo info = _dragDropCallbacks[callbackId]; info.Callback((DependencyObject)Extend.GetProxy(source, false), new DataObject(Extend.GetProxy(data, false)), (UIElement)Extend.GetProxy(target, false), Marshal.PtrToStructure <Point>(dropPoint), (DragDropEffects)effects); _dragDropCallbacks.Remove(callbackId); } catch (Exception e) { Noesis.Error.UnhandledException(e); } }
private static void OnUpdateCursor(IntPtr cPtrView, int cursor) { try { if (_initialized) { View view = (View)Extend.GetProxy(cPtrView, false); _updateCursorCallback(view, (Cursor)cursor); } } catch (Exception e) { Error.UnhandledException(e); } }
private static void OnSoftwareKeyboard(IntPtr cPtrFocused, bool open) { try { if (_initialized) { UIElement focused = Extend.GetProxy(cPtrFocused, false) as UIElement; _softwareKeyboardCallback(focused, open); } } catch (Exception e) { Error.UnhandledException(e); } }
private static void ShowSoftwareKeyboard(IntPtr focusedElement) { try { if (_initialized) { UIElement element = Extend.GetProxy(focusedElement, false) as UIElement; _softwareKeyboard.Show(element); } } catch (Exception e) { Noesis.Error.SetNativePendingError(e); } }
private static T GetConvertedValue <T>(IntPtr value) { var result = Extend.GetProxy(value, true); if (result is T castedResult) { return(castedResult); } if (ReferenceEquals(result, null)) { return(default(T)); } return(Extend.ConvertValue <T>(result)); }
private static void OnDragDropCompleted(int callbackId, IntPtr sourcePtr, IntPtr dataPtr, IntPtr targetPtr, IntPtr dropPointPtr, int effects) { try { DragDropCompletedCallback callback = _callbacks[callbackId]; if (callback != null) { DependencyObject source = (DependencyObject)Extend.GetProxy(sourcePtr, false); DataObject data = new DataObject(Extend.GetProxy(dataPtr, false)); UIElement target = (UIElement)Extend.GetProxy(targetPtr, false); Point dropPoint = Marshal.PtrToStructure <Point>(dropPointPtr); callback(source, data, target, dropPoint, (DragDropEffects)effects); } _callbacks.Remove(callbackId); } catch (Exception e) { Noesis.Error.UnhandledException(e); } }
private static void OnClassHandler(IntPtr cPtrType, IntPtr cPtr, IntPtr sender, IntPtr args) { try { ClassHandlerInfo c = (ClassHandlerInfo)Extend.GetProxy(cPtrType, cPtr, false); HandlerInfo info; if (!_handlerTypes.TryGetValue(Key(c.RoutedEvent), out info)) { throw new InvalidOperationException("Routed event " + c.RoutedEvent.Name + " not registered"); } info.Invoker(c.Handler, sender, args); } catch (Exception exception) { Error.UnhandledException(exception); } }
private static void RaiseEvent(IntPtr cPtrType, IntPtr cPtr, string eventId, IntPtr sender, IntPtr e) { try { if (Extend.Initialized) { UIElement element = (UIElement)Extend.GetProxy(cPtrType, cPtr, false); if (element == null) { return; } EnsureEventsProperty(); EventHandlerStore events = (EventHandlerStore)element.GetValue(EventsProperty); long eventKey = eventId.GetHashCode(); // check if we are called to unbind the event if (sender == IntPtr.Zero && e == IntPtr.Zero) { events._binds.Remove(eventKey); return; } // invoke handler Delegate eventHandler; if (!events._binds.TryGetValue(eventKey, out eventHandler)) { return; } EventManager.InvokeHandler(eventId, eventHandler, sender, e); } } catch (Exception exception) { Error.UnhandledException(exception); } }
/// <summary> /// Loads a XAML resource from a Stream. /// </summary> /// <param name="stream">Stream with xaml contents.</param> /// <param name="filename">Path to the resource.</param> /// <returns>Root of the loaded XAML.</returns> public static object LoadXaml(Stream stream, string filename) { IntPtr root = Noesis_LoadStreamXaml(Extend.GetInstanceHandle(stream), filename ?? string.Empty); return(Extend.GetProxy(root, true)); }
/// <summary> /// Loads a XAML resource, like an audio, at the given uniform resource identifier. /// </summary> public static Stream LoadXamlResource(string filename) { IntPtr stream = Noesis_LoadXamlResource(filename); return((Stream)Extend.GetProxy(stream, true)); }
/// <summary> /// Parses a well-formed XAML fragment and creates the corresponding object tree. /// </summary> public static object ParseXaml(string xamlText) { IntPtr root = Noesis_ParseXaml(xamlText); return(Extend.GetProxy(root, true)); }
/// <summary> /// Loads a XAML resource. /// </summary> /// <param name="filename">Path to the resource.</param> /// <returns>Root of the loaded XAML.</returns> public static object LoadXaml(string filename) { IntPtr root = Noesis_LoadXaml(filename); return(Extend.GetProxy(root, true)); }
/// <summary> /// Loads a XAML resource. /// </summary> /// <param name="xaml">Path to the resource.</param> /// <returns>Root of the loaded XAML.</returns> public static object LoadXaml(string xaml) { IntPtr root = Noesis_LoadXaml_(xaml); return(Extend.GetProxy(root, true)); }
object IXamlNameResolver.Resolve(string name) { IntPtr objectPtr = MarkupExtensionProvider_ResolveName(_provider, name); return(Extend.GetProxy(objectPtr, false)); }