private FilePathTextBox CreateFilePathTextBoxControl(string propertyName) { FilePathTextBox result = new FilePathTextBox(); result.SelectedPath = settingsType.GetProperty(propertyName).GetValue(_configs, null).ToString(); result.SelectedPath = Path.GetFullPath(result.SelectedPath); result.OnPathChanged += result_OnPathChanged; result.Tag = propertyName; return result; }
private void result_OnPathChanged(FilePathTextBox sender) { string fullPath = sender.SelectedPath; string appPath = Path.GetDirectoryName(Application.ExecutablePath); if (fullPath.StartsWith(appPath)) fullPath = fullPath.Replace(appPath + "\\", ""); settingsType.GetProperty((string)sender.Tag).SetValue(_configs, fullPath, null); if (sender.Tag.Equals("ConfigurationFolder")) { settingsGrid[3, 2].ChoiceList = getConfigurations(); settingsGrid[3, 2].Text = settingsGrid[3, 2].ChoiceList.Contains(_configs.ConfigurationFile) ? _configs.ConfigurationFile : string.Empty; } _changed = true; }