public void InviteToConference(InteractionViewModel interaction, string message) { using (Trace.Main.scope()) { try { if (interaction == null) { throw new ArgumentNullException("interaction"); } if (interaction.TransferTarget == null) { throw new ArgumentNullException("interaction.TransferTarget"); } if (interaction.TransferTarget.Entry.LookupEntryType != LookupEntryType.User) { throw new Exception("Only users can be invited to conferences! Invalid target: " + interaction.TransferTarget.Entry.LookupEntryType); } /* Invite target * [0] = Requesting user * [1] = Message from user * [2] = Join url (guest link) */ SendCustomNotification(CustomMessageType.ApplicationRequest, interaction.TransferTarget.Entry.EntryId, JoinVidyoConferenceRequestEid, _session.UserId, message, interaction.VidyoRoomUrl); } catch (Exception ex) { Console.WriteLine(ex); Trace.Main.exception(ex, ex.Message); } } }
public static InteractionViewModel FromInteraction(Interaction interaction) { var i = new InteractionViewModel { _interaction = interaction }; return(i); }
private void SessionOnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e) { using (Trace.Main.scope()) { try { if (e.State == ConnectionState.Up) { Trace.Main.always("Reinitializing!"); Initialize(_session, _interactionSelector); } // Clean up if (e.State != ConnectionState.Up) { // Because Icelib cannot be trusted not to throw bizarre exceptions, supress errors from stopwatching try { if (_customNotification != null && _customNotification.IsWatching()) { _customNotification.StopWatching(); _customNotification.CustomNotificationReceived -= OnCustomNotificationReceived; _customNotification = null; } } catch (Exception ex) { Trace.Main.warning("Supressing error encountered while stopping custom notification watch: {}", ex.Message); } try { if (MyInteractions != null && MyInteractions.IsWatching()) { MyInteractions.StopWatching(); MyInteractions.InteractionAdded -= MyInteractionsOnInteractionAdded; MyInteractions.InteractionChanged -= MyInteractionsOnInteractionChanged; MyInteractions.InteractionRemoved -= MyInteractionsOnInteractionRemoved; MyInteractions = null; } } catch (Exception ex) { Trace.Main.warning("Supressing error encountered while stopping my interactions watch: {}", ex.Message); } Context.Send(s => { Interactions.Clear(); SelectedInteraction = null; }, null); } } catch (Exception ex) { Trace.Main.exception(ex); } } }
private InteractionViewModel GetInteractionViewModel(Interaction interaction) { // Does this interaction have a video conversation attached? if (string.IsNullOrEmpty(interaction.GetStringAttribute(VideoIntegrationAttributeNames.VideoConversationId))) { Trace.Main.status("{} does not have a video conversation", interaction.InteractionId.Id); return(null); } // Try to find an existing VM first var interactionVm = Interactions.FirstOrDefault(i => i.InteractionId.Equals(interaction.InteractionId.Id)); if (interactionVm != null) { return(interactionVm); } Context.Send(s => { try { // Create view model interactionVm = InteractionViewModel.FromInteraction(interaction); // Add to list Interactions.Add(interactionVm); // Set it as the selected interaction (forces the interaction's tab to show within the vidyo tab addin) SelectedInteraction = interactionVm; } catch (Exception ex) { Trace.Main.exception(ex); } }, null); // Auto answer because of reconstitution? if (interactionVm.VidyoAutoAnswerOnReconstitution) { interaction.Pickup(); } return(interactionVm); }