/// <summary> /// Start Kotarak configuration management plugin Form /// </summary> private void StartKotarakPlugin() { KotarakMainForm KotarakPlugin = new KotarakMainForm(containers_list); KotarakPlugin.Name = "kotarak"; KotarakPlugin.Text = GlobalVar.VERSION + " - Kotarak - Configuration Management"; KotarakPlugin.Show(); }
/// <summary> /// Helper function used when creating a new connection from already opened sessions form. /// This is needed because we don't have a direct access to the session group from there. /// Therefore we need to find a group for particular hostname from the main containers list. /// </summary> public string[] GetGroupsForPwdLessHostname(List <GroupBox> containers_list, string new_hostname) { string[] return_group = new string[2]; foreach (GroupBox container in containers_list) { string group = null; string sub_group = null; string hostname = null; foreach (Control control in container.Controls) { if (control.Name == "hostname_textbox") { hostname = KotarakMainForm.ReadValueFromControl(control); } if (control.Name == "combobox") { if (control.InvokeRequired) { return((string[])control.Invoke(new Func <string[]>(() => GetGroupsForPwdLessHostname(containers_list, new_hostname)))); } else { group = KotarakMainForm.ReadValueFromControl(control); } } if (control.Name == "sub_groups_combobox") { if (control.InvokeRequired) { return((string[])control.Invoke(new Func <string[]>(() => GetGroupsForPwdLessHostname(containers_list, new_hostname)))); } else { sub_group = KotarakMainForm.ReadValueFromControl(control); } } } if (new_hostname == hostname) { return_group[0] = group; return_group[1] = sub_group; break; } } Console.WriteLine("## GROUPS RETURNED: " + return_group[0] + " and " + return_group[1]); return(return_group); }