Пример #1
0
        private void New()
        {
            _scenario = new ScenarioModel();
            _sim      = new Core.Simulation(_scenario);

            ScenarioLoaded = true;

            SpeedRatio = 1.0D;

            if (ViewPortCollection.Count() > 0)
            {
                ViewPortSelectionChanged(ViewPortCollection.First().Code);
            }
        }
Пример #2
0
        private void Loading(string path)
        {
            BusyContent = "Загрузка сценария...";
            IsBusy      = true;

            BackgroundWorker bw = new BackgroundWorker();

            bw.RunWorkerCompleted += (s, e) =>
            {
                if (e.Error != null)
                {
                    System.Windows.MessageBox.Show("Сценарий поврежден и не может быть прочитан");
                }

                _sim = new Core.Simulation(_scenario);

                ScenarioLoaded = true;

                if (ViewPortCollection.Count() > 0)
                {
                    ViewPortSelectionChanged(ViewPortCollection.First().Code);
                }

                while (Properties.Settings.Default.LastScenarios.Contains(path))
                {
                    Properties.Settings.Default.LastScenarios.Remove(path);
                }
                Properties.Settings.Default.LastScenarios.Add(path);
                Properties.Settings.Default.Save();

                OnPropertyChanged("WindowTitle");

                IsBusy = false;
            };
            bw.DoWork += (s, e) =>
            {
                string p = (string)e.Argument;
                Scenario.IO.ScenarioStream st = new Scenario.IO.ScenarioStream(p);
                _scenario = st.Read();

                _scenario.Map.Init();
            };
            bw.RunWorkerAsync(path);
        }
Пример #3
0
        private void MapConfig()
        {
            var wnd = new View.ConfigWindows.MapConfigWindow();

            wnd.Owner = Helpers.MVVM.MVVMHelper.GetActiveWindow();
            var vm = new ViewModel.MapConfigViewModel(_scenario);

            wnd.DataContext = vm;
            wnd.ShowDialog();
            if (vm.DialogResult == true)
            {
                _scenario.Map = vm.Map;
                _scenario.InputOutputPoints = vm.AllWayPoints.Select(pvm => pvm.WayPoint).ToList();
                OnPropertyChanged("MapSizeInfo");
                if (ViewPortCollection.Count() > 0)
                {
                    ViewPortSelectionChanged(ViewPortCollection.First().Code);
                }
            }
        }