示例#1
0
 private static void RaisePreviewCanExecute(IntPtr cPtr, IntPtr sender, IntPtr e)
 {
     try {
         if (!_PreviewCanExecute.ContainsKey(cPtr))
         {
             throw new InvalidOperationException("Delegate not registered for PreviewCanExecute event");
         }
         if (sender == IntPtr.Zero && e == IntPtr.Zero)
         {
             _PreviewCanExecute.Remove(cPtr);
             return;
         }
         if (Noesis.Extend.Initialized)
         {
             PreviewCanExecuteHandler handler = _PreviewCanExecute[cPtr];
             if (handler != null)
             {
                 handler(Noesis.Extend.GetProxy(sender, false), new CanExecuteRoutedEventArgs(e, false));
             }
         }
     }
     catch (Exception exception) {
         Noesis.Error.SetNativePendingError(exception);
     }
 }
示例#2
0
 private static void RaisePreviewCanExecute(IntPtr cPtr, IntPtr sender, IntPtr e)
 {
     try {
         if (Noesis.Extend.Initialized)
         {
             long ptr = cPtr.ToInt64();
             if (sender == IntPtr.Zero && e == IntPtr.Zero)
             {
                 _PreviewCanExecute.Remove(ptr);
                 return;
             }
             PreviewCanExecuteHandler handler = null;
             if (!_PreviewCanExecute.TryGetValue(ptr, out handler))
             {
                 throw new InvalidOperationException("Delegate not registered for PreviewCanExecute event");
             }
             handler?.Invoke(Noesis.Extend.GetProxy(sender, false), new CanExecuteRoutedEventArgs(e, false));
         }
     }
     catch (Exception exception) {
         Noesis.Error.UnhandledException(exception);
     }
 }