Пример #1
0
        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);
        }
Пример #2
0
 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);
             }
         }
     }
 }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
 public view()
 {
     timer       = ObjectFactory.GetInstance <IOperationTimer>();
     timerResult = timer.Begin("Employee view");
     InitializeComponent();
 }
Пример #5
0
 public App(IOperationTimer operationTimer)
 {
     applicationTimer = operationTimer.Begin("Application");
 }