Beispiel #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            IMainForm mf = new MainForm();
            Map map= new Map();
            MainPresenter mainControler = new MainPresenter(mf, map);

            Application.Run((MainForm)mf);
        }
Beispiel #2
0
        public MainPresenter(IMainForm mainForm, Map map)
        {
            _mainForm = mainForm;
            _map = map;

            _mainForm.AddedObstical += _mainForm_AddedObstical;
            _mainForm.MovedCar += _mainForm_MovedCar;
            _mainForm.OpenFileClick += _mainForm_OpenFileClick;
            _mainForm.SaveFileClick += _mainForm_SaveFileClick;
            _mainForm.DeletedObstical += _mainForm_DeletedObstical;
            _mainForm.WasSetDestination += _mainForm_WasSetDestination;
            _mainForm.NeedRepaint += _mainForm_NeedRepaint;
            _mainForm.SelectedPointForRoad += _mainForm_SelectedPointForRoad;
            _mainForm.CreateRoad += _mainForm_CreateRoad;
            _mainForm.eventDrawRadarVector += _mainForm_eventDrawRadarVector;
            _mainForm.MoveCar += _mainForm_MoveCar;
            _mainForm.RotateCar += _mainForm_RotateCar;
            _mainForm.FindObstacle += _mainForm_FindObstacle;
        }
Beispiel #3
0
        private void _mainForm_OpenFileClick(object sender, string filePath)
        {
            try
            {
                if (File.Exists(filePath))
                {
                    _map = Map.LoadMap(filePath);

                    RepaintMap(true);

                }
                else
                    _mainForm.CallFileNotExist();

            }
            catch (Exception ex)
            {
                _mainForm.CallError(ex.Message);
            }
        }