public EntryPage() { InitializeComponent(); StandardTileData sd = new StandardTileData { Title = "Property Viewer", BackgroundImage = new Uri("Background.png", UriKind.Relative), Count = 0 }; ShellTile st = ShellTile.ActiveTiles.ElementAt(0); st.Update(sd); client = new ImageServiceClient(); string channelName = "ChannelName"; httpChannel = HttpNotificationChannel.Find(channelName); if (httpChannel != null) { channelUri = httpChannel.ChannelUri; client.SetUrlAsync(channelUri); } else { httpChannel = new HttpNotificationChannel(channelName); httpChannel.ErrorOccurred += OnErrorOccurred; httpChannel.Open(); channelUri = httpChannel.ChannelUri; } httpChannel.ChannelUriUpdated += OnChannelUriUpdated; client.resetCompleted += OnResetCompleted; }
public MainPage() { InitializeComponent(); client = new ImageServiceClient(); client.GetHouseCompleted += OnGetHouseCompleted; client.discardCompleted += OnDiscardCompleted; }
public async Task<SearchResponse> SearchAsync() { Images.Clear(); var client = new ImageServiceClient(); var response = await client.SearchAsync(new SearchRequest(Criteria)); response.SearchResult.ForEach(o => Images.Add(o)); return response; }
public ActionResult GetMyImages() { Mapper.CreateMap <Services.DataContracts.ImageContract, UserImageViewModel>(); using (ImageServiceClient client = new ImageServiceClient()) { var images = client.GetMyImages(User.Identity.Name); var model = Mapper.Map <UserImageViewModel>(images); return(View(model)); } }
private async void SettingsPage_Loaded(object sender, RoutedEventArgs e) { PhotoModeServiceClient client = new PhotoModeServiceClient(); var imageModes = await client.GetAllAsync(); await client.CloseAsync(); PhotoModeItems = Mapper.Map <ObservableCollection <PhotoModeItem> >(imageModes); ImageServiceClient imageClient = new ImageServiceClient(); var images = await imageClient.GetMyImagesAsync(loginSetting); ShowImages(images); await client.CloseAsync(); }
public bool UpdateImage(FullImage image) { try { using (ImageServiceClient client = new ImageServiceClient()) { var item = client.PutImage(image); client.Close(); } return true; } catch (Exception ex) { return false; } }
public void GetImage(Guid imageId, Action<FullImage, Exception> callback) { try { using (ImageServiceClient client = new ImageServiceClient()) { var item = client.GetImageById(imageId); callback(item, null); client.Close(); } } catch (Exception ex) { callback(null, ex); } }
public async Task<CreateResponse> CreateAsync(string path) { var request = new ImageRequest { Content = File.ReadAllBytes(path), ContentType = "image/jpg", FileName = Path.GetFileName(path), ThumbnailOption = new ThumbnailOption { Width = 300 } }; var client = new ImageServiceClient(); var response = await client.CreateAsync(new CreateRequest(request)); return response; }
public bool CreateImage(FullImage image) { try { using (ImageServiceClient client = new ImageServiceClient()) { var item = client.PostImage(image); client.Close(); } return(true); } catch (Exception ex) { return(false); } }
public void GetImage(Guid imageId, Action <FullImage, Exception> callback) { try { using (ImageServiceClient client = new ImageServiceClient()) { var item = client.GetImageById(imageId); callback(item, null); client.Close(); } } catch (Exception ex) { callback(null, ex); } }
public void GetImageList(Action <ImageItem[], Exception> callback) { try { using (ImageServiceClient client = new ImageServiceClient()) { var items = client.GetImageList(); //var items = new ImageItem[1] { new ImageItem { _id = Guid.NewGuid(), _imageName = "test image" } }; callback(items, null); client.Close(); } } catch (Exception ex) { callback(null, ex); } }
public void GetImageList(Action<ImageItem[], Exception> callback) { try { using (ImageServiceClient client = new ImageServiceClient()) { var items = client.GetImageList(); //var items = new ImageItem[1] { new ImageItem { _id = Guid.NewGuid(), _imageName = "test image" } }; callback(items, null); client.Close(); } } catch (Exception ex) { callback(null, ex); } }
private async void UploadImagesTb_Click(object sender, RoutedEventArgs e) { var picker = new FileOpenPicker(); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); picker.FileTypeFilter.Add(".bmp"); picker.FileTypeFilter.Add(".jpg"); var selectedImage = await picker.PickSingleFileAsync(); var imageBytes = await GetBytesAsync(selectedImage); ImageServiceClient client = new ImageServiceClient(); await client.UploadImageAsync(imageBytes, moodId, loginSetting); await client.CloseAsync(); this.Frame.Navigate(typeof(SettingsPage)); }
public ActionResult UploadImage(HttpPostedFileBase file) { if (file != null) { byte[] imageBuffer; using (var ms = new MemoryStream()) { file.InputStream.CopyTo(ms); imageBuffer = ms.GetBuffer(); } using (var client = new ImageServiceClient()) { client.UploadImage(imageBuffer, 0, User.Identity.Name); } } return(RedirectToAction("Index")); }
public ImageServiceClient() : base(ImageServiceClient.GetDefaultBinding(), ImageServiceClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.WSHttpBinding_ImageService.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public ImageServiceClient(EndpointConfiguration endpointConfiguration) : base(ImageServiceClient.GetBindingForEndpoint(endpointConfiguration), ImageServiceClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() { return(ImageServiceClient.GetEndpointAddress(EndpointConfiguration.WSHttpBinding_ImageService)); }
public ImageServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(ImageServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
private static long[] GetImageIds() { long[] imageIds; using (var imageService = new ImageServiceClient()) { Console.WriteLine("Getting image IDs"); imageIds = imageService.GetAllUserImageIds("neils"); } return imageIds; }
private static System.ServiceModel.Channels.Binding GetDefaultBinding() { return(ImageServiceClient.GetBindingForEndpoint(EndpointConfiguration.WSHttpBinding_ImageService)); }