예제 #1
0
        // return true if we actually tried to open something (false if user cancelled)
        private bool OpenFile()
        {
            if (DisplayUnsavedDialog())
            {
                return(false);
            }

            var  result   = levelOpenFileDialog.ShowDialog();
            bool willOpen = result == DialogResult.OK;

            if (willOpen)
            {
                string fileName = levelOpenFileDialog.FileName;
                EditorState.Level = LevelProxy.Open(fileName);
                // maybe don't do anything below if opening the file fails
                // make sure to add a ShowDialog thing here to show the HOG dialog
                EditorState.FilePath = fileName;
                // EditorState.LevelFileName = "whatever.rl2"; // if we have a HOG
                EditorState.Unsaved = false;
                PushNewRecentFile(EditorState.FilePath);

                MineView.ResetZoom();
                UpdateMineView();
            }
            return(willOpen);
        }
예제 #2
0
        private void OpenRecentFile(int recentFileNum)
        {
            string fileName = EditorState.SavedPrefs.RecentFiles[recentFileNum];

            // TODO: Merge this with the regular open code
            EditorState.Level = LevelProxy.Open(fileName);
            // maybe don't do anything below if opening the file fails
            // make sure to add a ShowDialog thing here to show the HOG dialog
            EditorState.FilePath = fileName;
            // EditorState.LevelFileName = "whatever.rl2"; // if we have a HOG
            EditorState.Unsaved = false;

            MineView.ResetZoom();
            UpdateMineView();
        }
예제 #3
0
 private void zoomOutToolStripMenuItem_Click(object sender, EventArgs e) => MineView?.ZoomOut();
예제 #4
0
 private void UpdateMineView()
 {
     MineView.Owner = this;
     MineView.Refresh();
     // ...
 }