private void Queue_OnInteractionAdded(object sender, InteractionEventArgs e) { try { Context.Send(s => { try { // Make sure it's not already disconnected var state = e.Interaction.GetAttribute(InteractionAttributes.State); if (state.Equals(InteractionAttributeValues.State.ExternalDisconnect, StringComparison.InvariantCultureIgnoreCase) || state.Equals(InteractionAttributeValues.State.InternalDisconnect, StringComparison.InvariantCultureIgnoreCase)) { return; } // Verify that this interaction has hootsuite data if (string.IsNullOrEmpty(e.Interaction.GetAttribute("Hootsuite_RawData"))) { return; } // Add it to the list Interactions.Add(new InteractionViewModel(e.Interaction)); // Select it if we don't have anything else if (SelectedInteraction == null) { SelectedInteraction = Interactions[Interactions.Count - 1]; } } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }, null); } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }
private void InteractionSelector_OnSelectedInteractionChanged(object sender, EventArgs e) { try { Context.Send(s => { try { // If it's nothing, skip if (_interactionSelector.SelectedInteraction == null) { return; } // Find the interaction var interaction = Interactions.FirstOrDefault( i => i.InteractionId.Equals(_interactionSelector.SelectedInteraction.InteractionId)); // Skip if we didn't find the interaction (it was probably a non-hootsuite interaction like a call or chat) if (interaction == null) { return; } // Set it as the selected interaction SelectedInteraction = interaction; } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }, null); } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }