public SetRevitDataForm(LyrebirdChannel c, GHClient p) { parent = p; channel = c; InitializeComponent(); // Position the form. Left = 0; Top = 0; //MessageBox.Show(string.Format("The system is {0} and the endpoint is:\n{1}", client.State.ToString(), client.Endpoint.Address.ToString())); if (channel != null) { try { string test = channel.DocumentName(); if (test == null) { MessageBox.Show("Error!!!!!!!!!!"); } RevitObject[] temp = channel.FamilyNames().ToArray(); if (temp != null && temp.Any()) familyNames = channel.FamilyNames().ToList(); else { MessageBox.Show("The Lyrebird Service for Revit could not be found. Make sure the service is turned on and try again."); this.Close(); } } catch (Exception ex) { MessageBox.Show("Error\n" + ex.ToString()); } if (familyNames != null && familyNames.Count > 0) { familyComboBox.ItemsSource = familyNames; familyComboBox.DisplayMemberPath = "FamilyName"; bool check = false; if (parent.FamilyName != null) { for (int i = 0; i < familyNames.Count; i++) { string famName = familyNames[i].FamilyName; if (famName == parent.FamilyName) { familyComboBox.SelectedIndex = i; check = true; } } } if (!check) { familyComboBox.SelectedIndex = 0; } } } }