private void addContextContact(string p1, string p2) { if (string.IsNullOrEmpty(p2)) { return; } var name = string.Format("{0} ({1})", p1, p2); ContextContacts.Add(new Contact { Name = name, Number = p2, TransferType = TransferTypes.OutboundDialing, Description = name, }); }
private void currentEditorTabChanged(object sender, EditorTabChangedEventArgs e) { try { ContextContacts.Clear(); WorkspaceRecordType?workspaceType = null; if (RightNowGlobalContext.AutomationContext.CurrentWorkspace != null) { workspaceType = RightNowGlobalContext.AutomationContext.CurrentWorkspace.WorkspaceType; } if (CurrentInteraction != null && workspaceType != null) { CanAssociateToRecord = workspaceType.Value == WorkspaceRecordType.Contact || workspaceType.Value == WorkspaceRecordType.Incident; } else { CanAssociateToRecord = false; } if (workspaceType != null && workspaceType.Value == WorkspaceRecordType.Contact) { var contact = RightNowGlobalContext.AutomationContext.CurrentWorkspace.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; if (contact == null) { RightNowGlobalContext.AutomationContext.CurrentWorkspace.DataLoaded += currentWorkspaceDataLoaded; contact = RightNowGlobalContext.AutomationContext.CurrentWorkspace.GetWorkspaceRecord(WorkspaceRecordType.Contact) as IContact; if (contact != null) { RightNowGlobalContext.AutomationContext.CurrentWorkspace.DataLoaded -= currentWorkspaceDataLoaded; loadContextNumbers(contact); } } else { loadContextNumbers(contact); } } } catch (Exception ex) { Logger.Logger.Log.Error("Error on currentEditorTabChanged :", ex); } }