00001 using System;
00002 using System.IO;
00003 using System.Collections.Generic;
00004 using System.ComponentModel;
00005 using System.Data;
00006 using System.Drawing;
00007 using System.Text;
00008 using System.Windows.Forms;
00009
00010 namespace Editor
00011 {
00012 public partial class NewSceneDialog : Form
00013 {
00014 public NewSceneDialog()
00015 {
00016 InitializeComponent();
00017 }
00018
00019 private void NewSceneDialog_Load(object sender, EventArgs e)
00020 {
00021
00022 }
00023
00024 private void btnOk_Click(object sender, EventArgs e)
00025 {
00026
00027
00028
00029 if (File.Exists(fileNameTextBox.Text))
00030 {
00031 DirectoryInfo dInf = Directory.GetParent(fileNameTextBox.Text);
00032
00033 if (dInf.Exists)
00034 {
00035 DialogResult = DialogResult.OK;
00036 }
00037 }
00038 else
00039 {
00040 MessageBox.Show("Please enter a valid file name!");
00041 }
00042 }
00043
00044 private void fileNameTextBox_TextChanged(object sender, EventArgs e)
00045 {
00046
00047 }
00048
00049 private void browseBtn_Click(object sender, EventArgs e)
00050 {
00051 SaveFileDialog dlg = new SaveFileDialog();
00052
00053
00054
00055
00056 dlg.CreatePrompt = true;
00057 dlg.OverwritePrompt = true;
00058
00059
00060
00061 dlg.FileName = "myScene";
00062 dlg.DefaultExt = "xml";
00063 dlg.Filter = "Scene files (*.xml)|*.xml";
00064
00065
00066
00067 DialogResult result = dlg.ShowDialog();
00068 System.IO.Stream fileStream;
00069
00070 if (result == DialogResult.OK)
00071
00072
00073
00074
00075 {
00076 fileStream = dlg.OpenFile();
00077 StreamWriter sw = new StreamWriter(fileStream);
00078 sw.Write("Empty. File was created but no scene information was ever persisted here!");
00079 fileStream.Close();
00080
00081 fileNameTextBox.Text = dlg.FileName;
00082 }
00083
00084 }
00085
00086 private void BtnCancel_Click(object sender, EventArgs e)
00087 {
00088 DialogResult = DialogResult.Cancel;
00089 }
00090 }
00091 }