コード例 #1
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();
            }
        }
コード例 #2
0
ファイル: SkipperMDI.cs プロジェクト: brookpatten/VisualSail
        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();
            }
        }
コード例 #3
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();
            }
        }
コード例 #4
0
ファイル: SkipperMDI.cs プロジェクト: brookpatten/VisualSail
        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();
            }
        }