private void btnConnect_Click(object sender, EventArgs e)
        {
            btnConnect.Text    = "Connecting";
            btnConnect.Enabled = false;

            if (cmb_configurations.SelectedIndex >= 0 && cmb_configurations.SelectedItem.ToString() != "<< Create new server configuration >>")
            {
                try {
                    ServerConnection.Configuration config = _myCrmHelper.Configurations[cmb_configurations.SelectedIndex];
                    config.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential("tnd_dlagrew", "Welcome1", "tnd");
                    //config.Credentials.Windows.ClientCredential.UserName = "******";
                    //config.Credentials.Windows.ClientCredential.Password = "******";
                    // Set IServiceManagement for the current organization.
                    _myCrmHelper.SetIServiceManagementForOrganization(ref config);

                    btnConnect.Enabled = true;
                    btnConnect.Text    = "Connect";

                    Views.RibbonDownloadForm ribbonDlForm = new RibbonDownloadForm(config);
                    ribbonDlForm.Text      = config.ServerAddress.ToString() + ": " + config.OrganizationName;
                    ribbonDlForm.MdiParent = this.MdiParent;
                    ribbonDlForm.Show();

                    this.Close();
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Example #2
0
        private void orgConfig_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            ToolStripMenuItem selectedItem        = sender as ToolStripMenuItem;
            String            selectedIndexString = selectedItem.Text.Split(')')[0];
            int selectedIndex = int.Parse(selectedIndexString);

            ServerConnection.Configuration config = _myCrmHelper.Configurations[selectedIndex - 1];
            _myCrmHelper.SetIServiceManagementForOrganization(ref config);

            Views.RibbonDownloadForm ribbonDlForm = new RibbonDownloadForm(config);
            ribbonDlForm.Text      = config.ServerAddress.ToString() + ": " + config.OrganizationName;
            ribbonDlForm.MdiParent = this;
            Cursor.Current         = Cursors.Default;
            ribbonDlForm.Show();
        }
Example #3
0
        private void SaveConfiguration()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                _myCrmHelper.SaveConfiguration(_newConfig, true);
                _myCrmHelper.SetIServiceManagementForOrganization(ref _newConfig);
                MainView parentForm = this.MdiParent as MainView;
                parentForm.PopulateSavedConfigurations();

                Views.RibbonDownloadForm ribbonDlForm = new RibbonDownloadForm(_newConfig);
                ribbonDlForm.Text          = _newConfig.ServerAddress.ToString() + ": " + _newConfig.OrganizationName;
                ribbonDlForm.MdiParent     = this.MdiParent;
                ribbonDlForm.StartPosition = FormStartPosition.CenterScreen;
                ribbonDlForm.Show();

                Cursor.Current = Cursors.Default;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }