Пример #1
0
        public PublishedCamera(PublishedCameraProfile profile, PublishedDestination destination)
        {
            if (profile == null)
            throw new ArgumentNullException("profile");
              if (destination == null)
            throw new ArgumentNullException("destination");

              Profile = profile;
              Destination = destination;
        }
Пример #2
0
        public PublishedCamera(PublishedCameraProfile profile, PublishedDestination destination)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }

            Profile     = profile;
            Destination = destination;
        }
        public override bool Equals(object obj)
        {
            bool result = false;

            if (obj != null)
            {
                PublishedDestination other = obj as PublishedDestination;
                if (other != null && this.Id == other.Id)
                {
                    result = true;
                }
            }

            return(result);
        }
Пример #4
0
 public void PublishCamera(string hostUri, PublishedCameraProfile profile, PublishedDestination destination, EventHandler<AsyncWorkerCallbackEventArgs<bool>> callback)
 {
     try
       {
     AsyncWorkerHandle<bool> handle = AsyncWorkerHelper.DoWork<bool>(
       delegate(object sender, DoWorkEventArgs e)
       {
     e.Result = PublishCameraSync(hostUri, profile, destination);
       },
       null, callback);
       }
       catch (Exception ex)
       {
     ExceptionHandler.Handle(ex);
       }
 }
Пример #5
0
        private static bool PublishCameraSync(string hostUri, PublishedCameraProfile profile, PublishedDestination destination)
        {
            MediaService service = GetMediaPublisherServiceSync(hostUri);

              if (service != null)
              {
            PublishCameraRequest request = new PublishCameraRequest()
            {
              Profile = new PublishedCameraProfileData()
              {
            CameraId = profile.CameraId,
            CameraName = profile.CameraName,
            CameraThumbnail = profile.CameraThumbnail,
            DeviceServiceHostName = profile.DeviceServiceHostName,
            DeviceServiceUri = profile.DeviceServiceUri,
              },
              Destination = new PublishedDestinationData()
              {
            Port = destination.Port,
              },
            };
            PublishCameraResponse response =
              ServiceProvider
            .GetService<IMediaPublisherService>(service.HostName, service.Uri.ToString())
            .PublishCamera(request);
              }

              return true;
        }
        protected override void BindCommands()
        {
            OKCommand = new RelayCommand(() =>
              {
            PublishedCameraProfile profile = new PublishedCameraProfile(SelectedCamera.Id, SelectedCamera.Name)
            {
              CameraThumbnail = SelectedCamera.Thumbnail,
              DeviceServiceHostName = SelectedCamera.HostName,
              DeviceServiceUri = SelectedCamera.HostUri,
            };
            PublishedDestination destination = new PublishedDestination(DestinationPort);

            Status = ViewModelStatus.Saving;
            Model.PublishCamera(SelectedService.Uri.ToString(), profile, destination, PublishCameraCallback);
              });

              CancelCommand = new RelayCommand(() =>
              {
            Messenger.Default.Send(new NotificationMessage(UIMessageType.PublishMedia_CancelConfigCameraEvent));
              });

              CheckPortAvailableCommand = new RelayCommand(() =>
              {
            Status = ViewModelStatus.Loading;
            Model.CheckPortAvailable(SelectedService.Uri.ToString(), DestinationPort, CheckPortAvailableCallback);
              });
        }