private async Task <IImageViewModel> FindAvailableImages() { IImageViewModel imageViewModel = (IImageViewModel)DataContext; await imageViewModel.LoadAvailableImages(); return(imageViewModel); }
public int Compare(IImageViewModel x, IImageViewModel y) { if (x == null || y == null) { return(0); } return(this.Compare(x.FileInfo, y.FileInfo)); }
public void Execute(object parameter) { IImageViewModel image = _viewModelFactory.GetImage(true); ActorViewModel newActor = new ActorViewModel(image); newActor.ThumbPath.Path = Path.GetTempFileName(); _actorManager.Actors.Add(newActor); }
private ActorViewModel CreateActorViewModel(int i) { IImageViewModel image = Substitute.For <IImageViewModel>(); ActorViewModel actor = new ActorViewModel(image); actor.Initialize("ActorName" + i, "ActorRole" + i); actor.ThumbUrl = "ActorThumb" + i; return(actor); }
private async void HyperlinkClick(object sender, RoutedEventArgs e) { await AsyncHelper.ExecuteEventHandlerTask(this, async() => { IImageViewModel images = await FindAvailableImages(); ContentControl control = FindParentMainContentControl(this); images.OriginalContent = BindingOperations.GetBinding(control, ContentProperty); control.Content = images; }); }
private async Task SetImagePathIfNeeded(IEnumerable <Image> images, IImageViewModel imageViewModel) { using (_busyProvider.DoWork()) { Image image = images.FirstOrDefault(); if (image != null && !await _fileSystemService.FileExists(imageViewModel.Path)) { await _fileSystemService.DownloadImage(imageViewModel.Path, image.Url); } } }
public SeasonViewModel(ITvShowViewModelFactory viewModelFactory, ITvShowFileService tvShowFileService, ITvShowViewModel tvShowMetadata, ITvShowMetadataService metadataService, IBusyProvider busyProvider, string path) : base(busyProvider, viewModelFactory.GetEpisode(tvShowMetadata, "dummy")) { _viewModelFactory = viewModelFactory; _tvShowFileService = tvShowFileService; _tvShowMetadata = tvShowMetadata; _busyProvider = busyProvider; _path = path; _posterUrl = viewModelFactory.GetImage(true, new SeasonPosterImageStrategy(metadataService, tvShowMetadata.Path, path)); _bannerUrl = viewModelFactory.GetImage(false, new SeasonBannerImageStrategy(metadataService, tvShowMetadata.Path, path)); }
public ImageView(IImageViewModel viewModel) { InitializeComponent(); DataContext = viewModel; }
private async Task<bool> removeImage(IImageViewModel image) { if (image == null) return false; string failureMessage = null; try { //If there is current set product and this image is coming from already //existing file, i.e. it has set ID, then we should remove it from product relation //and then only from Images collection if(this.CurrentProduct != null && !string.IsNullOrEmpty(image.ImageID)) { await this.CurrentProduct.RemoveImage(image.ImageID); } this.Images.Remove(image); } catch(Exception ex) { Tools.Logger.Log(ex, "Error occured while removing image.", LoggingLevel.Error, true); failureMessage = AppResources.MessageRemoveImageFailure; } if (failureMessage != null && this.ShowAlert != null) { this.ShowAlert(AppResources.TitleFailure, failureMessage, AppResources.ButtonOK); } return failureMessage == null; }
public ActorViewModel(IImageViewModel newImageViewModel) { ThumbPath = newImageViewModel; Name = new RequiredPropertyDecorator<string>(new PropertyViewModel<string>()); Role = new RequiredPropertyDecorator<string>(new PropertyViewModel<string>()); }
public ActorViewModel(IImageViewModel newImageViewModel) { ThumbPath = newImageViewModel; Name = new RequiredPropertyDecorator <string>(new PropertyViewModel <string>()); Role = new RequiredPropertyDecorator <string>(new PropertyViewModel <string>()); }
private ImageControl create(IImageViewModel image) { var imageControl = new ImageControl(); imageControl.HeightRequest = 95; imageControl.WidthRequest = 95; imageControl.ViewModel = image; return imageControl; }
private void itemReplaced(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel oldImage, IImageViewModel newImage) { var imageControl = this.ImageControls[index] as ImageControl; imageControl.ViewModel = newImage; }
private void itemRemoved(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel image) { this.ImageControls.RemoveAt(index); this.checkCount(); }
private void itemMoved(ObservableCollection<IImageViewModel> sender, int oldIndex, int newIndex, IImageViewModel image) { var oldItem = this.ImageControls[oldIndex]; this.ImageControls.Insert(newIndex, create(image)); this.ImageControls.Remove(oldItem); }
private void itemAdded(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel image) { this.ImageControls.Insert(index, create(image)); this.checkCount(); }