Esempio n. 1
0
        public SkipperMDI(string path, string version, string aboutLicense)
        {
            _version      = version;
            _aboutLicense = aboutLicense;
            Splash s = new Splash(_version, _aboutLicense);

            s.ShowDialog();
            InitializeComponent();
            mainDP.ActiveAutoHideContent = null;
            mainDP.Name = "mainDP";
            mainDP.BringToFront();
            BusyDialogManager.SetParent(this);
            BusyDialogManager.Hide();
            this.Text = "VisualSail " + _version;
            this.Show();
            saveFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            if (path.EndsWith(".sail"))
            {
                _loadedFile = path;
                TryLoadFile();
            }
            else
            {
                //setting this value invokes special code in LoadFile() which
                //will try to import it
                List <string> files = new List <string>();
                files.Add(path);
                NewFromGpsFiles(files);
            }
        }
Esempio n. 2
0
        private void TryLoadFile()
        {
            try
            {
                BusyDialogManager.Show("Loading " + BusyDialog.CleanPath(_loadedFile));
                Persistance.LoadFromFile(_loadedFile);
                LoadFile();
                ConfigureMenu(true);
                HideGettingStarted();
            }
            catch (Exception ex)
            {
#if NOLICENSE
                throw;
#else
                ConfigureMenu(false);
                _loadedFile = string.Empty;
                MessageBox.Show("A problem occured loading the file." + Environment.NewLine + ex.Message);
                ShowGettingStarted();
#endif
            }
            finally
            {
                BusyDialogManager.Hide();
            }
        }
Esempio n. 3
0
        private void editCourseBTN_Click_2(object sender, EventArgs e)
        {
            BusyDialogManager.Show("Loading Course");
            EditCourses ec = new EditCourses(_race);

            BusyDialogManager.Hide();
            ec.ShowDialog(this.Parent);
            LoadCourses();
        }
Esempio n. 4
0
 private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (saveFD.ShowDialog() == DialogResult.OK)
     {
         BusyDialogManager.Show("Saving");
         _loadedFile = saveFD.FileName;
         Persistance.SaveToFile(_loadedFile);
         BusyDialogManager.Hide();
     }
 }
Esempio n. 5
0
        private void racesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _replay.Stop();
            DateTime currentTime  = _replay.SimulationTime;
            double   currentSpeed = _replay.Speed;

            if (currentSpeed == 0.0)
            {
                currentSpeed = 1.0;
            }
            EditRace er = new EditRace(_replay.Race);

            er.ShowPlayButton = false;
            er.Owner          = this;
            er.ShowDialog();
            if (er.DialogResult == DialogResult.OK)
            {
                BusyDialogManager.Show("Restarting Race");
                _replay.Reset();
                _statisticsForm.Reset();
                foreach (DockContent dc in mainDP.Contents)
                {
                    if (dc is GraphForm)
                    {
                        ((GraphForm)dc).Reset();
                    }
                }

                _replay.Start();
                if (currentTime >= _replay.Race.UtcCountdownStart && currentTime <= _replay.Race.UtcEnd)
                {
                    _replay.TargetTime = currentTime;
                }
                else if (currentTime < _replay.Race.UtcCountdownStart)
                {
                    _replay.TargetTime = _replay.Race.UtcCountdownStart;
                }
                else if (currentTime > _replay.Race.UtcEnd)
                {
                    _replay.TargetTime = _replay.Race.UtcEnd;
                }
                _replay.Speed = currentSpeed;
                _replay.Play();
                _replay.RefreshViewports();
                BusyDialogManager.Hide();
            }
            else
            {
                _replay.Start();
                _replay.TargetTime = currentTime;
                _replay.Speed      = currentSpeed;
                _replay.Play();
            }
        }
Esempio n. 6
0
        private void importBTN_Click(object sender, EventArgs e)
        {
            openFD.ShowDialog();
            string path = openFD.FileName;

            if (File.Exists(path))
            {
                try
                {
                    FileImporter fi = FileImporter.DetectFileType(path);
                    BusyDialogManager.Show("Importing Data");
                    BackgroundWorker bw = new BackgroundWorker();
                    bw.WorkerSupportsCancellation = true;
                    bw.WorkerReportsProgress      = false;



                    bw.DoWork += (s, args) =>
                    {
                        fi.ImportFile(((AddFileToBoatArgument)args.Argument).Path, ((AddFileToBoatArgument)args.Argument).Boat);
                    };

                    bw.RunWorkerCompleted += (s, args) =>
                    {
                        if (args.Error != null)
                        {
                        }
                        else
                        {
                            LoadFiles();
                            BusyDialogManager.Hide();
                        }
                    };



                    bw.RunWorkerAsync(new AddFileToBoatArgument()
                    {
                        Boat = _boat, Path = path
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to import file." + ex.Message);
                }
            }
        }
Esempio n. 7
0
 private void LoadFileInfo(FileInfo[] files)
 {
     //BusyDialogManager.Show("Importing and resizing pictures",this);
     foreach (FileInfo f in files)
     {
         BusyDialogManager.Show("Importing and resizing " + f.Name);
         Photo p = new Photo();
         p.Name = f.Name;
         //TimeZoneInfo tzi = _lake.TimeZone;
         //p.Time = TimeZoneInfo.ConvertTimeToUtc(f.LastWriteTime, tzi);
         ReadExif(f.FullName, p);
         p.Jpg = ConvertAndResize(f.FullName, 640, 480);
         p.Save();
     }
     LoadPhotos();
     BusyDialogManager.Hide();
 }
Esempio n. 8
0
        public SkipperMDI(string version, string aboutLicense)
        {
            _version      = version;
            _aboutLicense = aboutLicense;
            Splash s = new Splash(_version, _aboutLicense);

            s.ShowDialog();
            InitializeComponent();
            mainDP.ActiveAutoHideContent = null;
            mainDP.Name = "mainDP";
            mainDP.BringToFront();
            BusyDialogManager.SetParent(this);
            BusyDialogManager.Hide();
            this.Text = "VisualSail " + _version;
            this.Show();
            saveFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            ShowGettingStarted();
        }
Esempio n. 9
0
        private void LoadFile()
        {
            //_busy.Show();
            SelectRace sr = new SelectRace();

            sr.Owner = this;
            //BusyDialogManager.HideAll();
            DialogResult editResult   = DialogResult.Cancel;
            DialogResult selectResult = sr.ShowDialog(this);
            Race         race         = sr.SelectedRace;

            //kindof a hack, but it gets file one click file loading working
            if (race.Boats.Count == 0 && _gpsDataFileParameters != null)
            {
                AutoImportGpsDataFileParameters(race);
            }

            while (selectResult != DialogResult.Yes && editResult != DialogResult.Yes && selectResult != DialogResult.Cancel)
            {
                if (selectResult == DialogResult.OK)
                {
                    BusyDialogManager.Show("Loading Race");
                    EditRace er = new EditRace(race);
                    er.Owner = this;
                    BusyDialogManager.Hide();
                    editResult = er.ShowDialog(this);
                }
                if (editResult == DialogResult.OK || (editResult == DialogResult.Cancel && Persistance.Data.Race.Count > 0))//go back to the select dialog
                {
                    selectResult = sr.ShowDialog(this);
                    race         = sr.SelectedRace;
                }
                else if (editResult == DialogResult.Cancel && Persistance.Data.Race.Count == 0)
                {
                    //if there's no other races just cancel everything
                    selectResult = DialogResult.Cancel;
                    break;
                }
            }

            if (selectResult != DialogResult.Cancel)
            {
                BusyDialogManager.Show("Starting Race");

#if RENDERER_AUTO || (!RENDERER_GDI && !RENDERER_XNA && !RENDERER_NULL && !RENDERER_AUTO)
                try
                {
                    _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
                catch (Exception e)
                {
                    MessageBox.Show("VisualSail encountered an exception intializing the 3D renderer. " + e.Message + Environment.NewLine + "Switching to 2D Renderer");
                    _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
                }
#endif
#if RENDERER_GDI
                _replay = new Replay(race, new GdiRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_XNA
                _replay = new Replay(race, new XnaRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif
#if RENDERER_NULL
                _replay = new Replay(race, new NullRenderer(), new Notify(this.UpdateStatistics), new Notify(this.UpdateTime));
#endif

                _statisticsForm = new StatisticsForm(_replay);
                _timeForm       = new TimeForm(_replay);
                _bookmarkForm   = new BookMarksForm(_replay);
                _replay.Start();

                _statisticsForm.Show(mainDP, DockState.DockBottom);
                double prop = (double)_timeForm.Width / (double)_statisticsForm.Width;
                _bookmarkForm.Show(_statisticsForm.Pane, DockAlignment.Left, prop);
                _timeForm.Show(_bookmarkForm.PanelPane, _bookmarkForm);
                ViewForm vf = (ViewForm)OpenNewViewport();
                vf.DockState = DockState.Document;
                _statisticsForm.CreateDefaultGraphs();

                BusyDialogManager.Hide();
            }
            else
            {
                ShowGettingStarted();
            }
        }