コード例 #1
0
ファイル: CopyCommand.cs プロジェクト: kanbang/Colt
 protected static void ResetItems(OpenResourceManager omgr, IEnumerable<RepositoryItem> rs, ServerConnectionManager connMgr)
 {
     foreach (var ri in rs)
     {
         var conn = connMgr.GetConnection(ri.ConnectionName);
         ResetItem(omgr, ri, conn);
     }
 }
コード例 #2
0
ファイル: OpenResourceIdDialog.cs プロジェクト: kanbang/Colt
 public OpenResourceIdDialog(ServerConnectionManager connMgr)
     : this()
 {
     var items = new List<KeyValuePair<string, IServerConnection>>();
     foreach (var name in connMgr.GetConnectionNames())
     {
         items.Add(new KeyValuePair<string, IServerConnection>(name, connMgr.GetConnection(name)));
     }
     cmbConnection.DisplayMember = "Key"; //NOXLATE
     cmbConnection.DataSource = items;
     cmbConnection.SelectedIndex = 0;
 }
コード例 #3
0
ファイル: CutCommand.cs プロジェクト: kanbang/Colt
 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;
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: CopyCommand.cs プロジェクト: kanbang/Colt
 protected static 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);
             ResetItem(omgr, r, conn);
         }
         else if (rs != null)
         {
             ResetItems(omgr, rs, connMgr);
         }
     }
 }
コード例 #5
0
        private Maestro.Editors.RepositoryHandle[] CollectDependentResources(RepositoryItem[] items, ServerConnectionManager connMgr)
        {
            var ids = new List<Maestro.Editors.RepositoryHandle>();
            foreach (var it in items)
            {
                var conn = connMgr.GetConnection(it.ConnectionName);
                if (it.IsFolder)
                {
                    ids.Add(new Editors.RepositoryHandle(new ResourceIdentifier(it.ResourceId), conn));
                    break;
                }

                try
                {
                    var references = conn.ResourceService.EnumerateResourceReferences(it.ResourceId);
                    ids.AddRange(references.ResourceId.Select(x => new Maestro.Editors.RepositoryHandle(new ResourceIdentifier(x), conn)));
                }
                catch //Back-referencing may not be supported
                {
                }
            }
            return ids.ToArray();
        }