/// <summary> /// Constructor for MainViewModel. /// </summary> /// <param name="uiDispatcher">Core event message dispatcher.</param> public MainViewModel(CoreDispatcher uiDispatcher) : base(uiDispatcher) { // Initialize all the action commands InitStartWebRtcCommand = new ActionCommand(InitStartWebRtcCommandExecute, InitStartWebRtcCommandCanExecute); SendTestMessageToAnnotationReceiverCommand = new ActionCommand(SendTestMessageToAnnotationReceiverCommandExecute, SendTestMessageToAnnotationReceiverCommandCanExecute); starWebrtcContext = StarWebrtcContext.CreateMentorContext(); starWebrtcContext.CoreDispatcher = uiDispatcher; // right after creating the context (before starting the connections), we could edit some parameters such as the signalling server // comment these out if not needed Messenger.AddListener <string>(SympleLog.LogTrace, OnLog); Messenger.AddListener <string>(SympleLog.LogDebug, OnLog); Messenger.AddListener <string>(SympleLog.LogInfo, OnLog); Messenger.AddListener <string>(SympleLog.LogError, OnLog); //Messenger.AddListener<IMediaSource>(SympleLog.CreatedMediaSource, OnCreatedMediaSource); //Messenger.AddListener(SympleLog.DestroyedMediaSource, OnDestroyedMediaSource); Messenger.AddListener(SympleLog.RemoteAnnotationReceiverConnected, OnRemoteAnnotationReceiverConnected); Messenger.AddListener(SympleLog.RemoteAnnotationReceiverDisconnected, OnRemoteAnnotationReceiverDisconnected); Messenger.AddListener <Org.WebRtc.Media, Org.WebRtc.MediaVideoTrack>(SympleLog.RemoteStreamAdded, OnRemoteStreamAdded); Messenger.AddListener <Org.WebRtc.Media, Org.WebRtc.MediaVideoTrack>(SympleLog.RemoteStreamRemoved, OnRemoteStreamRemoved); // Display a permission dialog to request access to the microphone and camera WebRTC.RequestAccessForMediaCapture().AsTask().ContinueWith(antecedent => { if (antecedent.Result) { Initialize(uiDispatcher); } else { RunOnUiThread(async() => { var msgDialog = new MessageDialog( "Failed to obtain access to multimedia devices!"); await msgDialog.ShowAsync(); }); } }); }
public MainPage() { this.InitializeComponent(); Debug.WriteLine("MainPage()"); _mediaPlayer = new MediaPlayer(); mediaPlayerElement.SetMediaPlayer(_mediaPlayer); starWebrtcContext = StarWebrtcContext.CreateMentorContext(); // right after creating the context (before starting the connections), we could edit some parameters such as the signalling server // comment these out if not needed //Messenger.AddListener<string>(SympleLog.LogTrace, OnLog); Messenger.AddListener <string>(SympleLog.LogDebug, OnLog); Messenger.AddListener <string>(SympleLog.LogInfo, OnLog); Messenger.AddListener <string>(SympleLog.LogError, OnLog); Messenger.AddListener <IMediaSource>(SympleLog.CreatedMediaSource, OnCreatedMediaSource); Messenger.AddListener(SympleLog.DestroyedMediaSource, OnDestroyedMediaSource); }
/////////////////////// public MainPage() { this.InitializeComponent(); myController = new ControlCenter(); myJsonManager = new JSONManager(); redColor = new SolidColorBrush(Windows.UI.Colors.Red); greenColor = new SolidColorBrush(Windows.UI.Colors.Green); tealColor = new SolidColorBrush(Windows.UI.Colors.Teal); goldColor = new SolidColorBrush(Windows.UI.Colors.Gold); CreateButtonsColor(); AnnotationCounter = 0; ResetLineAnnotation(); deleteTempFiles(); //ColoredRectangle.PointerEntered += EnteringRectangle; //ColoredRectangle.Holding += HoldingRectangle; //////////////Threads////////////// Task jsonTask = Task.Run(() => JsonThread()); //////////////////////////////////// _mediaPlayer = new MediaPlayer(); mediaPlayerElement.SetMediaPlayer(_mediaPlayer); starWebrtcContext = StarWebrtcContext.CreateMentorContext(); // comment these out if not needed //Messenger.AddListener<string>(SympleLog.LogTrace, OnLog); /*Messenger.AddListener<string>(SympleLog.LogDebug, OnLog); * Messenger.AddListener<string>(SympleLog.LogInfo, OnLog); * Messenger.AddListener<string>(SympleLog.LogError, OnLog);*/ Messenger.AddListener <IMediaSource>(SympleLog.CreatedMediaSource, OnCreatedMediaSource); Messenger.AddListener(SympleLog.DestroyedMediaSource, OnDestroyedMediaSource); }