Added code to raise an error if trying to paste a step in reference to a step that has been deleted by another user (eg: paste before, paste after or paste replace)

Added handlers for new treeview events of NodeCopy and ClipboardStatus
Added exception handlers to handle the exception of trying to use a deleted step as a reference point for a paste operation (before, after or replace)
Added code to set the MyCopyStep property to the value of the new step added in a paste replace operation
This commit is contained in:
Rich
2014-08-06 00:55:41 +00:00
parent b5ded05838
commit a17c27c0a8
5 changed files with 85 additions and 20 deletions

View File

@@ -449,8 +449,12 @@ namespace Volian.Controls.Library
edtitm.PasteSiblingAfter(copyStartID);
break;
case ItemInfo.EAddpingPart.Replace:
edtitm.PasteReplace(copyStartID);
edtitm.Dispose();
EditItem ei = edtitm.PasteReplace(copyStartID);
if (ei.MyItemInfo.ItemID != edtitm.MyItemInfo.ItemID)
{
edtitm.Dispose();
MyCopyStep = ei.MyItemInfo;
}
break;
default:
return false; ;

View File

@@ -1246,8 +1246,8 @@ namespace Volian.Controls.Library
//catch (System.Data.SqlClient.SqlException ex)
catch (Exception ex)
{
if(!HandleSqlExceptionOnCopy(ex))
HandleSqlExceptionOnDelete(ex);
if (HandleSqlExceptionOnCopy(ex)) return this;
HandleSqlExceptionOnDelete(ex);
return this;
}
// Remove the EditItem that was the replaced item.
@@ -1307,7 +1307,12 @@ namespace Volian.Controls.Library
MessageBox.Show("The step being pasted has been deleted", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return true;
}
return false;
if(ex.Message.Contains("This current step has been deleted in another session"))
{
MessageBox.Show("The highlighted step has been deleted by another user.", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return true;
}
return false;
}
public void IdentifyChildren(bool highlight)
{