public EditBoat(Boat b) { _boat = b; InitializeComponent(); LoadBoatTypes(); nameTB.Text = _boat.Name; numberTB.Text = _boat.Number; colorBTN.BackColor = Color.FromArgb(_boat.Color); if(b.BoatType==null) { typeCB.SelectedIndex = 0; } else { for (int i = 0; i < typeCB.Items.Count; i++) { if (((BoatType)typeCB.Items[i]).Id == _boat.BoatType.Id) { typeCB.SelectedIndex = i; break; } } } }
public ImportFiles(Boat b) { InitializeComponent(); _boat = b; LoadFiles(); fileInfoLBL.Text = ""; boatLBL.Text = _boat.Name + " " + _boat.Number; }
private void AutoImportGpsDataFileParameters(Race race) { int number = 0; foreach (string gpsDataFile in _gpsDataFileParameters) { try { AmphibianSoftware.VisualSail.Data.Boat b = new AmphibianSoftware.VisualSail.Data.Boat(); b.BoatType = BoatType.FindAll()[0]; System.IO.FileInfo file = new System.IO.FileInfo(gpsDataFile); if (file.Name.Contains(".")) { b.Name = file.Name.Substring(0, file.Name.LastIndexOf(".")); } else { b.Name = file.Name; } b.Color = ColorHelper.AutoColorPick(number).ToArgb(); number++; b.Number = number.ToString(); b.Save(); if (System.IO.File.Exists(gpsDataFile)) { AmphibianSoftware.VisualSail.Data.Import.FileImporter fi = AmphibianSoftware.VisualSail.Data.Import.FileImporter.DetectFileType(gpsDataFile); //BusyDialogManager.Show("Importing Data"); SensorFile sf = fi.ImportFile(gpsDataFile, b); sf.Save(); //BusyDialogManager.HideAll(); } race.Boats.Add(b); } catch (Exception e) { MessageBox.Show("A problem occured while loading " + gpsDataFile + "." + Environment.NewLine + e.Message); } } _gpsDataFileParameters.Clear(); _gpsDataFileParameters = null; }
private void cancelBTN_Click(object sender, EventArgs e) { _boat = null; this.DialogResult = DialogResult.Cancel; this.Close(); }
private void newBoatBTN_Click_1(object sender, EventArgs e) { Boat b = new Boat("New Boat", "Sail Number", AmphibianSoftware.VisualSail.Library.ColorHelper.AutoColorPick(_race.Boats.Count).ToArgb(), BoatType.FindAll()[0]); EditBoat eb = new EditBoat(b); eb.ShowDialog(); if (eb.DialogResult==DialogResult.OK) { b = eb.Boat; b.Save(); //EditSensorFiles esf = new EditSensorFiles(b); //esf.ShowDialog(); ImportFiles imfi = new ImportFiles(b); imfi.ShowDialog(); b.RefreshGpsBounds(); _boats.Add(b); _race.Boats.Add(b); LoadBoats(); } }
public static ReplayBoat FromBoat(ref Boat boat/*,DateTime start, DateTime end*//*,Notify updateStatistics*/) { ReplayBoat newBoat = ReplayBoat.FindById(boat.Id); boat = newBoat; return newBoat; }
public abstract SensorFile ImportFile(string path, Boat boat);
private void AutoImportGpsDataFileParameters(Race race) { int number = 0; foreach (string gpsDataFile in _gpsDataFileParameters) { try { AmphibianSoftware.VisualSail.Data.Boat b = new AmphibianSoftware.VisualSail.Data.Boat(); b.BoatType = BoatType.FindAll()[0]; System.IO.FileInfo file = new System.IO.FileInfo(gpsDataFile); if (file.Name.Contains(".")) { b.Name = file.Name.Substring(0, file.Name.LastIndexOf(".")); } else { b.Name = file.Name; } b.Color = ColorHelper.AutoColorPick(number).ToArgb(); number++; b.Number = number.ToString(); b.Save(); if (System.IO.File.Exists(gpsDataFile)) { AmphibianSoftware.VisualSail.Data.Import.FileImporter fi = AmphibianSoftware.VisualSail.Data.Import.FileImporter.DetectFileType(gpsDataFile); //BusyDialogManager.Show("Importing Data"); SensorFile sf = fi.ImportFile(gpsDataFile, b); sf.Save(); //BusyDialogManager.HideAll(); } race.Boats.Add(b); } catch (Exception e) { MessageBox.Show("A problem occured while loading " + gpsDataFile+"."+Environment.NewLine+e.Message); } } _gpsDataFileParameters.Clear(); _gpsDataFileParameters = null; }