예제 #1
0
        private bool vueMode = false; // false = ortho, true = orbite

        #endregion Fields

        #region Constructors

        internal Editor(EditorController _controller)
        {
            InitializeComponent();
            controller = _controller;

            // Ne pas enlever Forms : c'est pour éviter l'ambiguïté.
            KeyDown += controller.KeyPressed;
            KeyUp += controller.KeyUnPressed;
            GamePanel.MouseDown += new Forms.MouseEventHandler(controller.MouseButtonDown);
            GamePanel.MouseUp += new Forms.MouseEventHandler(controller.MouseButtonUp);
            GamePanel.MouseEnter += new EventHandler(GamePanel_MouseEnter);
            GamePanel.MouseLeave -= new EventHandler(GamePanel_MouseExit);
            GamePanel.MouseWheel += new Forms.MouseEventHandler(controller.RouletteSouris);
            GamePanel.MouseMove += new Forms.MouseEventHandler(controller.MouseMove);
            /// Resize on resize only
            Application.Current.MainWindow.SizeChanged += new SizeChangedEventHandler(ResizeGamePanel);

            settings = (new ConfigPanelData()).LoadSettings();
            profiles = (new ConfigPanelData()).LoadProfiles();

            var defaultProfile = profiles.Where(x => settings != null && x.CompareTo(settings.DefaultProfile) == 0);

            if (defaultProfile.Count() > 0)
            {
                selectedProfile = defaultProfile.First();
                controller.ChangeProfile(selectedProfile);
            }
            else
            {
                selectedProfile = profiles[0];
                controller.ChangeProfile(selectedProfile);
            }
        }
예제 #2
0
 private void LoadEditor(object sender, EventArgs e)
 {
     var model = new Engine();
     var controller = new EditorController(model);
     actualPage = new Editor(controller);
     model.subscribe((Observer)actualPage);
     ((Editor)actualPage).LoadMainMenu += LoadMainMenu;
     content.Navigate(actualPage);
 }