private SelectStreamWindow(List <PerforceStreamRecord> Streams, string StreamName)
        {
            InitializeComponent();

            this.SelectedStream = StreamName;

            // Set up the image list
            ImageList PerforceImageList = new ImageList();

            PerforceImageList.ImageSize  = new Size(16, 16);
            PerforceImageList.ColorDepth = ColorDepth.Depth32Bit;
            PerforceImageList.Images.AddStrip(Properties.Resources.Perforce);
            StreamsTreeView.ImageList = PerforceImageList;

            // Build a map of stream names to their nodes
            Dictionary <string, StreamNode> IdentifierToNode = new Dictionary <string, StreamNode>(StringComparer.InvariantCultureIgnoreCase);

            foreach (PerforceStreamRecord Stream in Streams)
            {
                if (Stream.Identifier != null && Stream.Name != null)
                {
                    IdentifierToNode[Stream.Identifier] = new StreamNode(Stream);
                }
            }

            // Create all the depots
            Dictionary <string, StreamDepot> NameToDepot = new Dictionary <string, StreamDepot>(StringComparer.InvariantCultureIgnoreCase);

            foreach (StreamNode Node in IdentifierToNode.Values)
            {
                if (Node.Record.Parent == null)
                {
                    string DepotName;
                    if (PerforceUtils.TryGetDepotName(Node.Record.Identifier, out DepotName))
                    {
                        StreamDepot Depot;
                        if (!NameToDepot.TryGetValue(DepotName, out Depot))
                        {
                            Depot = new StreamDepot(DepotName);
                            NameToDepot.Add(DepotName, Depot);
                        }
                        Depot.RootNodes.Add(Node);
                    }
                }
                else
                {
                    StreamNode ParentNode;
                    if (IdentifierToNode.TryGetValue(Node.Record.Parent, out ParentNode))
                    {
                        ParentNode.ChildNodes.Add(Node);
                    }
                }
            }

            // Sort the tree
            Depots = NameToDepot.Values.OrderBy(x => x.Name).ToList();
            foreach (StreamDepot Depot in Depots)
            {
                Depot.Sort();
            }

            // Update the contents of the tree
            PopulateTree();
            UpdateOkButton();
        }