コード例 #1
0
 private void duplicateToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null)
     {
         if (treeView1.SelectedNode.Tag != null)
         {
             Export      data = (Export)treeView1.SelectedNode.Tag;
             CloneExport form = new CloneExport();
             ((TextBox)form.Controls["textBox1"]).Text = data.GetName();
             if (form.ShowDialog() == DialogResult.OK)
             {
                 string result = ((TextBox)form.Controls["textBox1"]).Text;
                 if (result != "" && m_vStorageObject.GetExports().FindIndex(exp => exp.GetName() == result) == -1)
                 {
                     MovieClip mv = new MovieClip((MovieClip)data.GetDataObject());
                     m_vStorageObject.AddMovieClip(mv);
                     m_vStorageObject.AddChange(mv);
                     Export ex = new Export(m_vStorageObject);
                     ex.SetId(mv.GetId());
                     ex.SetExportName(result);
                     ex.SetDataObject(mv);
                     m_vStorageObject.AddExport(ex);
                     m_vStorageObject.AddChange(ex);
                     treeView1.Populate(new List <ScObject>()
                     {
                         ex
                     });
                 }
                 else
                 {
                     MessageBox.Show("Cloning failed. Invalid ExportName.");
                 }
             }
             form.Dispose();
         }
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: doio/Ultrapowa-SC-Editor
 private void duplicateToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode != null)
     {
         if (treeView1.SelectedNode.Tag != null)
         {
             Export data = (Export)treeView1.SelectedNode.Tag;
             CloneExport form = new CloneExport();
             ((TextBox)form.Controls["textBox1"]).Text = data.GetName();
             if (form.ShowDialog() == DialogResult.OK)
             {
                 string result = ((TextBox)form.Controls["textBox1"]).Text;
                 if(result != "" && m_vStorageObject.GetExports().FindIndex(exp => exp.GetName() == result) == -1 )
                 {
                     MovieClip mv = new MovieClip((MovieClip)data.GetDataObject());
                     m_vStorageObject.AddMovieClip(mv);
                     m_vStorageObject.AddChange(mv);
                     Export ex = new Export(m_vStorageObject);
                     ex.SetId(mv.GetId());
                     ex.SetExportName(result);
                     ex.SetDataObject(mv);
                     m_vStorageObject.AddExport(ex);
                     m_vStorageObject.AddChange(ex);
                     treeView1.Populate(new List<ScObject>() { ex });
                 }
                 else
                 {
                     MessageBox.Show("Cloning failed. Invalid ExportName.");
                 }
             }
             form.Dispose();
         }
     }
 }