Fixed| bug si on ferme un livre en le lisant
ReFixed|faire fonctionner le seek, même quand play n'est pas activer
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SLExtensions.Input;
using Iri.Modernisation.BaseMVVM.Commands;
using Iri.Modernisation.BaseMVVM.ViewModel;
using Iri.Modernisation.Data.Models;
using System.Collections.Generic;
using System.Linq;
namespace Iri.Modernisation.Controls.ViewModel
{
public class ConsultMenuVM : BaseMVVM.ViewModel.ViewModel
{
private List<ConsultVideoBookVM> _videoBooks = new List<ConsultVideoBookVM>();
private List<ConsultVideoBookVM> list = new List<ConsultVideoBookVM>();
/// <summary>
/// VideoBooks Disponible
/// </summary>
public List<ConsultVideoBookVM> VideoBooks
{
get
{
//_videoBooks.Sort(new VideoBookComparer());
if (SearchWord != String.Empty)
{
return list;
}
else
{
return _videoBooks;
}
}
set
{
list = value;
OnPropertyChanged("VideoBooks");
}
}
private bool _searchAuthor;
/// <summary>
/// Recherche par Auteur activée
/// </summary>
public bool SearchAuthor
{
get
{
return _searchAuthor;
}
set
{
_searchAuthor = value;
OnPropertyChanged("SearchAuthor");
}
}
private bool _searchContributer;
/// <summary>
/// Recherche par Contributeur activée
/// </summary>
public bool SearchContributer
{
get
{
return _searchContributer;
}
set
{
_searchContributer = value;
OnPropertyChanged("SearchContributer");
}
}
private bool _searchTag;
/// <summary>
/// Recherche par Tag
/// </summary>
public bool SearchTag
{
get
{
return _searchTag;
}
set
{
_searchTag = value;
OnPropertyChanged("SearchTag");
}
}
private String _searchWord= "";
public String SearchWord
{
get
{
return _searchWord;
}
set
{
_searchWord = value;
OnPropertyChanged("SearchWord");
}
}
public ConsultMenuVM()
{
SearchAuthor = true;
InitializeCommands();
}
private void InitializeCommands()
{
Commands.ConsultMenu.GetBook.Executed += new EventHandler<ExecutedEventArgs>(GetBook_Executed);
}
public ConsultMenuVM(List<VideoBook> argList)
{
//_videoBooks = argList;
foreach(VideoBook vb in argList)
{
_videoBooks.Add(new ConsultVideoBookVM(vb));
}
SearchAuthor = true;
InitializeCommands();
}
void GetBook_Executed(object sender, ExecutedEventArgs e)
{
/* if (SearchAuthor)
{
var query = from c in _videoBooks
where c.Author.UserName.Contains(_searchWord)
select c;
VideoBooks = query.ToList();
}
if (SearchContributer)
{
List<VideoBook> temp = new List<VideoBook>();
foreach (VideoBook Book in _videoBooks)
{
foreach (VideoChapter Chapter in Book.Chapters)
{
foreach (Annotation Annotation in Chapter.Annotations)
{
if ( Annotation.Contributer.UserName.Contains(_searchWord))
{
temp.Add(Book);
}
}
}
}
VideoBooks = temp;
}
if(SearchTag)
{
List<VideoBook> temp = new List<VideoBook>();
foreach (VideoBook Book in _videoBooks)
{
foreach (VideoChapter Chapter in Book.Chapters)
{
foreach (Annotation Annotation in Chapter.Annotations)
{
if (Annotation.Tags.Contains(_searchWord))
{
temp.Add(Book);
}
}
foreach (SegmentIndex Segment in Chapter.Index)
{
if (Segment.Tags.Contains(_searchWord))
{
temp.Add(Book);
}
}
}
}
VideoBooks = temp;
}*/
}
}
}