Message 1 of 4
How to close the Editing Request Placed window programmatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I implemented the error handling as follows
public class MyWorksetElementPreprocessor : IFailuresPreprocessor
{
public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
{
IList<FailureMessageAccessor> failList = new List<FailureMessageAccessor>();
failList = failuresAccessor.GetFailureMessages();
foreach (FailureMessageAccessor failure in failList)
{
FailureDefinitionId failID = failure.GetFailureDefinitionId();
if (failID == BuiltInFailures.EditingFailures.OwnedByOther)
{
failuresAccessor.ResolveFailure(failure);
return FailureProcessingResult.ProceedWithRollBack;
}
}
return FailureProcessingResult.Continue;
}
}
private static Transaction MakeTransaction(Document doc, string name, bool useFailureHandlingOpts)
{
Transaction t = new Transaction(doc, name);
if (useFailureHandlingOpts)
{
FailureHandlingOptions opts = t.GetFailureHandlingOptions();
opts.SetClearAfterRollback(true);
opts.SetFailuresPreprocessor(new MyWorksetElementPreprocessor());
t.SetFailureHandlingOptions(opts);
}
return t;
}
public bool UpdateProjectEdit(Document _doc, TreeView _treeview, string _name)
{
bool result = false;
TreeNode elms = _treeview.SelectedNode;
Element elm_rename = (Element)elms.Tag;
TransactionStatus t_status;
using (Transaction t = MakeTransaction(_doc, "Rename element " + elm_rename.Name, true))
{
t.Start();
elm_rename.Name = _name;
t_status = t.Commit();
}
if (t_status != TransactionStatus.RolledBack)
{
result = true;
}
return result;
}
But when processing a borrowed item error, this window appears
I do not know yet how to close this window automatically. Does anyone have any advice?