Beispiel #1
0
        private IViewPort OpenNewViewport()
        {
            ViewForm viewForm = new ViewForm(_replay);

            //viewForm.MdiParent = this;
            //viewForm.Bounds = new Rectangle(0, 0, 584, 354);
            viewForm.Show(mainDP, UIHelper.FindCenteredPosition(mainDP, viewForm));
            //viewForm.DockState = DockState.Document;
            _replay.AddViewPort(viewForm);
            return(viewForm);
        }
Beispiel #2
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();
            }
        }
Beispiel #3
0
 private IViewPort OpenNewViewport()
 {
     ViewForm viewForm = new ViewForm(_replay);
     //viewForm.MdiParent = this;
     //viewForm.Bounds = new Rectangle(0, 0, 584, 354);
     viewForm.Show(mainDP,UIHelper.FindCenteredPosition(mainDP,viewForm));
     //viewForm.DockState = DockState.Document;
     _replay.AddViewPort(viewForm);
     return viewForm;
 }