private void SalesforceConnect_Click(object sender, RoutedEventArgs e)
        {
            SaveSalesforceConnectionInfo();

            try {
                StatusText    = string.Format("Connecting to {0}...", SalesforceUrl);
                salesforceAPI = new SalesforceApi(SalesforceUrl, SalesforceUsername, SalesforcePassword, SalesforceToken);
                StatusText    = string.Format("Retrieving object listing...", SalesforceUrl);
                List <string> sfObjects = salesforceAPI.GetObjectNames();
                sfObjects.Sort(StringComparer.InvariantCultureIgnoreCase);
                SalesforceObjects.Clear();
                foreach (string sObjectName in sfObjects)
                {
                    SalesforceObjects.Add(new CheckedListItem(sObjectName)
                    {
                        IsChecked = SalesforceSelectedObjects.Contains(sObjectName)
                    });
                }
                FilterSalesforceObjects(null);
                if (SalesforceObjects.Count > 0)
                {
                    GenerateScriptVisibility = Visibility.Visible;
                }
                SalesforceObjects_CollectionChanged(null, null);
                StatusText = string.Format("Discovered {0} objects", SalesforceObjects.Count);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
 private void SalesforceObjects_ItemCheckedChanged(ObservableCheckedListCheckedChanged e)
 {
     if (e.IsChecked && !SalesforceSelectedObjects.Contains(e.Value))
     {
         SalesforceSelectedObjects.Add(e.Value);
     }
     else if (!e.IsChecked)
     {
         SalesforceSelectedObjects.Remove(e.Value);
     }
     SaveCheckedSalesforceObjectsInfo();
     SalesforceObjects_CollectionChanged(null, null);
 }