Пример #1
0
 /// <summary>
 /// Initialize the ObjectTracker skill
 /// </summary>
 /// <param name="device"></param>
 /// <returns></returns>
 private async Task InitializeObjectTrackerAsync(ISkillExecutionDevice device = null)
 {
     if (device != null)
     {
         m_trackerSkill = await m_trackerDescriptor.CreateSkillAsync(device) as ObjectTrackerSkill;
     }
     else
     {
         m_trackerSkill = await m_trackerDescriptor.CreateSkillAsync() as ObjectTrackerSkill;
     }
     m_trackerBindings  = new List <ObjectTrackerBinding>();
     m_trackerHistories = new List <Queue <TrackerResult> >();
 }
Пример #2
0
        /// <summary>
        /// Initialize the skill related members
        /// </summary>
        /// <param name="executionDevice"></param>
        /// <returns></returns>
        private async Task InitializeSkillAsync(ISkillExecutionDevice executionDevice = null)
        {
            m_descriptor = new ObjectTrackerDescriptor();
            m_availableExecutionDevices = await m_descriptor.GetSupportedExecutionDevicesAsync();

            if (m_availableExecutionDevices.Count == 0)
            {
                NotifyUser("No execution devices available, this skill cannot run on this device", NotifyType.ErrorMessage);
                return; // Abort
            }

            // Either create skill using provided execution device or let skill create with default device if none provided
            if (executionDevice != null)
            {
                m_skill = await m_descriptor.CreateSkillAsync(executionDevice) as ObjectTrackerSkill;
            }
            else
            {
                m_skill = await m_descriptor.CreateSkillAsync() as ObjectTrackerSkill;
            }

            m_bindings       = new List <ObjectTrackerBinding>();
            m_trackerHistory = new List <Queue <TrackerResult> >();
        }
Пример #3
0
        /// <summary>
        /// Reset skill to newly selected execution device
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void UISkillExecutionDevices_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            await m_lock.WaitAsync();

            {
                // Clear UI elements from previous tracker instance
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => m_objectTrackRenderer.ClearCanvas());

                // Load skill(s) with new config
                var selectedDevice = m_availableExecutionDevices[UISkillExecutionDevices.SelectedIndex];
                m_skill = await m_descriptor.CreateSkillAsync(selectedDevice) as ObjectTrackerSkill;

                m_bindings.Clear();
                m_trackerHistory.Clear();
            }
            m_lock.Release();
        }