Ejemplo n.º 1
0
        private void bSave_Click(object sender, EventArgs e)
        {
            if (tb.Text != "")
            {
                scene.title    = textBox2.Text;
                scene.subtitle = textBox1.Text;
                scene.name     = tb.Text;
                string output = JsonConvert.SerializeObject(scene);
                Directory.CreateDirectory(Environment.CurrentDirectory + "\\scenes");
                StreamWriter file = File.CreateText(Environment.CurrentDirectory + "\\scenes" + "\\" + scene.name + ".json");
                file.Write(output);
                file.Close();

                EditorScene newForm = new EditorScene(scene);
                newForm.Owner = Owner;
                Close();
                newForm.Show();
            }
            else
            {
                MessageBox.Show("No name");
            }
        }
Ejemplo n.º 2
0
        private void bOpen_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string filename = openFileDialog1.FileName;
                try
                {
                    Scene scene = Scene.openScene(filename);

                    EditorScene newForm = new EditorScene(scene);
                    newForm.Owner = this;
                    Hide();
                    newForm.Show();
                }
                catch
                {
                    MessageBox.Show("Not scene in file");
                }
            }
            else
            {
                return;
            }
        }