public void DisplayConnectionsList(Form form) { var cs = new ConnectionSelector(false) { StartPosition = FormStartPosition.CenterParent, }; cs.ShowDialog(form); }
public void DisplayConnectionsList(Form form) { var cs = new ConnectionSelector(true, false) { StartPosition = FormStartPosition.CenterParent, }; cs.ShowDialog(form); }
private void button1_Click(object sender, EventArgs e) { var cs = new ConnectionSelector(false, true); if (cs.ShowDialog(this) == DialogResult.OK) { var conn = cs.SelectedConnections.First(); ConnectionManager.Instance.ConnectToServer(conn, null); } }
public void DisplayConnectionsList(Form form) { var cs = new ConnectionSelector(_connectionManager.LoadConnectionsList(), _connectionManager, true, false) { StartPosition = FormStartPosition.CenterParent, ConnectionList = _connectionManager.LoadConnectionsList() }; cs.ShowDialog(form); }
public List <ConnectionDetail> SelectMultipleConnectionDetails() { var cs = new ConnectionSelector { StartPosition = FormStartPosition.CenterParent, }; if (cs.ShowDialog(innerAppForm) == DialogResult.OK) { return(cs.SelectedConnections); } return(new List <ConnectionDetail>()); }
public List <ConnectionDetail> SelectMultipleConnectionDetails() { var cs = new ConnectionSelector(_connectionManager.LoadConnectionsList(), _connectionManager, true) { StartPosition = FormStartPosition.CenterParent, ConnectionList = _connectionManager.LoadConnectionsList() }; if (cs.ShowDialog(_innerAppForm) == DialogResult.OK) { return(cs.SelectedConnections); } return(new List <ConnectionDetail>()); }
/// <summary> /// Asks this manager to select a Crm connection to use /// </summary> public bool AskForConnection(object connectionParameter) { var cs = new ConnectionSelector(_connectionManager.LoadConnectionsList(), _connectionManager) { StartPosition = FormStartPosition.CenterParent, ConnectionList = _connectionManager.LoadConnectionsList() }; if (cs.ShowDialog(_innerAppForm) == DialogResult.OK) { var connectionDetail = cs.SelectedConnections.First(); if (connectionDetail.IsCustomAuth) { if (string.IsNullOrEmpty(connectionDetail.UserPassword)) { var pForm = new PasswordForm() { UserDomain = connectionDetail.UserDomain, UserLogin = connectionDetail.UserName }; if (pForm.ShowDialog(_innerAppForm) == DialogResult.OK) { connectionDetail.UserPassword = pForm.UserPassword; connectionDetail.SavePassword = pForm.SavePassword; } else { return(false); } } } _connectionManager.ConnectToServer(connectionDetail, connectionParameter); if (cs.HadCreatedNewConnection) { if (!_connectionManager.ConnectionsList.Connections.Contains(connectionDetail)) { _connectionManager.ConnectionsList.Connections.Add(connectionDetail); } _connectionManager.SaveConnectionsFile(_connectionManager.ConnectionsList); } return(true); } return(false); }
/// <summary> /// Asks this manager to select a Crm connection to use /// </summary> /// <param name="connectionParameter">The connection parameter.</param> /// <param name="preConnectionRequestAction">The action to be performed before the async call to create the connection. Useful to display a please wait message</param> /// <returns></returns> public bool AskForConnection(object connectionParameter, Action preConnectionRequestAction) { var cs = new ConnectionSelector { StartPosition = FormStartPosition.CenterParent, }; if (cs.ShowDialog(_innerAppForm) == DialogResult.OK) { var connectionDetail = cs.SelectedConnections.First(); if (connectionDetail.IsCustomAuth) { if (connectionDetail.PasswordIsEmpty) { var pForm = new PasswordForm() { UserDomain = connectionDetail.UserDomain, UserLogin = connectionDetail.UserName }; if (pForm.ShowDialog(_innerAppForm) == DialogResult.OK) { connectionDetail.SetPassword(pForm.UserPassword); connectionDetail.SavePassword = pForm.SavePassword; } else { return false; } } } if (preConnectionRequestAction != null) { preConnectionRequestAction(); } ConnectionManager.Instance.ConnectToServer(connectionDetail, connectionParameter); return true; } return false; }
/// <summary> /// Asks this manager to select a Crm connection to use /// </summary> /// <param name="connectionParameter">The connection parameter.</param> /// <param name="preConnectionRequestAction">The action to be performed before the async call to create the connection. Useful to display a please wait message</param> /// <returns></returns> public bool AskForConnection(object connectionParameter, Action preConnectionRequestAction) { var cs = new ConnectionSelector { StartPosition = FormStartPosition.CenterParent, }; if (cs.ShowDialog(_innerAppForm) == DialogResult.OK) { var connectionDetail = cs.SelectedConnections.First(); if (!connectionDetail.UseConnectionString && connectionDetail.IsCustomAuth) { if (connectionDetail.PasswordIsEmpty) { var pForm = new PasswordForm() { UserDomain = connectionDetail.UserDomain, UserLogin = connectionDetail.UserName }; if (pForm.ShowDialog(_innerAppForm) == DialogResult.OK) { connectionDetail.SetPassword(pForm.UserPassword); connectionDetail.SavePassword = pForm.SavePassword; } else { return(false); } } } if (preConnectionRequestAction != null) { preConnectionRequestAction(); } ConnectionManager.Instance.ConnectToServer(connectionDetail, connectionParameter); return(true); } return(false); }
public List<ConnectionDetail> SelectMultipleConnectionDetails() { var cs = new ConnectionSelector(true) { StartPosition = FormStartPosition.CenterParent, }; if (cs.ShowDialog(_innerAppForm) == DialogResult.OK) { return cs.SelectedConnections; } return new List<ConnectionDetail>(); }
/// <summary> /// Asks this manager to select a Crm connection to use /// </summary> /// <param name="connectionParameter">The connection parameter.</param> /// <param name="preConnectionRequestAction">The action to be performed before the async call to create the connection. Useful to display a please wait message</param> /// <returns></returns> public bool AskForConnection(object connectionParameter, Action <List <ConnectionDetail> > preConnectionRequestAction) { var cs = new ConnectionSelector { StartPosition = FormStartPosition.CenterParent, }; if (cs.ShowDialog(innerAppForm) == DialogResult.OK) { if (cs.SelectedConnections.Any(c => c.IsFromSdkLoginCtrl) && cs.SelectedConnections.Count > 1) { MessageBox.Show(innerAppForm, @"You cannot select multiple connections that used SDK Login control", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } foreach (var connectionDetail in cs.SelectedConnections) { if (!connectionDetail.UseConnectionString) { if (connectionDetail.NewAuthType == AuthenticationType.ClientSecret && connectionDetail.ClientSecretIsEmpty) { var pForm = new SecretForm(connectionDetail) { ClientId = connectionDetail.AzureAdAppId.ToString("B") }; if (pForm.ShowDialog(innerAppForm) == DialogResult.OK) { connectionDetail.SetClientSecret(pForm.ClientSecret); connectionDetail.SavePassword = pForm.SaveSecret; } else { return(false); } } else if (connectionDetail.IsCustomAuth) { if (connectionDetail.PasswordIsEmpty && connectionDetail.Certificate == null) { var pForm = new PasswordForm(connectionDetail) { UserDomain = connectionDetail.UserDomain, UserLogin = connectionDetail.UserName }; if (pForm.ShowDialog(innerAppForm) == DialogResult.OK) { connectionDetail.SetPassword(pForm.UserPassword); connectionDetail.SavePassword = pForm.SavePassword; } else { return(false); } } } } } preConnectionRequestAction?.Invoke(cs.SelectedConnections); if (cs.SelectedConnections.First().IsFromSdkLoginCtrl) { //var cd = cs.SelectedConnections.First(); //var ctrl = new CRMLoginForm1(cd.ConnectionId.Value); //if (cd.AzureAdAppId != Guid.Empty) //{ // ctrl.AppId = cd.AzureAdAppId.ToString(); // ctrl.RedirectUri = new Uri(cd.ReplyUrl); //} //ctrl.ShowDialog(); //ConnectionManager.Instance.ConnectToServerWithSdkLoginCtrl(cd, ctrl.CrmConnectionMgr.CrmSvc, // connectionParameter); } else { ConnectionManager.Instance.ConnectToServer(cs.SelectedConnections, connectionParameter); } return(true); } return(false); }