private void Application_Startup(object sender, StartupEventArgs e) { var store = new TransientWisdomStore { MinAddLockMillis = 100, MaxAddLockMillis = 100, MinGetLockMillis = 400, MaxGetLockMillis = 400, Locked = new ThickLocked() }; var viewModel = new KnowledgeViewModel { Gurus = new ReadOnlyCollection<IGuru>( new List<IGuru> { new RandomYesNoGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000, Locked = new SpinLocked() }, new RandomQuestioningGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000, Locked = new SpinLocked() }, new GuruService { RealGuru = new RandomQuestioningGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000, Locked = new SpinLocked() }, WisdomDataAccessFind = new TransientWisdomDataAccessFind { Store = store }, WisdomDataAccessSave = new TransientWisdomDataAccessSave { Store = store } } }) }; MainWindow = new MainWindow { Content = viewModel }; MainWindow.Show(); }
public static void Main(string[] args) { bool useInprocessService = args.Length == 0; bool useYesNoGuru = !useInprocessService && args.Length == 1; IGuru guru; IGuru realGuru = useYesNoGuru ? new RandomYesNoGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000 } as IGuru : new RandomQuestioningGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000, Locked = new SpinLocked()}; if (useInprocessService) { var store = new TransientWisdomStore { MinAddLockMillis = 100, MaxAddLockMillis = 100, MinGetLockMillis = 400, MaxGetLockMillis = 400, Locked = new ThickLocked()}; guru = new GuruService { RealGuru = realGuru, WisdomDataAccessFind = new TransientWisdomDataAccessFind { Store = store }, WisdomDataAccessSave = new TransientWisdomDataAccessSave { Store = store } }; } else { guru = realGuru; } IBootstrap bootstrap = new ConsoleBootstrap { Guru = guru }; bootstrap.Run(args); }
public WcfGuruService() { IGuru realGuru = new RandomQuestioningGuru { MinThinkMillis = 1000, MaxThinkMillis = 1000, Locked = new SpinLocked()}; var store = new TransientWisdomStore { MinAddLockMillis = 10, MaxAddLockMillis = 10, MinGetLockMillis = 40, MaxGetLockMillis = 40, Locked = new SpinLocked() }; m_realGuru = new GuruService { RealGuru = realGuru, WisdomDataAccessFind = new TransientWisdomDataAccessFind { Store = store }, WisdomDataAccessSave = new TransientWisdomDataAccessSave { Store = store } }; }