Exemple #1
0
        private static void GetGrouped(Search search, Group group)
        {
            search.Items = 0;

            foreach (IXenConnection connection in ConnectionsManager.XenConnectionsCopy)
            {
                if (connection.IsConnected && Helpers.GetPoolOfOne(connection) != null)
                {
                    foreach (IXenObject o in connection.Cache.XenSearchableObjects)
                        if (!Hide(o))
                            group.FilterAdd(search.Query,o );
                }
                else
                {
                    // Fake out disconnected connections with a host.
                    // We do this because IXenConnection is not an IXenObject, and so 
                    // is not XenSearchable and cannot be put in the treeview.
                    Host disconnectedHost = new Host();
                    disconnectedHost.opaque_ref = connection.HostnameWithPort;
                    disconnectedHost.name_label = Helpers.GetName(connection);
                    disconnectedHost.Connection = connection;

                    group.FilterAdd(search.Query, disconnectedHost);
                }
            }

            if (Search.GetStorageLinkConnectionsCopy != null)
            {
                List<StorageLinkConnection> storageLinkConnections = Search.GetStorageLinkConnectionsCopy();
                foreach (StorageLinkConnection storageLinkConnection in storageLinkConnections)
                {
                    foreach (IXenObject o in storageLinkConnection.Cache.XenSearchableObjects(ConnectionsManager.XenConnectionsCopy))
                    {
                        if (!Hide(o))
                            group.FilterAdd(search.Query, o);
                    }
                }
            }
        }