private void CommandLoginToCrmClicked()
        {
            CRMLoginForm loginForm = new CRMLoginForm(ConnectionInfo);

            loginForm.ContextClassSelectionCompleted += LoginForm_ContextClassSelectionCompleted;
            var dialogResult = loginForm.ShowDialog().GetValueOrDefault();

            RaisePropertyChangedEvent(nameof(ConnectionInfo));
            RaisePropertyChangedEvent(nameof(IsConnectionProvided));
            RaisePropertyChangedEvent(nameof(InvertIsConnectionProvided));
            // return dialogResult;
        }
Exemple #2
0
        private void btnConnect_Click(object sender, RibbonControlEventArgs e)
        {
            CRMLoginForm ctrl = new CRMLoginForm();

            // Wire event to login response.
            ctrl.ConnectionToCrmCompleted += ctrl_ConnectionToCrmCompleted;

            // Show the login control.
            ctrl.ShowDialog();

            // Handle the returned CRM connection object.
            // On successful connection, display the CRM version and connected org name
            if (ctrl.CrmConnectionMgr != null && ctrl.CrmConnectionMgr.CrmSvc != null && ctrl.CrmConnectionMgr.CrmSvc.IsReady)
            {
                MessageBox.Show("Connected to CRM! Version: " + ctrl.CrmConnectionMgr.CrmSvc.ConnectedOrgVersion.ToString() +
                                " Org: " + ctrl.CrmConnectionMgr.CrmSvc.ConnectedOrgUniqueName, "Connection Status");

                // Perform your actions here
            }
            else
            {
                MessageBox.Show("Cannot connect; try again!", "Connection Status");
            }
        }