public EmployeeListViewModel(IRepository <Employee> repository, bool largeMode, IOperationTimer operationTimer) { timer = operationTimer.Begin("Employee view model"); this.repository = repository; this.operationTimer = operationTimer; if (largeMode) { const int maxSize = 10000; var largeList = new List <Employee>(maxSize); var collection = this.repository.GetAll().ToArray(); for (int i = 0; i < maxSize / 500; i++) { largeList.AddRange(collection); } this.employees = new ObservableCollection <Employee>(largeList); } else { this.employees = new ObservableCollection <Employee>(this.repository.GetAll()); } timer.End(timer); Debug.WriteLine(timer); }
public void EndTimer(TimingLevel level) { if (_timers != null && _timers.ContainsKey(level)) { IOperationTimer timer = null; if (_timers.TryGetValue(level, out timer)) { if (timer != null) { timer.Dispose(); _timers.Remove(level); } } } }
public void BeginTimer(TimingLevel level) { IOperationTimer timer = null; if (Timer != null) { timer = Timer(level, this); if (_timers == null) { _timers = new Dictionary <TimingLevel, IOperationTimer>(); } if (!_timers.ContainsKey(level)) { _timers.Add(level, timer); } } }
public view() { timer = ObjectFactory.GetInstance <IOperationTimer>(); timerResult = timer.Begin("Employee view"); InitializeComponent(); }
public App(IOperationTimer operationTimer) { applicationTimer = operationTimer.Begin("Application"); }