Example #1
0
        /// <summary>
        /// Handle our open button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpen_Click(object sender, EventArgs e)
        {
            NetTcpBinding tcpBinding = MM_Binding_Configuration.CreateBinding();

            ClientFactory = new DuplexChannelFactory <IMM_WCF_Interface>(new MM_Server_Callback_Handler(), tcpBinding, txtServer.Text);
            ClientFactory.Open();
            Client = ClientFactory.CreateChannel();
            frmWindowsSecurityDialog SecurityDialog = new frmWindowsSecurityDialog();

            SecurityDialog.CaptionText = Application.ProductName + " " + Application.ProductVersion;
            SecurityDialog.MessageText = "Enter the credentials to log into Macomber Map Server";
            string    Username, Password, Domain;
            Exception LoginError;

            if (SecurityDialog.ShowLoginDialog(out Username, out Password, out Domain))
            {
                Client.HandleUserLogin(Username, Password);
                MessageBox.Show(this, "Connected.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
 public bool GetAuthCredentials(IWebBrowser browser, bool isProxy, string host, int port, string realm, string scheme, ref string username, ref string password)
 {
     try
     {
         if (pw == null || user == null || pw.Length == 0)
         {
             frmWindowsSecurityDialog SecurityDialog = new frmWindowsSecurityDialog();
             SecurityDialog.CaptionText = Application.ProductName + " " + Application.ProductVersion;
             SecurityDialog.MessageText = "Enter the credentials to log into HistoricServer";
             string domain;
             SecurityDialog.ShowLoginDialog(out user, out pw, out domain);
         }
         username = user;
         password = pw;
     } catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(false);
     }
     return(true);
 }