Пример #1
0
        /// <summary>
        /// Initialize all documents
        /// </summary>
        public async void Init(int width, int height)
        {
            //Initialize controllers
            documentController        = new DocumentController(this);
            cardController            = new CardController(this);
            sortingBoxController      = new SortingBoxController(this);
            touchController           = new TouchController(this);
            gestureController         = new GestureController(this);
            listenerController        = new GestureListenerController(this);
            baseLayerController       = new BaseLayerController(this);
            cardLayerController       = new CardLayerController(this);
            sortingBoxLayerController = new SortingBoxLayerController(this);
            menuLayerController       = new MenuLayerController(this);
            //Initialize layers
            touchController.Init();
            gestureController.Init();
            listenerController.Init();
            baseLayerController.Init(width, height);
            Coordination.Baselayer = baseLayerController.BaseLayer;//Set the base layer to the coordination helper
            cardLayerController.Init(width, height);
            sortingBoxLayerController.Init(width, height);
            menuLayerController.Init(width, height);
            //Load the documents, cards and add them to the card layer
            Document[] docs = await documentController.Init(FilePath.NewsArticle);//Load the document

            Card[] cards = await cardController.Init(docs);

            CardLayerController.LoadCards(cards);
            //Load the sorting box and add them to the sorting box layer
            sortingBoxController.Init();
            SortingBoxLayerController.LoadBoxes(sortingBoxController.GetAllSortingBoxes());
            //Start the gesture detection thread
            gestureController.StartGestureDetection();
        }
Пример #2
0
 /// <summary>
 /// Destroy the interaction listener
 /// </summary>
 internal void Deinit()
 {
     gestureController.Deinit();
     gestureController = null;
     listenerController.Deinit();
     listenerController = null;
     touchController.Deinit();
     touchController = null;
     sortingBoxController.Deinit();
     sortingBoxController = null;
     cardController.Deinit();
     cardController = null;
     documentController.Deinit();
     documentController = null;
     baseLayerController.Deinit();
     baseLayerController = null;
     cardLayerController.Deinit();
     cardLayerController = null;
     sortingBoxLayerController.Deinit();
     sortingBoxLayerController = null;
     menuLayerController.Deinit();
     menuLayerController = null;
 }