本文整理汇总了C#中System.Windows.Media.Composition.DUCE.SendSecurityCriticalCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DUCE.SendSecurityCriticalCommand方法的具体用法?C# DUCE.SendSecurityCriticalCommand怎么用?C# DUCE.SendSecurityCriticalCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Composition.DUCE
的用法示例。
在下文中一共展示了DUCE.SendSecurityCriticalCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateBitmapSourceResource
internal override void UpdateBitmapSourceResource(DUCE.Channel channel, bool skipOnChannelCheck)
{
//
// If we're in BitmapSource mode, then just defer to the BitmapSource
// implementation.
//
if (_actLikeSimpleBitmap)
{
base.UpdateBitmapSourceResource(channel, skipOnChannelCheck);
return;
}
// We override this method because we use a different resource type
// than our base class does. This probably suggests that the base
// class should not presume the resource type, but it currently
// does. The base class uses TYPE_BITMAPSOURCE resources, and we
// use TYPE_DOUBLEBUFFEREDBITMAP resources.
// If we're told we can skip the channel check, then we must be on channel
Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));
if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
{
DUCE.MILCMD_DOUBLEBUFFEREDBITMAP command;
command.Type = MILCMD.MilCmdDoubleBufferedBitmap;
command.Handle = _duceResource.GetHandle(channel);
unsafe
{
command.SwDoubleBufferedBitmap = (UInt64) _pDoubleBufferedBitmap.DangerousGetHandle().ToPointer();
}
command.UseBackBuffer = channel.IsSynchronous ? 1u : 0u;
//
// We need to ensure that this object stays alive while traveling over the channel
// so we'll AddRef it here, and simply take over the reference on the other side.
//
UnsafeNativeMethods.MILUnknown.AddRef(_pDoubleBufferedBitmap);
unsafe
{
channel.SendSecurityCriticalCommand(
(byte*)&command,
sizeof(DUCE.MILCMD_DOUBLEBUFFEREDBITMAP),
false /* sendInSeparateBatch */
);
}
}
}
示例2: UpdateResource
internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
{
// If we're told we can skip the channel check, then we must be on channel
Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));
if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
{
base.UpdateResource(channel, skipOnChannelCheck);
bool isSynchronous = channel.IsSynchronous;
DUCE.MILCMD_D3DIMAGE data;
unsafe
{
data.Type = MILCMD.MilCmdD3DImage;
data.Handle = _duceResource.GetHandle(channel);
if (_pInteropDeviceBitmap != null)
{
UnsafeNativeMethods.MILUnknown.AddRef(_pInteropDeviceBitmap);
data.pInteropDeviceBitmap = (ulong)_pInteropDeviceBitmap.DangerousGetHandle().ToPointer();
}
else
{
data.pInteropDeviceBitmap = 0;
}
data.pSoftwareBitmap = 0;
if (isSynchronous)
{
_softwareCopy = CopyBackBuffer();
if (_softwareCopy != null)
{
UnsafeNativeMethods.MILUnknown.AddRef(_softwareCopy.WicSourceHandle);
data.pSoftwareBitmap = (ulong)_softwareCopy.WicSourceHandle.DangerousGetHandle().ToPointer();
}
}
// Send packed command structure
channel.SendSecurityCriticalCommand(
(byte*)&data,
sizeof(DUCE.MILCMD_D3DIMAGE),
false /* sendInSeparateBatch */
);
}
// Presents only happen on the async channel so don't let RTB flip this bit
if (!isSynchronous)
{
_waitingForUpdateResourceBecauseBitmapChanged = false;
}
}
}