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));
 }
示例#3
0
        public void Execute(object parameter)
        {
            IImageViewModel image    = _viewModelFactory.GetImage(true);
            ActorViewModel  newActor = new ActorViewModel(image);

            newActor.ThumbPath.Path = Path.GetTempFileName();
            _actorManager.Actors.Add(newActor);
        }
示例#4
0
        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);
         }
     }
 }
示例#7
0
        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;
        }
示例#9
0
		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;
		}
示例#10
0
 public ActorViewModel(IImageViewModel newImageViewModel)
 {
     ThumbPath = newImageViewModel;
     Name = new RequiredPropertyDecorator<string>(new PropertyViewModel<string>());
     Role = new RequiredPropertyDecorator<string>(new PropertyViewModel<string>());
 }
示例#11
0
 public ActorViewModel(IImageViewModel newImageViewModel)
 {
     ThumbPath = newImageViewModel;
     Name      = new RequiredPropertyDecorator <string>(new PropertyViewModel <string>());
     Role      = new RequiredPropertyDecorator <string>(new PropertyViewModel <string>());
 }
示例#12
0
		private ImageControl create(IImageViewModel image)
		{
			var imageControl = new ImageControl();
			imageControl.HeightRequest = 95;
			imageControl.WidthRequest = 95;
			imageControl.ViewModel = image;
			
			return imageControl;
		}
示例#13
0
		private void itemReplaced(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel oldImage, IImageViewModel newImage)
		{
			var imageControl = this.ImageControls[index] as ImageControl;
			imageControl.ViewModel = newImage;
		}
示例#14
0
		private void itemRemoved(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel image)
		{
			this.ImageControls.RemoveAt(index);
			this.checkCount();
		}
示例#15
0
		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);
		}
示例#16
0
		private void itemAdded(ObservableCollection<IImageViewModel> sender, int index, IImageViewModel image)
		{
			this.ImageControls.Insert(index, create(image));
			this.checkCount();
		}