示例#1
0
        //This function will de-activate all current datasets and activate the designated dataset.
        //It is assumed the dataset being activated has already been loaded (either through code
        //elsewhere or via the Vuforia Configuration).
        public void DisableAllAndSet(NamedDataSet setAsActive)
        {
            ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>();

            IEnumerable <DataSet> activeDataSets            = objectTracker.GetActiveDataSets();
            List <DataSet>        activeDataSetsToBeRemoved = activeDataSets.ToList();

            //Loop through all the active datasets and deactivate them.
            foreach (DataSet ads in activeDataSetsToBeRemoved)
            {
                objectTracker.DeactivateDataSet(ads);
            }

            if (setAsActive == null)
            {
                return;
            }
            //Swapping of the datasets should not be done while the ObjectTracker is working at the same time.
            //So, Stop the tracker first.
            objectTracker.Stop();

            objectTracker.ActivateDataSet(setAsActive.set);

            //Finally, start the object tracker.
            objectTracker.Start();
        }