private void AddImageToDataset(string fPath) { try { if (t == null) { t = new EditorDataSet(new DataSet { Name = @"Temp", Comment = @"Draft" }); } EditorImage addImg = t.AddImage(fPath); treeView1.Nodes.Clear(); TreeNode root = treeView1.Nodes.Add("{0} - [{1} image(s)]", t.Name, t.Images.Count); foreach (var dsImg in t.Images) { root.Nodes.Add(new TreeNode { Tag = dsImg, Text = dsImg.ToString() }); } } catch (Exception) { } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fDlg = new OpenFileDialog { Filter = "XML Files (*.xml)|*.xml" }; if (fDlg.ShowDialog() != DialogResult.OK) { return; } treeView1.Nodes.Clear(); t = EditorDataSet.Load(datasetService, fDlg.FileName); TreeNode root = treeView1.Nodes.Add("{0} - [{1} image(s)]", t.Name, t.Images.Count); foreach (var dsImg in t.Images) { root.Nodes.Add(new TreeNode { Tag = dsImg, Text = dsImg.ToString() }); } labelTxt.Items.AddRange(t.Labels); editorStatusLabel.Text = string.Format(@"Dataset {0} loaded. {1} images", t.Name, t.Images.Count); }