Ejemplo n.º 1
0
        public static bool SaveImage(string filename, byte[] bytes)
        {
            //
            bool          res = false, resSpecified = false;
            CameraService client = new CameraService();

            //client.Credentials = System.Net.CredentialCache.DefaultCredentials;
            try {
                //Create DTO and call service
                CameraImage image = new CameraImage();
                image.Date     = DateTime.Now;
                image.Filename = filename;
                image.File     = bytes;

                client.SaveImage(image, out res, out resSpecified);
                client.Dispose();   //Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            //catch(FaultException<CameraFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            //catch(FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            //catch(CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(res);
        }