示例#1
0
文件: Ogmo.cs 项目: tlzyh/Ogmo-Editor
        static public void CloseProject()
        {
            //Close all the open levels
            CloseAllLevels();

            //Set the status message
            MainWindow.StatusText = "Closed project " + Project.Name;

            //Call closed event
            if (OnProjectClose != null)
            {
                OnProjectClose(Project);
            }

            //Remove it!
            Project = null;

            //Tool, layer, and entity selection can be cleared now
            LayersWindow.SetLayer(-1);
            ToolsWindow.ClearTool();
            EntitySelectionWindow.ClearSelection();

            //Force a garbage collection
            MainWindow.AddStartPage();
            GC.Collect();
        }
示例#2
0
文件: Ogmo.cs 项目: tlzyh/Ogmo-Editor
        static private void Initialize()
        {
            //Figure out the program directory
            ProgramDirectory = Application.ExecutablePath.Remove(Application.ExecutablePath.IndexOf(Path.GetFileName(Application.ExecutablePath)));

            //Initialize global pens/brushes/bitmaps
            DrawUtil.Initialize();

            //Make sure the recent project list is valid
            InitRecentProjects();

            //The levels holder
            Levels            = new List <Level>();
            CurrentLevelIndex = -1;

            //The windows
            MainWindow            = new MainWindow();
            MainWindow.Shown     += new EventHandler(MainWindow_Shown);
            LayersWindow          = new LayersWindow();
            ToolsWindow           = new ToolsWindow();
            TilePaletteWindow     = new TilePaletteWindow();
            EntitiesWindow        = new EntitiesWindow();
            EntitySelectionWindow = new EntitySelectionWindow();

            LayersWindow.Show(MainWindow);
            ToolsWindow.Show(MainWindow);
            TilePaletteWindow.Show(MainWindow);
            EntitiesWindow.Show(MainWindow);
            EntitySelectionWindow.Show(MainWindow);
            LayersWindow.EditorVisible = ToolsWindow.EditorVisible = TilePaletteWindow.EditorVisible = EntitiesWindow.EditorVisible = EntitySelectionWindow.EditorVisible = false;

            //Add the exit event
            Application.ApplicationExit += onApplicationExit;
        }