///<summary> /// Default constructor for FerdaArchive class. Initializes all menu controls /// and adds them to the menu. ///</summary> public FerdaMenu( IDockingManager dockManager, ILocalizationManager lockManager, ProjectManager.ProjectManager pm, IControlsManager contMan, IIconProvider provider) : base() { //setting the iconProvider iconProvider = provider; //filling the private fields dockingManager = dockManager; localizationManager = lockManager; ResManager = localizationManager.ResManager; projectManager = pm; controlsManager = contMan; //adding the main group of the menu SetupMainMenuGroup(); //adding the file group of the menu SetupFile(); //adding the edit group of the menu SetupEdit(); //adding the view group of the menu SetupView(); //SetupDesktop(); //adding the actions group of the menu, will be done dynamically //probably calling some function SetupTools(); SetupHelp(); }
/// <summary> /// Loads the project and writes the information about the project File /// </summary> /// <param name="fileName">Name of the xpf file from where the project is loaded</param> /// <param name="parent">Control which cursor should be changed to wait cursor</param> /// <param name="resManager">Resource Manager of the application</param> /// <param name="projectManager">Project Manager class</param> /// <param name="controlsManager">Controls manager that takes care of the controls</param> public static void LoadProject(string fileName, Control parent, ResourceManager resManager, ref ProjectManager.ProjectManager projectManager, IControlsManager controlsManager) { string loadErrors = string.Empty; if (fileName != "") { FileStream fs = null; try { fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open); } catch(FileNotFoundException) { MessageBox.Show(resManager.GetString("ProjectLoadFileNotFound"), resManager.GetString("ProjectLoadErrorCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Cursor previosCursor = parent.Cursor; parent.Cursor = Cursors.WaitCursor; parent.Refresh(); loadErrors = projectManager.LoadProject(fs); controlsManager.ProjectName = fileName; controlsManager.GlobalAdapt(); parent.Cursor = previosCursor; } catch (InvalidOperationException) { MessageBox.Show(resManager.GetString("ProjectLoadInvalidFormat"), resManager.GetString("ProjectLoadErrorCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { fs.Close(); } } //displaying what has happened while loading the project if (loadErrors != string.Empty) { MessageBox.Show(loadErrors, resManager.GetString("ProjectLoadErrorCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error); } }