void CallEntryAdded(CallEntry obj) { if (InvokeRequired) { Invoke(new Action(() => CallEntryAdded(obj)), null); return; } var listViewItem = new ListViewItem(); if (obj.IsIncoming && obj.IsAnswered) { listViewItem.ImageIndex = 1; } else if (!obj.IsIncoming) { listViewItem.ImageIndex = 2; } else { listViewItem.ImageIndex = 0; } listViewItem.SubItems.AddRange( new [] { new System.Windows.Forms.ListViewItem.ListViewSubItem(listViewItem, obj.Number), new System.Windows.Forms.ListViewItem.ListViewSubItem(listViewItem, obj.Name), new System.Windows.Forms.ListViewItem.ListViewSubItem(listViewItem, obj.CallDate.ToString("dd.MM.yyyy HH:mm:ss")), new System.Windows.Forms.ListViewItem.ListViewSubItem(listViewItem, obj.Duration.ToString()), }); listView1.Items.Insert(0, listViewItem); }
private void CallManager_OnCallRemoved(ICall call, CallRemoveReason reason) { if (call.LastState == CallState.IDLE) { return; } if (reason != CallRemoveReason.NULL || (reason == CallRemoveReason.NULL && call.LastUserAction == CallAction.NULL)) { var callEntry = new CallEntry(call, reason); _calls.Add(callEntry); CallEntryAdded?.Invoke(callEntry); } }