public void CreateHxt(TreeNodeCollection nodeCollection, Hxt hxt, Content contentDataSet) { bool opened = false; // Keep track of opening or closing of TOC entries in the .hxt foreach (TreeNode node in nodeCollection) { if (node.Checked == true) { MtpsNode mtpsNode = node.Tag as MtpsNode; DataRow row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId); string Url; //if (Int32.Parse(row["Size"].ToString()) == 0) // Url = null; //else Url = Path.Combine(hxsSubDir, row[ColumnNames.CONTENTID].ToString() + ApplicationStrings.FILE_EXTENSION_HTM); hxt.WriteStartNode(mtpsNode.Title, Url); opened = true; } if (node.Nodes.Count != 0 || node.Tag != null) { CreateHxt(node.Nodes, hxt, contentDataSet); } if (opened) { opened = false; hxt.WriteEndNode(); } } }
private void timer1_Tick(object sender, EventArgs e) { if (node == null) { timer1.Enabled = false; this.Close(); return; } node.Expand(); if (node.Checked == false) { node.Checked = true; } if (node.Tag != null) { MtpsNode mtpsNode = node.Tag as MtpsNode; TitleLabel.Text = mtpsNode.Title; DataRow row = contentDataSet.Tables[TableNames.ITEM].Rows.Find(mtpsNode.TargetAssetId); if (row != null) { downloadSize += (ulong)Int32.Parse(row["Size"].ToString()); } filesDownloaded += 1; FilesLabel.Text = filesDownloaded.ToString(); SizeLabel.Text = convertToBinaryPrefixed(downloadSize); } if (decendingTree == true && node.FirstNode != null) { node = node.FirstNode; decendingTree = true; return; } if (node.NextNode != null) { node = node.NextNode; decendingTree = true; return; } node = node.Parent; decendingTree = false; if (node == startingNode && decendingTree == false) { timer1.Enabled = false; this.Close(); } }