예제 #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();
         }
     }
 }