public static T CheckHRAndReturnOrThrow <T>(Hresult hr, T result) { if (hr != Hresult.Ok) { Marshal.ThrowExceptionForHR((int)hr); } return(result); }
private void Model_ApplyComplete(object sender, WPFBootstrapperEventArgs <Wix.ApplyCompleteEventArgs> e) { if (Hresult.Succeeded(e.Arguments.Status)) { this.InstallState = InstallationState.Applied; } else { this.InstallState = InstallationState.Failed; } }
internal static IntPtr SetActiveWindow(IntPtr hwnd) { Verify.IsNotDefault(hwnd, "hwnd"); var ret = User32.SetActiveWindow(hwnd); if (ret == IntPtr.Zero) { Hresult.ThrowLastError(); } return(ret); }
private void Model_PlanComplete(object sender, WPFBootstrapperEventArgs <Wix.PlanCompleteEventArgs> e) { if (Hresult.Succeeded(e.Arguments.Status)) { this.PreApplyState = this.InstallState; this.InstallState = InstallationState.Applying; this.Model.Apply(this.ViewWindowHandle); } else { this.InstallState = InstallationState.Failed; } }