コード例 #1
0
        internal async Task <bool> InitializeInternalAsync()
        {
            this.IsInitialized = false;
            bool ret = false;

            try
            {
                if (!this.m_OnVifMedia.Isinitalized)
                {
                    await this.m_OnVifMedia.InitalizeAsync();
                }

                ret = await m_PTZController.InitalizeAsync();

                m_PTZController.ProfileRefToken = m_OnVifMedia.ProfileRefToken;
                var presets = await readPTZPresetsInternalAsync();

                this.IsInitialized = ret;
            }
            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }
            return(ret);
        }
コード例 #2
0
        internal async Task <IList <PTZPresetItem> > readPTZPresetsInternalAsync()
        {
            try
            {
                m_Presets.Items.Clear();
                var presets = await this.m_PTZController.readPTZPresetsAsync();

                if (presets == null)
                {
                    return(null);
                }
                int j = 0;
                foreach (var preset in presets.Preset)
                {
                    m_Presets.Items.Add(new PTZPresetItem(preset.Name, preset.token, preset.PTZPosition, j++));
                }
                m_Presets.SelectedIndex = 0;
            }
            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }
            return(m_Presets.Items);
        }
コード例 #3
0
        internal async Task StopInternalAsync()
        {
            try
            {
                await m_PTZController.StopAsync();
            }

            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }
        }
コード例 #4
0
        internal async Task <Boolean> GotoPresetInternalAsync(string presettoken)
        {
            Boolean ret = false;

            try
            {
                ret = await m_PTZController.GotoPresetAsync(presettoken);
            }
            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }
            return(ret);
        }
コード例 #5
0
        internal async Task <Boolean> GotoHomePositionInternalAsync()
        {
            Boolean ret = false;

            try
            {
                ret = await this.m_PTZController.GotoHomePositionAsync();
            }

            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }
            return(ret);
        }
コード例 #6
0
        internal async Task <Boolean> RemovePresetInternalAsync(string presettoken)
        {
            Boolean ret = false;

            try
            {
                ret = await this.m_PTZController.RemovePresetAsync(presettoken);
                await readPTZPresetsInternalAsync();
            }

            catch (OnVifException ex)
            {
                OnVifMsgbox msg = new OnVifMsgbox(ex);
                msg.Show();
            }

            return(ret);
        }
コード例 #7
0
        internal async Task PanTiltClickInternalAsync(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if ((m_PTZController != null) && m_PTZController.IsInitialized)
            {
                Windows.UI.Xaml.Controls.Button send = sender as Windows.UI.Xaml.Controls.Button;
                try
                {
                    switch (send.Name)
                    {
                    case "Stop":
                        await StopInternalAsync();

                        break;

                    case "PanLeft":
                        m_PTZController.PanLeft();
                        break;

                    case "PanRight":
                        m_PTZController.PanRight();
                        break;

                    case "TiltUp":
                        m_PTZController.TiltUp();
                        break;

                    case "TiltDown":
                        m_PTZController.TiltDown();
                        break;

                    case "PanLeftTiltDown":
                        m_PTZController.PanLeftTiltDown();
                        break;

                    case "PanLeftTiltUp":
                        m_PTZController.PanLeftTiltUp();
                        break;

                    case "PanRightTiltUp":
                        m_PTZController.PanRightTiltUp();
                        break;

                    case "PanRightTiltDown":
                        m_PTZController.PanRightTiltDown();
                        break;

                    case "ZoomIn":
                        m_PTZController.ZoomIn();
                        break;

                    case "ZoomOut":
                        m_PTZController.ZoomOut();
                        break;
                    }
                    this.IsStopped = false;
                }

                catch (OnVifException ex)
                {
                    this.IsStopped = false;
                    OnVifMsgbox msg = new OnVifMsgbox(ex);
                    msg.Show();
                }
            }
        }