public void CloseSrc() { TwReturnCode returnCode; if (srcds.Id != IntPtr.Zero) { var guif = new TwUserInterface(); returnCode = DSuserif(appid, srcds, TwDG.Control, TwData.UserInterface, TwMessageCode.DisableDS, guif); returnCode = DSMident(appid, IntPtr.Zero, TwDG.Control, TwData.Identity, TwMessageCode.CloseDS, srcds); } }
public bool Acquire() { TwReturnCode returnCode; CloseSrc(); if (appid.Id == IntPtr.Zero) { Init(hwnd); if (appid.Id == IntPtr.Zero) { throw new InvalidOperationException("Init call falied"); } } returnCode = DSMident(appid, IntPtr.Zero, TwDG.Control, TwData.Identity, TwMessageCode.OpenDS, srcds); if (returnCode != TwReturnCode.Success) { throw new InvalidOperationException("DSMident call falied"); } var guif = new TwUserInterface { ShowUI = 1, ModalUI = 1, ParentHand = hwnd }; returnCode = DSuserif(appid, srcds, TwDG.Control, TwData.UserInterface, TwMessageCode.EnableDS, guif); if (returnCode != TwReturnCode.Success) { CloseSrc(); if (returnCode == TwReturnCode.Cancel) { return(false); } throw new InvalidOperationException("DSuserif call falied"); } return(true); }
private static extern TwReturnCode DSuserif([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwData data, TwMessageCode messageCode, TwUserInterface guif);
public bool Acquire() { TwReturnCode returnCode; CloseSrc(); if (appid.Id == IntPtr.Zero) { Init(hwnd); if (appid.Id == IntPtr.Zero) throw new InvalidOperationException("Init call falied"); } returnCode = DSMident(appid, IntPtr.Zero, TwDG.Control, TwData.Identity, TwMessageCode.OpenDS, srcds); if (returnCode != TwReturnCode.Success) throw new InvalidOperationException("DSMident call falied"); var guif = new TwUserInterface { ShowUI = 1, ModalUI = 1, ParentHand = hwnd }; returnCode = DSuserif(appid, srcds, TwDG.Control, TwData.UserInterface, TwMessageCode.EnableDS, guif); if (returnCode != TwReturnCode.Success) { CloseSrc(); if (returnCode == TwReturnCode.Cancel) { return false; } throw new InvalidOperationException("DSuserif call falied"); } return true; }