コード例 #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();
     // ...
 }