コード例 #1
0
        internal void DiscoverDevices()
        {
            DeviceList.Clear();
            CameraList.Clear();

            foreach (var userCamera in SavedCameras)
            {
                if (userCamera.DeviceInfo != null)
                {
                    try
                    {
                        DeviceList.Add(userCamera.DeviceInfo);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (userCamera.Camera != null)
                {
                    try
                    {
                        CameraList.Add(userCamera.Camera);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            DiscoverUsbDevices();
            IPCameraFactory.DiscoverDevices();
        }
コード例 #2
0
        public override void Initialize()
        {
            base.Initialize();
            if (App.CurrentAccount == null)
            {
                return;
            }

/*            List<VATRPDevice> cameraList = ServiceManager.Instance.GetAvailableCameras();
 *          string storedCameraId = App.CurrentAccount.SelectedCameraId;
 *          if (cameraList != null)
 *          {
 *              List<string> cameraNames = new List<string>();
 *              foreach (VATRPDevice device in cameraList)
 *              {
 *                  cameraNames.Add(device.displayName);
 *                  if (!string.IsNullOrEmpty(storedCameraId) && storedCameraId.Equals(device.deviceId))
 *                  {
 *                      _selectedCamera = device.displayName;
 *                  }
 *              }
 *              Cameras = cameraNames.ToArray();
 *          }
 */
            foreach (var item in PreferredVideoSizeComboBox.Items)
            {
                var tb = item as TextBlock;
                if (GetPreferredVideoSizeId(tb).Equals(App.CurrentAccount.PreferredVideoId))
                {
                    PreferredVideoSizeComboBox.SelectedItem = item;
                    break;
                }
            }

            List <VATRPDevice> availableCameras = ServiceManager.Instance.GetAvailableCameras();
            VATRPDevice        selectedCamera   = ServiceManager.Instance.GetSelectedCamera();

            CameraList.Clear();
            if (availableCameras == null)
            {
                return;
            }
            foreach (VATRPDevice camera in availableCameras)
            {
                CameraList.Add(camera);
                if ((selectedCamera != null) && selectedCamera.deviceId.Trim().Equals(camera.deviceId.Trim()))
                {
                    SelectCameraComboBox.SelectedItem = camera;
                }
            }

            List <VATRPDevice> availableMicrophones = ServiceManager.Instance.GetAvailableMicrophones();
            VATRPDevice        selectedMicrophone   = ServiceManager.Instance.GetSelectedMicrophone();

            MicrophoneList.Clear();
            foreach (VATRPDevice microphone in availableMicrophones)
            {
                MicrophoneList.Add(microphone);
                if ((selectedMicrophone != null) && selectedMicrophone.deviceId.Trim().Equals(microphone.deviceId.Trim()))
                {
                    SelectMicrophoneComboBox.SelectedItem = microphone;
                }
            }
            List <VATRPDevice> availableSpeakers = ServiceManager.Instance.GetAvailableSpeakers();
            VATRPDevice        selectedSpeaker   = ServiceManager.Instance.GetSelectedSpeakers();

            SpeakerList.Clear();
            foreach (VATRPDevice speaker in availableSpeakers)
            {
                SpeakerList.Add(speaker);
                if ((selectedSpeaker != null) && selectedSpeaker.deviceId.Trim().Equals(speaker.deviceId.Trim()))
                {
                    SelectSpeakerComboBox.SelectedItem = speaker;
                }
            }

            /*            string selectedCameraId = App.CurrentAccount.SelectedCameraId;
             * if (string.IsNullOrEmpty(selectedCameraId))
             * {
             *  VATRPDevice selectedCamera = ServiceManager.Instance.GetSelectedCamera();
             * //                SelectedCameraLabel.Content = selectedCamera.displayName;
             * //                SelectedCameraLabel.ToolTip = selectedCamera.displayName;
             * }
             * else
             * {
             *  foreach (VATRPDevice camera in availableCameras)
             *  {
             *      if (!string.IsNullOrEmpty(selectedCameraId) && selectedCameraId.Equals(camera.deviceId))
             *      {
             *          SelectCameraComboBox.SelectedItem = camera;
             * //                        SelectedCameraLabel.Content = camera.displayName;
             * //                        SelectedCameraLabel.ToolTip = camera.displayName;
             *      }
             *  }
             * }
             *
             * List<VATRPDevice> availableMicrophones = ServiceManager.Instance.GetAvailableMicrophones();
             * string selectedMicrophoneId = App.CurrentAccount.SelectedMicrophoneId;
             * if (string.IsNullOrEmpty(selectedMicrophoneId))
             * {
             *  VATRPDevice selectedMicrophone = ServiceManager.Instance.GetSelectedMicrophone();
             *  SelectedMicrophoneLabel.Content = selectedMicrophone.displayName;
             *  SelectedMicrophoneLabel.ToolTip = selectedMicrophone.displayName;
             * }
             * else
             * {
             *  foreach (VATRPDevice microphone in availableMicrophones)
             *  {
             *      if (!string.IsNullOrEmpty(selectedMicrophoneId) && selectedMicrophoneId.Equals(microphone.deviceId))
             *      {
             *          SelectedMicrophoneLabel.Content = microphone.displayName;
             *          SelectedMicrophoneLabel.ToolTip = microphone.displayName;
             *      }
             *  }
             * }
             *
             * List<VATRPDevice> availableSpeakers = ServiceManager.Instance.GetAvailableSpeakers();
             * string selectedSpeakerId = App.CurrentAccount.SelectedSpeakerId;
             * if (string.IsNullOrEmpty(selectedSpeakerId))
             * {
             *  VATRPDevice selectedSpeaker = ServiceManager.Instance.GetSelectedSpeakers();
             *  SelectedSpeakerLabel.Content = selectedSpeaker.displayName;
             *  SelectedSpeakerLabel.ToolTip = selectedSpeaker.displayName;
             * }
             * else
             * {
             *  foreach (VATRPDevice speaker in availableSpeakers)
             *  {
             *      if (!string.IsNullOrEmpty(selectedSpeakerId) && selectedSpeakerId.Equals(speaker.deviceId))
             *      {
             *          SelectedSpeakerLabel.Content = speaker.displayName;
             *          SelectedSpeakerLabel.ToolTip = speaker.displayName;
             *      }
             *  }
             * }
             * */
        }