static void Main(string [] args)
        {
            prescreen = new FerdaPrescreen();

            prescreen.Show();
            prescreen.Refresh();

            //tries to load the config
            try
            {
                iceConfig = FrontEndConfig.Load();
            }
            catch
            {
                prescreen.Hide();
                MessageBox.Show("Could not locate the FrontEndConfig.xml configuration file",
                    "Invalid config file",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            //loading the form
            FerdaForm form = new FerdaForm();
            form.SetupResources(iceConfig);

            //switching to the "bin" directory
            string previousDir = FrontEndCommon.SwitchToBinDirectory();

            prescreen.DisplayText(form.ResManager.GetString("LoadingProjectManager"));
            //loading the project manager
            ProjectManager.ProjectManager pm =
                new ProjectManager.ProjectManager(
                args,
                iceConfig.ProjectManagerOptions,
                new Ferda.FrontEnd.OutputI());

            //setting the form for the project manager
            form.RightAfterConstructor(pm, prescreen);

            prescreen.DisplayText(form.ResManager.GetString("LoadingAddIns"));
            //loading the add ins
            loadAddIns(form, pm.ModulesManager.Helper.ObjectAdapter, pm.ModulesManager, form.propertyGrid);
            pm.ModulesManager.AddModuleServices(iceConfig.FrontEndIceObjects);

            //switching to the directory from where it was executed
            FrontEndCommon.SwitchToPreviousDirectory(previousDir);

            //loading the associated file (if there is one)
            if (args.Length > 0 && !(args[0].StartsWith("--")))
            {
                FrontEndCommon.LoadProject(args[0], form, form.ResManager, ref pm,
                    form);
                form.AddToRecentProjects(args[0]);
                form.menu.SetupDesktop();
                form.WindowState = FormWindowState.Maximized;
            }

            prescreen.Hide();
            try
            {
                //running the application
                Application.Run(form);
            }
            finally
            {
                //clearing the add in and project manager resources
                addIns.Clear();
                pm.DestroyProjectManager();
            }

            form.SaveRecentProjects();

            //tries to save the config
            try
            {
                FrontEndConfig.Save(iceConfig);
            }
            catch
            {
                MessageBox.Show("Could not save the FrontEndConfig.xml configuration file",
                    "Invalid config file",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
        /// <summary>
        /// Loads the FrontEndConfig.xml file from the directory, where
        /// the FerdaFrontEnd.exe file is located
        /// </summary>
        /// <exception cref="T:System.Exception">
        /// The loading of the file failed (perhaps the file is not there)
        /// </exception>
        /// <returns>FrontEndConfig object that contains project configuration info
        /// </returns>
        public static FrontEndConfig Load()
        {
            //getting the name of the executing assembly (should be FerdaFrontEnd.exe)
            string assembly = Assembly.GetExecutingAssembly().FullName;
            //getting the name of the exe program (without the suffix)
            assembly = assembly.Substring(0, assembly.IndexOf(','));
            //adding the suffix
            assembly += ".exe";
            //getting the full location fo the .exe file
            StringBuilder str = new StringBuilder(Assembly.GetExecutingAssembly().Location);
            //replacing the .exe by the name of the config file
            str.Replace(assembly, FileName);

            System.IO.FileStream fs;
            //tries to open the file
            try
            {
                fs = new System.IO.FileStream(str.ToString(), System.IO.FileMode.Open);
            }
            catch (Exception e)
            {
                throw new Exception("Application was not able to load FrontEndConfig.xml", e);
            }

            FrontEndConfig config = new FrontEndConfig();

            //tries to deserialize the FrontEndConfig.xml file
            try
            {
                XmlSerializer s = new XmlSerializer( typeof( FrontEndConfig ) );
                TextReader r = new StreamReader(fs);
                config = (FrontEndConfig)s.Deserialize( r );
                r.Close();
            }
            finally
            {
                fs.Close();
            }
            return config;
        }
 /// <summary>
 /// Sets the ResourceManager of the form. This method is not included in the
 /// <see cref="F:Ferda.FrontEnd.FerdaForm.RightAfterConstructor"/> function,
 /// because the program needs resource manager to localize 
 /// </summary>
 /// <param name="config">File with application configuration
 /// </param>
 protected void SetupResources(FrontEndConfig config)
 {
     //setting the ResManager resource manager and localization string
     string locString = "Ferda.FrontEnd.Localization_" + config.ProjectManagerOptions.LocalePrefs[0];
     resManager = new ResourceManager(locString, Assembly.GetExecutingAssembly());
 }
        /// <summary>
        /// Saves the into the location where the executing assembly (.exe file) 
        /// resides
        /// </summary>
        /// <param name="config">Config file that should be saved</param>
        /// <exception cref="T:System.Exception">
        /// The serialization of the file failed
        /// </exception> 
        public static void Save(FrontEndConfig config)
        {
            //getting the name of the executing assembly (should be FerdaFrontEnd.exe)
            string assembly = Assembly.GetExecutingAssembly().FullName;
            //getting the name of the exe program (without the suffix)
            assembly = assembly.Substring(0, assembly.IndexOf(','));
            //adding the suffix
            assembly += ".exe";
            //getting the full location fo the .exe file
            StringBuilder str = new StringBuilder(Assembly.GetExecutingAssembly().Location);
            //replacing the .exe by the name of the config file
            str.Replace(assembly, FileName);

            System.IO.FileStream fs = null;
            try
            {
                fs = new System.IO.FileStream(str.ToString(),System.IO.FileMode.Create);
                XmlSerializer s = new XmlSerializer(typeof(FrontEndConfig));
                TextWriter w = new StreamWriter(fs);
                s.Serialize(w, config);
                w.Close();
            }
            catch (Exception e)
            {
                throw new Exception("Application was not able to save FrontEndConfig.xml", e);
            }
            finally
            {
                fs.Close();
            }
        }