private void LoadAllCalls() { CallsList.Clear(); var callsItemDB = from VATRPCallEvent call in _historyService.AllCallsEvents orderby call.StartTime descending select call; foreach (var avCall in callsItemDB.Take(30)) { try { var dn = avCall.RemoteParty; var callItem = new RecentsCallItem() { CallerName = dn, CallTime = avCall.StartTime, Duration = avCall.Status == VATRPHistoryEvent.StatusType.Missed ? -1 : avCall.Duration, TargetNumber = avCall.RemoteParty, CallStatus = avCall.Status, ContactId = avCall.Contact != null ? avCall.Contact.DisplayName : string.Empty }; CallsList.Add(callItem); } catch (Exception ex) { LOG.Error("Exception on LoadAllCalls: " + ex.Message); } } }
private void AddNewCallEvent(VATRPCallEvent callEvent) { try { var dn = callEvent.RemoteParty; var callItem = new RecentsCallItem() { CallerName = dn, CallTime = callEvent.StartTime, Duration = callEvent.Status == VATRPHistoryEvent.StatusType.Missed ? -1 : callEvent.Duration, TargetNumber = callEvent.RemoteParty, CallStatus = callEvent.Status, ContactId = callEvent.Contact != null ? callEvent.Contact.DisplayName : String.Empty }; if ( callEvent.Status == VATRPHistoryEvent.StatusType.Missed) MissedCallsList.Add(callItem); CallsList.Add(callItem); } catch (Exception ex) { ServiceManager.LogError("AddNewCallEvent", ex); } }