public Form1()
        {
            InitializeComponent();
            this.activeDesktopGroups = new List<string>();
            try
            {
                this.loadActiveDirectoryGroups();
            }
            catch (Exception ex)
            {
                MessageBox.Show("No active directory found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Shown += (sender, args) => Close();
            }

            this.manager = new SecurityGroupManager(activeDesktopGroups);
            this.manager.onProfileAdded += new SecurityGroupManager.ProfileAddedDelegate(profileAddedHandler);
            this.comboProfiles.SelectedIndexChanged += new System.EventHandler(ComboBox1_SelectedIndexChanged);

            // Loading profile from xml
            const string xmlFile = "profiles.xml";
            this.xmlManager = new XmlManager(xmlFile);
            if (File.Exists(xmlFile))
            {
                try
                {
                    xmlManager.loadXmlFromFile();
                    try
                    {
                        List<Profile> loadedFromXml = xmlManager.fillUpProfilesFromXml();
                        foreach (Profile profile in loadedFromXml)
                            manager.addProfile(profile);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("profiles.xml is corrupted", "xml corrupted", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Shown += (sender, args) => Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("profiles.xml is corrupted", "xml corrupted", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Shown += (sender, args) => Close();
                }
            }
            else
            {
                string createText = "<profiles>" + "\n" + "</profiles>";
                File.WriteAllText(xmlFile, createText, Encoding.UTF8);
                xmlManager.loadXmlFromFile();
            }
        }