public static void interpolateTcxFromGpx(string tcxFile, string gpxFile, MainForm mainForm, GpsData.InterpolateMode mode) { try { TcxResult res = GpsData.interpolateTcxFromGpx(tcxFile, gpxFile, mode); if (res.TCX == null) { Utils.errMsg("Interpolate Tcx From Gpx failed:" + NL + "for " + Path.GetFileName(tcxFile) + NL + " and " + Path.GetFileName(gpxFile) + NL + res.Message); return; } TrainingCenterDatabase tcxInterp = res.TCX; string saveFileName = getSaveName(tcxFile, ".interpolated"); if (saveFileName != null) { tcxInterp.Save(saveFileName); mainForm.gpxTxcCallback(NL + "Recalculated " + tcxFile + NL + " from " + gpxFile + NL + " Output is " + saveFileName + NL + " " + res.Message); } else { return; } } catch (Exception ex) { Utils.excMsg("Error interpolating TCX from GPX", ex); return; } }
public void interpolateTcxFromGpx(GpsData.InterpolateMode mode) { string tcxFile = null, gpxFile = null; OpenFileDialog dlg1 = new OpenFileDialog(); dlg1.Filter = "TCX|*.tcx"; dlg1.Title = "Select TCX file to interpolate to"; dlg1.Multiselect = false; if (dlg1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg1.FileName == null) { string msg = "Interpolate TCX from GPX: Failed to open" + " file in which to interpolate"; raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.WARN, msg)); return; } tcxFile = dlg1.FileName; } else { return; } OpenFileDialog dlg2 = new OpenFileDialog(); dlg2.Filter = "GPX|*.gpx"; dlg2.Title = "Select GPX file to interpolate from"; dlg2.Multiselect = false; if (dlg2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg2.FileName == null) { string msg = "Interpolate TCX from GPX: Failed to" + " open GPX file from which to interpolate"; raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.WARN, msg)); } gpxFile = dlg2.FileName; interpolateTcxFromGpx(tcxFile, gpxFile, mode); } }
public void interpolateTcxFromGpx(string tcxFile, string gpxFile, GpsData.InterpolateMode mode) { try { TcxResult res = GpsData.interpolateTcxFromGpx(tcxFile, gpxFile, mode); if (res.TCX == null) { string msg = "Interpolate Tcx From Gpx failed:" + NL + "for " + Path.GetFileName(tcxFile) + NL + " and " + Path.GetFileName(gpxFile) + NL + res.Message; raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.ERR, msg)); return; } TrainingCenterDatabase tcxInterp = res.TCX; string saveFileName = getSaveName(tcxFile, ".interpolated"); if (saveFileName != null) { tcxInterp.Save(saveFileName); string msg = "Interpolate TCX from GPX: Recalculated " + tcxFile + NL + " from " + gpxFile + NL + " Output is " + saveFileName + NL + " " + res.Message; raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.MSG, NL + msg)); } else { return; } } catch (Exception ex) { string msg = "Error interpolating TCX from GPX"; raiseGpxTcxEvent(new GpxTcxEventArgs(EventType.EXC, msg, ex)); return; } }
public static void interpolateTcxFromGpx(MainForm mainForm, GpsData.InterpolateMode mode) { string tcxFile = null, gpxFile = null; OpenFileDialog dlg1 = new OpenFileDialog(); dlg1.Filter = "TCX|*.tcx"; dlg1.Title = "Select TCX file to interpolate to"; dlg1.Multiselect = false; if (dlg1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg1.FileName == null) { Utils.warnMsg("Failed to open file to interpolate to"); return; } tcxFile = dlg1.FileName; } else { return; } OpenFileDialog dlg2 = new OpenFileDialog(); dlg2.Filter = "GPX|*.gpx"; dlg2.Title = "Select GPX file to interpolate from"; dlg2.Multiselect = false; if (dlg2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg2.FileName == null) { Utils.warnMsg("Failed to open GPX file to interpolate from"); return; } gpxFile = dlg2.FileName; interpolateTcxFromGpx(tcxFile, gpxFile, mainForm, mode); } }