diff -r 000000000000 -r 249d70e7b32d client/src/Iri.Modernisation.Controls/ViewModel/NavigationBar/ChutierVM.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/NavigationBar/ChutierVM.cs Wed Nov 18 15:30:31 2009 +0100 @@ -0,0 +1,127 @@ +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 ChutierVM : BaseMVVM.ViewModel.ViewModel + { + protected List _annotations = new List(); + protected List list = new List(); + public List Annotations + { + get + { + if (SearchWord != String.Empty) + { + return list; + } + else + { + return _annotations; + } + + } + set + { + list = value; + OnPropertyChanged("Annotations"); + } + } + protected String _searchWord = ""; + public String SearchWord + { + get + { + return _searchWord; + } + + set + { + _searchWord = value; + OnPropertyChanged("SearchWord"); + + } + } + public ChutierVM() + { + InitializeCommands(); + } + + private void InitializeCommands() + { + } + + public ChutierVM(List argList) + { + _annotations = argList; + InitializeCommands(); + } + + protected void Search() + { + var query = from c in _annotations + where c.Title.Contains(_searchWord) + select c; + Annotations = query.ToList(); + } + public void ClickAnnotation_Executed(object sender, ExecutedEventArgs e) + { + Annotation VB = (Annotation)e.Parameter; + MessageBox.Show(VB.Contributer.UserName + " - " + VB.Title); + } + + public void ChutierSearch_Executed(object sender, ExecutedEventArgs e) + { + Search(); + + } + + } + public class PersonnalChutierVM : ChutierVM + { + public PersonnalChutierVM(List argList) + : base( argList) + { + InitializeCommands(); + } + + private void InitializeCommands() + { + Commands.PersonnalChutier.Search.Executed += new EventHandler(ChutierSearch_Executed); + Commands.PersonnalChutier.ClickAnnotation.Executed += new EventHandler(ClickAnnotation_Executed); + } + + + } + + public class ReferencesChutierVM : ChutierVM + { + public ReferencesChutierVM(List argList) + : base(argList) + { + InitializeCommands(); + } + + private void InitializeCommands() + { + Commands.ReferencesChutier.Search.Executed += new EventHandler(ChutierSearch_Executed); + Commands.ReferencesChutier.ClickAnnotation.Executed += new EventHandler(ClickAnnotation_Executed); + } + + + } + +}