Exemplo n.º 1
0
        public void DeleteCamera(Camera camera, EventHandler <AsyncWorkerCallbackEventArgs <bool> > callback)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }

            try
            {
                AsyncWorkerHandle <bool> handle = AsyncWorkerHelper.DoWork <bool>(
                    delegate(object sender, DoWorkEventArgs e)
                {
                    DeleteCameraRequest request = new DeleteCameraRequest();
                    request.CameraId            = camera.Id;

                    DeleteCameraResponse response =
                        ServiceProvider.GetService <IDeviceConnectorService, IDeviceConnectorCallbackService>(
                            ViewModelLocator.ServiceClient,
                            ViewModelLocator.SelectedService.HostName,
                            ViewModelLocator.SelectedService.Uri.ToString()
                            ).DeleteCamera(request);

                    e.Result = true;
                },
                    null, callback);
            }
            catch (Exception ex)
            {
                ExceptionHandler.Handle(ex);
            }
        }
Exemplo n.º 2
0
        public DeleteCameraResponse DeleteCamera(DeleteCameraRequest request)
        {
            try
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }

                DeleteCameraResponse response = new DeleteCameraResponse();

                Locator.Get <ICameraManager>().DeleteCamera(request.CameraId);

                return(response);
            }
            catch (Exception ex)
            {
                throw new FaultException <DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message);
            }
        }