예제 #1
0
 /// <summary>
 /// Executes the Action asynchronously on the UI thread, does not block execution on the calling thread.
 /// </summary>
 /// <param name="control">the control for which the update is required</param>
 /// <param name="action">action to be performed on the control</param>
 public static void RemoveTitleBar(this EventedWindowCore window)
 {
     if (window.Handle != null)
     {
         SetWindowLong(window.Handle, GWL_STYLE, GetWindowLong(window.Handle, GWL_STYLE) & (0xFFFFFFFF ^ WS_SYSMENU));
     }
 }
예제 #2
0
 /// <summary>
 /// Executes the Action asynchronously on the UI thread, does not block execution on the calling thread.
 /// </summary>
 /// <param name="control">the control for which the update is required</param>
 /// <param name="action">action to be performed on the control</param>
 public static void RemoveTitleBarIcon(this EventedWindowCore window)
 {
     if (window.Handle != null)
     {
         SetWindowLong(window.Handle, GWL_STYLE, GetWindowLong(window.Handle, GWL_STYLE) & (0xFFFFFFFF ^ WM_SETICON));
     }
 }
예제 #3
0
 public static void HandlePaintD2DClipped(EventedWindowCore window, Dx11Component resource,
                                          Action <DeviceContext> handler, ref RawRectangleF clip, RawColor4?clearColorBeforeClip = null)
 {
     resource.EnsureInitialized();
     try
     {
         var context = resource.D2D.Context;
         context.BeginDraw();
         if (clearColorBeforeClip.HasValue)
         {
             context.Clear(clearColorBeforeClip.Value);
         }
         context.PushAxisAlignedClip(clip,
                                     AntialiasMode.Aliased);
         handler(context);
         context.PopAxisAlignedClip();
         context.EndDraw();
         resource.D3D.SwapChain.Present(1, 0);
         window.Validate();
     }
     catch (SharpDXException ex)
     {
         if (!resource.PerformResetOnException(ex))
         {
             throw;
         }
     }
 }
예제 #4
0
 /// <summary>
 /// Executes the Action asynchronously on the UI thread, does not block execution on the calling thread.
 /// </summary>
 /// <param name="control">the control for which the update is required</param>
 /// <param name="action">action to be performed on the control</param>
 public static void InvokeAsyncIfPossible(this EventedWindowCore window, Action action)
 {
     try
     {
         Task.Run(() => action);
     }
     catch (Exception)
     {
         action.Invoke();
     }
 }
예제 #5
0
 public static void HandlePaint(EventedWindowCore window, Dx11Component resource,
                                Action <Dx11Component> handler)
 {
     resource.EnsureInitialized();
     try
     {
         handler(resource);
         resource.D3D.SwapChain.Present(1, 0);
         window.Validate();
     }
     catch (SharpDXException ex)
     {
         if (!resource.PerformResetOnException(ex))
         {
             throw;
         }
     }
 }
예제 #6
0
 public static void HandlePaintD2D(EventedWindowCore window, Dx11Component resource,
                                   Action <DeviceContext> handler)
 {
     resource.EnsureInitialized();
     try
     {
         var context = resource.D2D.Context;
         context.BeginDraw();
         handler(context);
         context.EndDraw();
         resource.D3D.SwapChain.Present(1, 0);
         window.Validate();
     }
     catch (SharpDXException ex)
     {
         if (!resource.PerformResetOnException(ex))
         {
             throw;
         }
     }
 }
예제 #7
0
 public static void HandlePaintD2DClipped(EventedWindowCore window, Dx11Component resource,
                                          Action <DeviceContext> handler, RawRectangleF clip, RawColor4?clearColorBeforeClip = null)
 {
     HandlePaintD2DClipped(window, resource, handler, ref clip, clearColorBeforeClip);
 }