public override Wisdom EnlightMe(Question question) { DateTime startOfEnlightning = DateTime.Now; Think(); var result = new Wisdom { By = PresentYourSelf(), Question = question, Answer = new Answer { Content = getAnswerContent() } }; DateTime endOfEnlightning = DateTime.Now; result.ThinkTime = endOfEnlightning - startOfEnlightning; return result; }
public virtual void AddWisdom(Wisdom wisdom) { Locked.DoLocked(() => { if (MinAddLockMillis > 0) { int sleepMillis = Random.Next(MinAddLockMillis, MaxAddLockMillis); m_log.Debug(string.Format("AddWisdom --> sleeping for {0} millis", sleepMillis)); Thread.Sleep(sleepMillis); } m_store[new Question { Content = wisdom.Question.Content.ToLower() }] = wisdom; }); }
public WisdomViewModel(GuruViewModel guru, Wisdom wisdom, DateTime startedAt) { if (guru == null) { throw new ArgumentNullException("guru"); } if (wisdom == null) { throw new ArgumentNullException("wisdom"); } m_sharedAt = DateTime.Now; m_sharedElapsed = m_sharedAt - startedAt; lock (s_lastNrLock) { Nr = ++s_lastNr; } GuruViewModel = guru; Wisdom = wisdom; }
public void Save(Wisdom wisdom) { Store.AddWisdom(wisdom); }