private void btnNewImage_Click(object sender, EventArgs e) { NameDialog dlgName = new NameDialog(); DialogResult r = dlgName.ShowDialog(this); if (r == DialogResult.OK) { Size itemSize = new Size(Convert.ToInt32(txtWidth.Text), Convert.ToInt32(txtHeight.Text)); SourceItem item = new SourceItem(itemSize, dlgName.SampleType, dlgName.NameText); ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); sourceItems.Add(newItem.GetHashCode(), item); } if (lstInputs.SelectedItems.Count == 0 && lstInputs.Items.Count > 0) { lstInputs.Focus(); lstInputs.Items[0].Selected = true; } }
private void btnGetFERETImages_Click(object sender, EventArgs e) { using (MyOpenFileDialogControl dlgLoad = new MyOpenFileDialogControl()) { dlgLoad.FileDlgCaption = "Select a ERun file..."; dlgLoad.FileDlgFilter = "ENFORM Set File (*.eset)|*.eset|Text File (*.txt) |*.txt|Any file (*.*)|*.*"; if (dlgLoad.ShowDialog() == DialogResult.OK) { if ((dlgLoad.MSDialog as OpenFileDialog).FileNames.Length > 0) { using (StreamReader r = new StreamReader(dlgLoad.FileDlgFileName)) { while (!r.EndOfStream) { string[] s = r.ReadLine().Split(','); string use = s[1].Trim(); string filename = s[3]; if (use == "1") { SourceItem item = new SourceItem(filename, dlgLoad.SampleType); ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); sourceItems.Add(newItem.GetHashCode(), item); } } } } //SourceItem item = new SourceItem(controlex.Filename, 0); //ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); //sourceItems.Add(newItem.GetHashCode(), item); } } }
private void btnLoadImages_Click(object sender, EventArgs e) { /* OpenFileDialog dlgOpen = new OpenFileDialog(); dlgOpen.InitialDirectory = "./"; dlgOpen.Multiselect = true; dlgOpen.Title = "Select file to add to test set..."; dlgOpen.Filter = "Image Files |*.png;*.jpg;*.bmp"; DialogResult r = dlgOpen.ShowDialog(this); if (r == DialogResult.OK) { if (dlgOpen.FileNames.Length > 0) { foreach (String s in dlgOpen.FileNames) { SourceItem item = new SourceItem(s, 0); ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); sourceItems.Add(newItem.GetHashCode(),item); } } } * * / * */ MyOpenFileDialogControl dlgLoad = new MyOpenFileDialogControl(); dlgLoad.FileDlgInitialDirectory = "./"; dlgLoad.FileDlgCaption = "Select file to add to test set..."; dlgLoad.FileDlgFilter = "Image Files (*.png,*.jpg,*.bmp,*.ppm)|*.png;*.jpg;*.bmp;*.ppm"; DialogResult r = dlgLoad.ShowDialog(); if (r == DialogResult.OK) { if ((dlgLoad.MSDialog as OpenFileDialog).FileNames.Length > 0) { foreach (String s in (dlgLoad.MSDialog as OpenFileDialog).FileNames) { SourceItem item = new SourceItem(s, dlgLoad.SampleType); ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); sourceItems.Add(newItem.GetHashCode(), item); } } //SourceItem item = new SourceItem(controlex.Filename, 0); //ListViewItem newItem = lstInputs.Items.Add(new ListViewItem(item.GetStringValues())); //sourceItems.Add(newItem.GetHashCode(), item); } //controlex.Dispose(); if (lstInputs.SelectedItems.Count == 0 && lstInputs.Items.Count > 0) { lstInputs.Focus(); lstInputs.Items[0].Selected = true; } }