public ParagraphsBoxViewModel(IReadingSession readingSession) { _readingSession = readingSession; ParagraphVisited = new ObservableCollection <string>(); _readingSession.CurrentParagraphChanged += (o, e) => Update(); Update(); }
protected override DanceMotion ReadTarget(BinaryReader reader, IReadingSession session) { string name = reader.ReadMoostaString(); int beatCount = reader.ReadInt32(); string[] array = new string[reader.ReadInt32()]; for (int i = 0; i < array.Length; i++) { array[i] = reader.ReadMoostaString(); } string[] array2 = new string[reader.ReadInt32()]; for (int j = 0; j < array2.Length; j++) { array2[j] = reader.ReadMoostaString(); } DancePose[] array3 = new DancePose[reader.ReadInt32()]; for (int k = 0; k < array3.Length; k++) { BoneState[] array4 = new BoneState[array2.Length]; for (int l = 0; l < array2.Length; l++) { array4[l] = new BoneState(new CtQuaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())); } array3[k] = new DancePose(array2, array4); } return(new DanceMotion(name, beatCount, array3, null) { Tags = array }); }
public ParagraphAnswersViewModel(IReadingSession readingSession) { _readingSession = readingSession; _readingSession.CurrentParagraphChanged += (o, e) => Update(); Answers = new ObservableCollection <IAnswerViewModel>(); Update(); }
public static object ReadMoostaObject(this BinaryReader reader, IReadingSession session) { object result; using (reader.BeginMoostaBlock()) { try { Guid key = new Guid(reader.ReadBytes(16)); byte version = reader.ReadByte(); int key2 = reader.ReadInt32(); ISerializer[] array; if (Serialization._guid2serializers.TryGetValue(key, out array)) { ISerializer serializer = array.FirstOrDefault((ISerializer s) => s.FormatVersion == version); if (serializer == null) { serializer = array[array.Length - 1]; } object obj = serializer.Read(reader, session); ((Serialization.ReadingSession)session).AddObject(key2, obj); result = obj; } else { result = null; } } catch (Exception) { result = null; } } return(result); }
public WindowViewModel(IReadingSession readingSession, IChooseResource chooseResource, IServices services) { _readingSession = readingSession; _chooseResource = chooseResource; _services = services; LoadFile = new BasicRelayCommand(() => Load()); Exit = new BasicRelayCommand(() => _services.Save()); //Si jamais on veut choisir un livre au premier demarrage. //if(_services.Book == null) ChooseFile(); }
public void NewBookTest() { IReadingSession rs = CreateReadingSession(); Assert.AreEqual("Title", rs.Title); rs.SetNewBook(new Book("Another"), new History()); Assert.AreEqual("Another", rs.Title); }
public void TestUS6_1() { IReadingSession rs = CreateReadingSession(); IMessageViewModel mvm = new MessageViewModel(rs); rs.Next("A1"); rs.Next("A2"); Assert.AreEqual("Vous quittez le paragraphe 2 pour aller au paragraphe 3.", mvm.Message); }
public void TestUS6_3() { IReadingSession rs = CreateReadingSession(); IMessageViewModel mvm = new MessageViewModel(rs); rs.Next("A1"); rs.Next("A3"); Assert.AreEqual("Vous quittez le paragraphe 2 pour aller au paragraphe 4. Vous avez atteint la fin du livre.", mvm.Message); }
public void ResetTest() { IReadingSession rs = CreateReadingSession(); rs.Next("A1"); rs.Next("A2"); rs.Reset(); Assert.AreEqual("P1", rs.Paragraph); }
public void BackTest() { IReadingSession rs = CreateReadingSession(); rs.Next("A1"); rs.Next("A2"); rs.Back(); Assert.AreEqual("P2", rs.Paragraph); }
public void TestUS6_2() { IReadingSession rs = CreateReadingSession(); IMessageViewModel mvm = new MessageViewModel(rs); rs.Next("A1"); rs.Next("A2"); rs.Back(); Assert.AreEqual("Vous avez déjà lu le paragraphe 2. Vous êtes ensuite aller au paragraphe 3.", mvm.Message); }
public void PropertiesTest() { IReadingSession rs = CreateReadingSession(); Assert.AreEqual(0, rs.Id); Assert.IsFalse(rs.AlreadyRead); Assert.AreEqual(1, rs.Answers.Count); Assert.AreEqual("P1", rs.Paragraph); Assert.IsFalse(rs.IsFinish); Assert.AreEqual("Title", rs.Title); Assert.AreEqual("#fff", rs.ColorStart); Assert.AreEqual("#fff", rs.ColorEnd); }
public void NextTest() { IReadingSession rs = CreateReadingSession(); Assert.AreEqual("P1", rs.Paragraph); rs.Next("A1"); Assert.AreEqual("P2", rs.Paragraph); rs.Next("Not in answers"); Assert.AreEqual("P2", rs.Paragraph); }
public void TestUS7_1() { IReadingSession rs = CreateReadingSession(); IParagraphsBoxViewModel pbvm = new ParagraphsBoxViewModel(rs); IList<string> listpara = new List<string>() { pbvm.ParagraphSelected, "Paragraphe 1 : Lorem ipsum dolor sit amet, consect...", "Paragraphe 2 : Lorem ipsum dolor sit amet, consect..." }; rs.Next("A1"); SameContent(listpara, pbvm.ParagraphVisited); }
protected override DanceModelInfo ReadTarget(BinaryReader reader, IReadingSession session) { DanceModelInfo danceModelInfo = new DanceModelInfo(reader.ReadString()); int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { string key = reader.ReadString(); float x = reader.ReadSingle(); float y = reader.ReadSingle(); float z = reader.ReadSingle(); danceModelInfo.BonePositions.Add(key, new CtVector3D(x, y, z)); } return(danceModelInfo); }
protected override DanceMotion ReadTarget(BinaryReader reader, IReadingSession session) { string name = reader.ReadMoostaString(); int beatCount = reader.ReadInt32(); int num = reader.ReadInt32(); DanceModelInfo sourceModel = (num == 0) ? null : (session.GetObject(num) as DanceModelInfo); string[] array = new string[reader.ReadInt32()]; for (int i = 0; i < array.Length; i++) { array[i] = reader.ReadMoostaString(); } string[] array2 = new string[reader.ReadInt32()]; for (int j = 0; j < array2.Length; j++) { array2[j] = reader.ReadMoostaString(); } string[] array3 = new string[reader.ReadInt32()]; for (int k = 0; k < array3.Length; k++) { array3[k] = reader.ReadMoostaString(); } DancePose[] array4 = new DancePose[reader.ReadInt32()]; for (int l = 0; l < array4.Length; l++) { CtVector3D bodyPos = new CtVector3D(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); DancePoseFootState footState = (DancePoseFootState)reader.ReadInt32(); BoneState[] array5 = new BoneState[array2.Length]; for (int m = 0; m < array2.Length; m++) { array5[m] = new BoneState(new CtQuaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())); } SkinState[] array6 = new SkinState[array3.Length]; for (int n = 0; n < array3.Length; n++) { array6[n] = new SkinState(reader.ReadSingle()); } array4[l] = new DancePose(array2, array5, array3, array6, bodyPos) { FootState = footState }; } return(new DanceMotion(name, beatCount, array4, sourceModel) { Tags = array }); }
public ParagraphInfosViewModel(IReadingSession readingSession, DynamicText dynamicText) { _readingSession = readingSession; _dynamicText = dynamicText; if (_dynamicText != null) { _dynamicText.EventText += Dynamic; _dynamicText.Start(_readingSession.Paragraph); } else { Label = _readingSession.Paragraph; } _readingSession.CurrentParagraphChanged += (o, e) => Update(); PrecedingColorStart = "#fff"; PrecedingColorEnd = "#fff"; ColorStart = _readingSession.ColorStart; ColorEnd = _readingSession.ColorEnd; }
public ViewModelLocator(DependencyObject dep = null) { _dependenciesProp = dep ?? new DependencyObject(); if (DesignerProperties.GetIsInDesignMode(_dependenciesProp)) { WindowVM = new Stubs.WindowViewModel(); BackVM = new Stubs.BackViewModel(); ParagraphsBoxVM = new Stubs.ParagraphsBoxViewModel(); MessageVM = new Stubs.MessageViewModel(); ParagraphAnswersVM = new Stubs.ParagraphAnswersViewModel(); ParagraphInfosVM = new Stubs.ParagraphInfosViewModel(); } else { string resource = @"..\..\..\Saves\"; string historiesSaves = Path.Combine(resource, @"Histories\"); string applicationSave = Path.Combine(resource, @"save.txt"); _services = new Services(applicationSave, new ReadBook(), new ReadHistory(historiesSaves), new WriteHistory(historiesSaves)); _services.Start(); if (_services.Book == null) { _readingSession = CreateReadingSession(); } else { _readingSession = new ReadingSession(_services.Book, _services.History); } WindowVM = new Impl.WindowViewModel(_readingSession, new FileResourceChooser(), _services); BackVM = new Impl.BackViewModel(_readingSession); ParagraphsBoxVM = new Impl.ParagraphsBoxViewModel(_readingSession); MessageVM = new Impl.MessageViewModel(_readingSession); ParagraphAnswersVM = new Impl.ParagraphAnswersViewModel(_readingSession); ParagraphInfosVM = new Impl.ParagraphInfosViewModel(_readingSession, new DynamicText()); } }
public ResetViewModel(IReadingSession readingSession, string answer) { Label = answer; Select = new BasicRelayCommand(() => readingSession.Reset()); }
protected abstract T ReadTarget(BinaryReader reader, IReadingSession session);
public ParagraphInfosViewModel(IReadingSession readingSession) : this(readingSession, null) { }
public object Read(BinaryReader reader, IReadingSession session) { return(this.ReadTarget(reader, session)); }
internal static ResetViewModel Create(IReadingSession readingSession, string answer) => new ResetViewModel(readingSession, answer);
public ArticleDataReader(ILogger <ArticleDataReader> logger, IReadingSession session) { this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.session = session ?? throw new ArgumentNullException(nameof(session)); }
public MessageViewModel(IReadingSession readingSession) { _readingSession = readingSession; _readingSession.CurrentParagraphChanged += (o, e) => Update(); Color = "Transparente"; }
public AnswerViewModel(IReadingSession readingSession, string answer) { Label = answer; Select = new BasicRelayCommand(() => readingSession.Next(answer)); }
public BackViewModel(IReadingSession readingSession) { BackCommand = new BasicRelayCommand(() => readingSession.Back()); }