public void menuItemCut_Click(object sender, System.EventArgs e) { if(this.listBoxItem.SelectedItem != null) { this.UndoList.Add(CUT,this.FileList); int index = this.listBoxItem.SelectedIndex; //IDataObject dataObj = new DataObject("AMSFileList.AMSFileInfo",this.FileList.AMSFiles[index]); //Clipboard.SetDataObject(dataObj,true); copyItem = new AMSFileList.AMSFileInfo(this.FileList.AMSFiles[index]); this.listBoxItem.Items.RemoveAt(index); this.FileList.RemoveAt(index); UpdateNumFile(); } }
public void menuItemPaste_Click(object sender, System.EventArgs e) { /*IDataObject DataObj = Clipboard.GetDataObject(); AMSFileList.AMSFileInfo FileInfo = (AMSFileList.AMSFileInfo)DataObj.GetData("AMSFileList.AMSFileInfo",true); if(FileInfo.FileName != null) { AddFile(FileInfo.FileName,FileInfo.FilePath); }*/ if(this.copyItem.FileName != null) { this.UndoList.Add(PASTE,this.FileList); FormGetNumFiles numForm = new FormGetNumFiles(); if(numForm.ShowDialog() == DialogResult.OK) { string FileName; for(int i =0; i< numForm.NumFiles; i++) { string Number; if(this.listBoxItem.Items.Count < 9) { Number = "0" + ((int)(this.listBoxItem.Items.Count + 1)).ToString(); } else { Number = ((int)(this.listBoxItem.Items.Count + 1)).ToString(); } //Set name of new Item to A#-##-Filename (e.g. A0-10_Acad1) FileName = this.Name + "-" + Number + "_"; FileName += this.copyItem.FileName; if(AddFile(FileName,this.copyItem.FilePath) == ERROR_MAX_FILES_EXCEEDED) { MessageBox.Show("Error adding file.\n" + "The number of files has exceeded the maximum: " + this.FileList.AMSFiles.Length.ToString(), "Add New Drawing",MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } } this.copyItem = new AMSFileList.AMSFileInfo(); UpdateNumFile(); } }
public void menuItemCopy_Click(object sender, System.EventArgs e) { if(this.listBoxItem.SelectedItem != null) { //IDataObject dataObj = new DataObject("AMSFileList.AMSFileInfo",this.FileList.AMSFiles[listBoxItem.SelectedIndex]); //Clipboard.SetDataObject(dataObj,true); copyItem = new AMSFileList.AMSFileInfo(this.FileList.AMSFiles[listBoxItem.SelectedIndex]); } }