public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { try { return(GoalDeclaration.Parse((string)value)); } catch { return(value); } }
private GoalDeclaration ParseDeclaration(string line) { GoalDeclaration declaration = null; var time = ParseTimeAt(line, 1); var number = int.Parse(line.Substring(10, 2)); var description = "[" + line.Substring(10) + "]"; //parse altitude var strAltitude = line.Substring(12).Split(',')[1]; var altitude = Parsers.ParseLengthOrNaN(strAltitude); // position declaration var strGoal = line.Substring(12).Split(',')[0]; declaration = new GoalDeclaration(number, time, strGoal, altitude) { Description = description }; return(declaration); }