private void contractSelectButton_Click(object sender, EventArgs e) { string pathFile = Application.StartupPath + "\\prevPath\\docPrevPath.loc"; string dir = File.ReadAllText(pathFile); if (!Directory.Exists(dir)) { dir = "c:\\"; } using (OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = dir, ValidateNames = true, Multiselect = true, Filter = "Word Document|*.docx|" + "Word 97-2003|*.doc" }) { if (ofd.ShowDialog() == DialogResult.OK) { foreach (var filename in ofd.FileNames) { FileIconControl fic = new FileIconControl(filename); fic.OnKeySetChanged += checkIfTrainEnabled; fileFlowLayout.Controls.Add(fic); } File.WriteAllText(pathFile, Path.GetDirectoryName(ofd.FileName)); } } }
public KeyPickerDialog(FileIconControl fileControl, string fileName, string text) { InitializeComponent(); textBox.AutoWordSelection = true; FileControl = fileControl; textBox.Text = TextAnalyzer.Instance.formatData(text); Text = fileName; keyStringLocked.Text = fileControl.KeyString; beforeContextNum.Value = fileControl.ContextBefore.Length >= 3 ? fileControl.ContextBefore.Length:20; afterContextNum.Value = fileControl.ContextAfter.Length >= 3 ? fileControl.ContextAfter.Length : 20; afterCheckBox.Checked = fileControl.AfterContextCounts; beforeCheckBox.Checked = fileControl.BeforeContextCounts; isKeyCountBox.Checked = fileControl.KeyCounts; textBox.Select(fileControl.SelectionIndex, keyStringLocked.Text.Length); fileControl.KeySet = false; }