internal static CredentialHandle ReadFromCredentialManager(string authority) { if (NativeMethods.CredRead(authority, NativeMethods.CRED_TYPE.GENERIC, 0, out IntPtr creds)) { return(new CredentialHandle(creds)); } var error = Marshal.GetLastWin32Error(); // if credentials were not found then continue to prompt user for credentials. // otherwise there was an error while reading credentials. if (error != NativeMethods.ERROR_NOT_FOUND) { Win32MessageBox.Show(IntPtr.Zero, Invariant($"{Resources.Error_CredReadFailed} {ErrorCodeConverter.MessageFromErrorCode(error)}"), Win32MessageBox.Flags.OkOnly | Win32MessageBox.Flags.Topmost | Win32MessageBox.Flags.TaskModal); } return(null); }
public bool ValidateX509Certificate(X509Certificate certificate, string message) { var certificate2 = certificate as X509Certificate2; Debug.Assert(certificate2 != null); if (certificate2 == null || !certificate2.Verify()) { // Use native message box here since Win32 can show it from any thread. // Parent window must be NULL since otherwise the call hangs since VS // is in modal state due to the progress dialog. Note that native message // box appearance is a bit different from VS dialogs and matches OS theme // rather than VS fonts and colors. if (Win32MessageBox.Show(_coreShell.AppConstants.ApplicationWindowHandle, message, Win32MessageBox.Flags.YesNo | Win32MessageBox.Flags.IconWarning) == Win32MessageBox.Result.Yes) { certificate2.Reset(); return(true); } } return(false); }
private static void Phase2InitializationUIStage(object arg) { _initializationFailsafe.Initialize(delegate { _appInitializationSequencer.UIReady(); }); ProcessAppArgs(); Download.Instance.Phase2Init(); if (!ZuneShell.DefaultInstance.NavigationsPending && ZuneShell.DefaultInstance.CurrentPage is StartupPage) { ZuneUI.Shell.NavigateToHomePage(); } if (_dbRebuilt) { string caption = ZuneLibrary.LoadStringFromResource(109U); string text = ZuneLibrary.LoadStringFromResource(110U); if (!string.IsNullOrEmpty(caption) && !string.IsNullOrEmpty(text)) { Win32MessageBox.Show(text, caption, Win32MessageBoxType.MB_ICONHAND, null); } } _phase2InitComplete = true; }