Orc.NuGetExplorer.Native.CredentialsPrompter.CreateCredUIInfo C# (CSharp) Method

CreateCredUIInfo() private method

private CreateCredUIInfo ( IntPtr owner, bool downlevelText ) : CredUi.CredUiInfo
owner System.IntPtr
downlevelText bool
return CredUi.CredUiInfo
        private CredUi.CredUiInfo CreateCredUIInfo(IntPtr owner, bool downlevelText)
        {
            var info = new CredUi.CredUiInfo();
            info.cbSize = Marshal.SizeOf(info);
            info.hwndParent = owner;

            if (downlevelText)
            {
                info.pszCaptionText = WindowTitle;
                switch (DownlevelTextMode)
                {
                    case DownlevelTextMode.MainInstructionAndContent:
                        if (MainInstruction.Length == 0)
                        {
                            info.pszMessageText = Content;
                        }
                        else if (Content.Length == 0)
                        {
                            info.pszMessageText = MainInstruction;
                        }
                        else
                        {
                            info.pszMessageText = MainInstruction + Environment.NewLine + Environment.NewLine + Content;
                        }
                        break;

                    case DownlevelTextMode.MainInstructionOnly:
                        info.pszMessageText = MainInstruction;
                        break;

                    case DownlevelTextMode.ContentOnly:
                        info.pszMessageText = Content;
                        break;
                }
            }
            else
            {
                // Vista and later don't use the window title.
                info.pszMessageText = Content;
                info.pszCaptionText = MainInstruction;
            }

            return info;
        }
        #endregion