示例#1
0
		private void openTerrain(object sender, EventArgs e)
		{
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.Filter = terrainFileFilter;
			dialog.InitialDirectory = Properties.Settings.Default.OpenFileInitialDirectory;
			if (dialog.ShowDialog() == DialogResult.OK)
			{
				if (this.terrain == null)
				{
					try
					{
						this.terrain = Terrain.Read(dialog.FileName);
					}
					catch (Exception bug)
					{
						MessageBox.Show(bug.ToString(), "Failed to load terrain.");
					}

					if (this.terrain != null)
					{
						this.currentFile = new FileInfo(dialog.FileName);
						Properties.Settings.Default.OpenFileInitialDirectory = this.currentFile.DirectoryName;

						this.initialize();
					}
				}
				else
				{
					Editor editor = new Editor(dialog.FileName);
					editor.Show();
				}
			}
		}
示例#2
0
		private void newTerrain(object sender, EventArgs e)
		{
			SizeDialog dialog = new SizeDialog();
			if (dialog.ShowDialog() == DialogResult.OK)
			{
				Editor editor = new Editor(new Terrain(dialog.SelectedSize, dialog.SelectedSize));
				this.Close();
				editor.Show();
			}
		}