Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            entitiesController    = new EntitiesController();
            contextMenuController = new ContextMenuController(entityMenuGrid);
            canvasController      = new CanvasController(mainWindowCanvas, entitiesController, canvasScrollViewer);
            sceneController       = new SceneController(this);
            PrefabController.Init(this);
            prefabController = PrefabController.Instance;

            this.PreviewKeyDown += new KeyEventHandler(MainWindowKeyDownHandler);
            this.PreviewKeyDown += new KeyEventHandler(MainWindowDebugKey);
            this.PreviewKeyUp   += new KeyEventHandler(MainWindowKeyUpHandler);

            mainWindowCanvas.MouseLeftButtonUp   += canvasController.CanvasMouseLeftButtonUp;
            mainWindowCanvas.MouseLeftButtonDown += canvasController.CanvasMouseLeftButtonDown;
            mainWindowCanvas.MouseMove           += canvasController.CanvasMouseMove;
            mainWindowCanvas.MouseWheel          += canvasController.CanvasMouseWheel;
            mainWindowCanvas.MouseLeave          += canvasController.CanvasMouseLeave;

            Search = new SearchBar {
                SearchText = "", DataListEntities = dataListEntities, mainWindow = this
            };
            this.DataContext = Search;
        }
        public CanvasController(Canvas canvas, EntitiesController _entitiesController, ScrollViewer _canvasScroller)
        {
            if (instance == null)
            {
                instance = this;

                mainWindowCanvas   = canvas;
                entitiesController = _entitiesController;
                canvasScroller     = _canvasScroller;

                selectionBox = (Rectangle)mainWindowCanvas.FindName("SelectBox");
            }
        }