protected static void ResetItem(OpenResourceManager omgr, RepositoryItem ri, IServerConnection conn) { ri.Reset(); if (omgr.IsOpen(ri.ResourceId, conn)) { ri.IsOpen = true; var ed = omgr.GetOpenEditor(ri.ResourceId, conn); if (ed.IsDirty) ri.IsDirty = true; } }
private static new void ResetClipboardedItems(ClipboardService clip, OpenResourceManager omgr, ServerConnectionManager connMgr) { //Reset state of clipboarded items if (clip.HasContent()) { object o = clip.Get(); var r = o as RepositoryItem; var rs = o as RepositoryItem[]; if (r != null) { var conn = connMgr.GetConnection(r.ConnectionName); r.Reset(); if (omgr.IsOpen(r.ResourceId, conn)) { r.IsOpen = true; var ed = omgr.GetOpenEditor(r.ResourceId, conn); if (ed.IsDirty) r.IsDirty = true; } } else if (rs != null) { foreach (var ri in rs) { var conn = connMgr.GetConnection(ri.ConnectionName); ri.Reset(); if (omgr.IsOpen(ri.ResourceId, conn)) { ri.IsOpen = true; var ed = omgr.GetOpenEditor(ri.ResourceId, conn); if (ed.IsDirty) ri.IsDirty = true; } } } } }