private void AddConnection_Click(object sender, RoutedEventArgs e)
        {
            Connection connection = new Connection(null, null);
            bool? result = connection.ShowDialog();

            if (!result.HasValue || !result.Value) return;

            var project = (Project)((ComboBoxItem)Projects.SelectedItem).Tag;
            var configExists = ConfigFileExists(project);
            if (!configExists)
                CreateConfigFile(project);

            bool change = AddOrUpdateConnection(project, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, true);
            if (!change) return;

            GetConnections(project);
            foreach (CrmConn conn in Connections.Items)
            {
                if (conn.Name != connection.ConnectionName) continue;

                Connections.SelectedItem = conn;
                GetWebResources(connection.ConnectionString);
                break;
            }
        }
示例#2
0
        private void ModifyConnection_Click(object sender, RoutedEventArgs e)
        {
            if (Connections.SelectedItem == null)
            {
                return;
            }

            string connString = ((CrmConn)Connections.SelectedItem).ConnectionString;

            if (string.IsNullOrEmpty(connString))
            {
                return;
            }

            string     name       = ((CrmConn)Connections.SelectedItem).Name;
            Connection connection = new Connection(name, connString);
            bool?      result     = connection.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            var project      = (Project)((ComboBoxItem)Projects.SelectedItem).Tag;
            var configExists = ConfigFileExists(project);

            if (!configExists)
            {
                CreateConfigFile(project);
            }

            AddOrUpdateConnection(project, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, false);

            GetConnections(project);
            foreach (CrmConn conn in Connections.Items)
            {
                if (conn.Name != connection.ConnectionName)
                {
                    continue;
                }

                Connections.SelectedItem = conn;
                GetWebResources(connection.ConnectionString);
                break;
            }
        }
示例#3
0
        private void AddConnection_Click(object sender, RoutedEventArgs e)
        {
            Connection connection = new Connection(null, null);
            bool?      result     = connection.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            var project      = (Project)((ComboBoxItem)Projects.SelectedItem).Tag;
            var configExists = ConfigFileExists(project);

            if (!configExists)
            {
                CreateConfigFile(project);
            }

            bool change = AddOrUpdateConnection(project, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, true);

            if (!change)
            {
                return;
            }

            GetConnections(project);
            foreach (CrmConn conn in Connections.Items)
            {
                if (conn.Name != connection.ConnectionName)
                {
                    continue;
                }

                Connections.SelectedItem = conn;
                GetWebResources(connection.ConnectionString);
                break;
            }
        }
        private void ModifyConnection_Click(object sender, RoutedEventArgs e)
        {
            if (Connections.SelectedItem == null) return;

            string connString = ((CrmConn)Connections.SelectedItem).ConnectionString;
            if (string.IsNullOrEmpty(connString)) return;

            string name = ((CrmConn)Connections.SelectedItem).Name;
            Connection connection = new Connection(name, connString);
            bool? result = connection.ShowDialog();

            if (!result.HasValue || !result.Value) return;

            var project = (Project)((ComboBoxItem)Projects.SelectedItem).Tag;
            var configExists = ConfigFileExists(project);
            if (!configExists)
                CreateConfigFile(project);

            AddOrUpdateConnection(project, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, false);

            GetConnections(project);
            foreach (CrmConn conn in Connections.Items)
            {
                if (conn.Name != connection.ConnectionName) continue;

                Connections.SelectedItem = conn;
                GetWebResources(connection.ConnectionString);
                break;
            }
        }