コード例 #1
0
 public CredentialsDialog(CredentialRequest request)
     : this()
 {
     messageLabel.Text = request.Message;
     try
     {
         foreach (var frame in request.StackTrace.GetFrames())
         {
             stackTraceListView.Items.Add(new ListViewItem(new string[]
             {
                 frame.GetMethod().ToString(),
                 frame.GetMethod().Module.Assembly.FullName,
                 frame.GetMethod().Module.FullyQualifiedName,
             }));
         }
     }
     catch (Exception ex)
     {
         stackTraceListView.Items.Add(new ListViewItem(new string[]
         {
             string.Format("Failed to read stack trace. {0}", ex.Message),
             ex.TargetSite.Module.Assembly.FullName,
             ex.TargetSite.Module.FullyQualifiedName,
         }));
     }
 }
コード例 #2
0
        public bool RequestCredential(CredentialRequest request, out System.Net.NetworkCredential credential)
        {
            credential = null;

            var dialog = new CredentialsDialog(request);
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                credential = dialog.GetCredential();
                return true;
            }

            return false;
        }