/// <summary> Конвертировать CallHistoryModelManaged в ModelCallHistory </summary>
        private static ModelCallHistory ConvertCallHistoryModelManagedToModelCallHistory(CallHistoryModelManaged callHistoryModelManaged)
        {
            var result = new ModelCallHistory
            {
                TotalMissed = callHistoryModelManaged.TotalMissed,
                ListModelCallHistoryPeer = new ObservableCollection <ModelCallHistoryPeer>(callHistoryModelManaged.Peers.Select(ConvertCallHistoryPeerModelManagedToModelCallHistoryPeer))
            };

            return(result);
        }
        /// <summary> Обработчик изменения истории вызовов </summary>
        private void OnModelCallHistoryChanged(object sender, ModelCallHistory modelCallHistory)
        {
            if (modelCallHistory.ListModelCallHistoryPeer.Any(obj => obj.ModelPeerObj.Id == _modelCallHistoryPeerObj.ModelPeerObj.Id))
            {
                var modelCallHistoryDetail = DataSourceCall.GetChangedModelCallHistoryDetail(_modelCallHistoryPeerObj);

                Action action = () =>
                {
                    ModelCallHistoryPeerObj.ListModelCallHistoryEntry = modelCallHistoryDetail.ListModelCallHistoryPeer.First().GetDeepCopy().ListModelCallHistoryEntry;
                };

                CurrentDispatcher.BeginInvoke(action);
            }
        }
Exemplo n.º 3
0
        /// <summary> Обработчик изменения истории вызовов </summary>
        private void ChangeModelCallHistory(ModelCallHistory modelCallHistory)
        {
            var copyModelCallHistory = modelCallHistory.GetDeepCopy();

            foreach (var i in copyModelCallHistory.ListModelCallHistoryPeer)
            {
                var modelCallHistoryPeer = _currentModelCallHistory.ListModelCallHistoryPeer.FirstOrDefault(obj => DataSourceCall.CompareModelCallHistoryPeerId(obj, i) == 0);

                if (modelCallHistoryPeer == null)
                {
                    _currentModelCallHistory.ListModelCallHistoryPeer.Add(i);
                }
                else
                {
                    modelCallHistoryPeer.ModelCallStatisticsObj    = i.ModelCallStatisticsObj;
                    modelCallHistoryPeer.ModelPeerObj              = i.ModelPeerObj;
                    modelCallHistoryPeer.ListModelCallHistoryEntry = i.ListModelCallHistoryEntry;
                }
            }

            SortListModelCallHistoryPeer();

            var listMissedCount = CurrentModelCallHistory.ListModelCallHistoryPeer.Select(obj => obj.ModelCallStatisticsObj.NumberOfMissedCalls);

            if (listMissedCount.Any())
            {
                var missedCount = 0;

                foreach (var i in listMissedCount)
                {
                    missedCount += i;
                }

                CurrentModelCallHistory.TotalMissed = missedCount;
            }
        }
Exemplo n.º 4
0
        /// <summary> Обработчик изменения истории вызовов </summary>
        private void OnModelCallHistoryChanged(object sender, ModelCallHistory modelCallHistory)
        {
            Action action = () => ChangeModelCallHistory(modelCallHistory);

            CurrentDispatcher.BeginInvoke(action);
        }
Exemplo n.º 5
0
 /// <summary> Инвокатор события ModelCallHistoryChanged </summary>
 private void OnModelCallHistoryChanged(ModelCallHistory modelCallHistory)
 {
     ModelCallHistoryChanged?.Invoke(this, modelCallHistory);
 }