本文整理汇总了C#中NativeMethods.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# NativeMethods.ToString方法的具体用法?C# NativeMethods.ToString怎么用?C# NativeMethods.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeMethods
的用法示例。
在下文中一共展示了NativeMethods.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateStatus
private void ValidateStatus(NativeMethods.BTSTATUS status)
{
switch (status)
{
case NativeMethods.BTSTATUS.BTSTATUS_SUCCESS:
break;
case NativeMethods.BTSTATUS.BTSTATUS_FAIL:
throw new BluesoleilFailException();
case NativeMethods.BTSTATUS.BTSTATUS_BT_NOT_READY:
throw new BluesoleilNotReadyException();
case NativeMethods.BTSTATUS.BTSTATUS_BT_BUSY:
throw new BluesoleilBluetoothBusyException();
case NativeMethods.BTSTATUS.BTSTATUS_SYSTEM_ERROR:
throw new BluesoleilSystemException();
case NativeMethods.BTSTATUS.BTSTATUS_CONNECTION_NOT_EXIST:
throw new BluesoleilNonExistingConnectionException();
default:
throw new BluesoleilException(status.ToString());
}
}
示例2:
int UnsafeNativeMethods.IOleInPlaceSite.OnPosRectChange(NativeMethods.COMRECT lprcPosRect) {
// ASURT 68752
// The MediaPlayer control has a AllowChangeDisplaySize property that users
// can set to control size changes at runtime, but the control itself ignores that and sets the new size.
// We prevent this by not allowing controls to call OnPosRectChange(), unless we instantiated the resize.
// visual basic6 does the same.
//
bool useRect = true;
if (AxHost.windowsMediaPlayer_Clsid.Equals(host.clsid))
useRect = host.GetAxState(AxHost.handlePosRectChanged);
if (useRect) {
Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "in OnPosRectChange" + lprcPosRect.ToString());
host.GetInPlaceObject().SetObjectRects(lprcPosRect, host.GetClipRect(new NativeMethods.COMRECT()));
host.MakeDirty();
}
else {
Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "Control directly called OnPosRectChange... ignoring the new size");
}
return NativeMethods.S_OK;
}
示例3: OnCommErrorEvent
/// <summary>
/// Calls the event when an error is detected.
/// </summary>
/// <remarks>
/// This method simply calls the event on the current thread that is running.
/// No checks or serialization occurs.
/// </remarks>
/// <param name="e">Event details.</param>
private void OnCommErrorEvent(NativeMethods.ComStatErrors e)
{
if (e == 0) return;
if (m_Trace.Switch.ShouldTrace(System.Diagnostics.TraceEventType.Verbose)) {
// e.ToString() is relatively expensive, so only do it if we're logging
m_Trace.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 0, "{0}: CommErrorEvent: {1}", Name, e.ToString());
}
if (CommErrorEvent != null) CommErrorEvent(this, new CommErrorEventArgs(e));
}
开发者ID:DHMechatronicAG,项目名称:SerialPortStream,代码行数:17,代码来源:SerialPortStream.NativeSerialPort.CommOverlappedIo.cs