ContainsEventArg() public method

public ContainsEventArg ( string eventArgName ) : bool
eventArgName string
return bool
 private void HandleReplayingLastNodeEvent(Event receivedEvent)
 {
     if (ViewManager != null && ViewManager.CurrentView != null && ViewManager.CurrentView.NodeRenderers != null
         && receivedEvent.EventArgs != null && receivedEvent.ContainsEventArg("NodeId"))
     {
         Guid nodeId = Guid.Empty;
         if (Guid.TryParse(receivedEvent.GetEventArgValue("NodeId"), out nodeId)) 
         {
             NodeRenderer playingNode = ViewManager.CurrentView.NodeRenderers[nodeId];
             {
                 playingNode.SetIsPlaying(true);
                 playingNode.ResetMediaIcon(true);
             }
         }
     }
 }
 private void HandledCurrentStateChanged(Event receivedEvent)
 {
     if (receivedEvent.EventArgs != null && receivedEvent.ContainsEventArg("State"))
     {
         string state = receivedEvent.GetEventArgValue("State");
         Guid nodeId = Guid.Empty;
         if (receivedEvent.ContainsEventArg("NodeId"))
         {
             Guid.TryParse(receivedEvent.GetEventArgValue("NodeId"), out nodeId);
         }
         if (!string.IsNullOrEmpty(state) && state.ToLower() == "idle")
         {
             ResetNodeRendererMediaIcon(nodeId, false);
         }
         else if (!string.IsNullOrEmpty(state) && state.ToLower() == "playing")
         {
             ResetNodeRendererMediaIcon(nodeId, true);
         }
         else if (!string.IsNullOrEmpty(state) && state.ToLower() == "buffering")
         {
             ResetNodeRendererMediaIcon(nodeId, true);
         }
     }
 }
 private void HandleSeekEvent(Event receivedEvent)
 {
     if (receivedEvent.EventArgs != null && receivedEvent.ContainsEventArg("NewPosition"))
     {
         if (ViewManager != null && ViewManager.CurrentView != null && ViewManager.CurrentView.NodeRenderers != null)
         {
             TimeSpan newPosition = TimeSpan.MinValue;
             if (TimeSpan.TryParse(receivedEvent.GetEventArgValue("NewPosition"), out newPosition))
             {
                 foreach (NodeRenderer nodeRenderer in ViewManager.CurrentView.NodeRenderers.Values)
                 {
                     if (nodeRenderer.ResetMediaIcon(newPosition))
                     {
                         break;
                     }
                 }
             }
         }
     }
 }
 private void HandleGetSourceAndPositionCallback(Event callback)
 {
     if (callback.EventArgs != null && callback.ContainsEventArg("CallbackId")
         && callback.ContainsEventArg("Position") && callback.ContainsEventArg("Source")
         && callback.ContainsEventArg("NodeId"))
     {
         string callbackId = callback.GetEventArgValue("CallbackId");
         string source = callback.GetEventArgValue("Source");
         string nodeId = callback.GetEventArgValue("NodeId");
         switch (callbackId)
         {
             case "StartPosition":
                 TimeSpan startPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));
                 SaveMediaInformation(nodeId, source, callbackId, startPosition);
                 break;
             case "EndPosition":
                 TimeSpan endPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));
                 SaveMediaInformation(nodeId, source, callbackId, endPosition);
                 break;
             default:
                 break;
         }
     }
 }
        private void HandleGetPlayingStateCallback(Event callback) 
        {
            if (callback.EventArgs != null && callback.ContainsEventArg("CallbackId")
                && callback.ContainsEventArg("State") && callback.ContainsEventArg("NodeId"))
            {
                string callbackId = callback.GetEventArgValue("CallbackId");
                string state = callback.GetEventArgValue("State");
                string currentlyPlayingNodeId = callback.GetEventArgValue("NodeId");

                if (ViewManager != null && ViewManager.CurrentView != null)
                {
                    if (callbackId == Navigator.FocalNodeId.ToString()) //the request was made for this map refresh
                    {
                        if (state == "Playing" || state == "Buffering")
                        {
                            foreach (NodeRenderer nodeRenderer in ViewManager.CurrentView.NodeRenderers.Values)
                            {
                                if (nodeRenderer.Node.Id.ToString() == currentlyPlayingNodeId)
                                {
                                    nodeRenderer.SetIsPlaying(true);
                                    nodeRenderer.ResetMediaIcon(true);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
示例#6
0
 private void HandleGetPlayingStateCallback(Event e)
 {
     if (e.EventArgs != null && e.ContainsEventArg("State") && e.ContainsEventArg("NodeId"))
     {
         if (NodeProxy.Id.ToString() == e.GetEventArgValue("NodeId"))
         {
             switch (e.GetEventArgValue("State"))
             {
                 case "Playing":
                     pauseVideoMenuItem.IsEnabled = true;
                     break;
                 case "Paused":
                     pauseVideoMenuItem.IsEnabled = false;
                     break;
                 default:
                     pauseVideoMenuItem.IsEnabled = false;
                     break;
             }
         }
     }
 }
示例#7
0
        private void HandledCurrentStateChanged(Event receivedEvent)
        {
            if (!HasVideo)
            {
                HasVideo = true;
            }

            if (receivedEvent.EventArgs != null && receivedEvent.ContainsEventArg("State"))
            {
                string state = receivedEvent.GetEventArgValue("State");

                if (receivedEvent.ContainsEventArg("NodeId"))
                {
                    string viewModelIdAsString = receivedEvent.GetEventArgValue("NodeId");

                    if (!string.IsNullOrEmpty(state) && !string.IsNullOrEmpty(viewModelIdAsString))
                    {
                        var neutralisedState = state.ToLower();
                        var viewModelId = new Guid(viewModelIdAsString);

                        if (ViewModels.ContainsKey(viewModelId))
                        {
                            VideoInfo viewModelVideoInfo = ViewModels[viewModelId];

                            switch (neutralisedState)
                            {
                                case "idle":
                                    _isChangedByController = true;
                                    viewModelVideoInfo.Status = VideoState.Pause;
                                    break;
                                case "playing":
                                    _isChangedByController = true;
                                    viewModelVideoInfo.Status = VideoState.Playing;
                                    break;
                                case "buffering":
                                    _isChangedByController = true;
                                    viewModelVideoInfo.Status = VideoState.Playing;
                                    break;
                            }
                        }
                    }
                }
            }
        }
示例#8
0
        private void HandleGetPlayingStateCallback(Event callback)
        {
            if (callback.EventArgs != null && callback.ContainsEventArg("CallbackId")
                && callback.ContainsEventArg("State") && callback.ContainsEventArg("NodeId"))
            {
                var callbackId = callback.GetEventArgValue("CallbackId");
                var state = callback.GetEventArgValue("State");
                var viewModelIdAsString = callback.GetEventArgValue("NodeId");

                if (!string.IsNullOrEmpty(viewModelIdAsString))
                {
                    var viewModelId = new Guid(viewModelIdAsString);

                    foreach (var viewModelVideoInfo in ViewModels.Values)
                    {
                        if (viewModelVideoInfo.Id == viewModelId)
                        {
                            if (state == "Playing" || state == "Buffering")
                            {
                                _isChangedByController = true;
                                viewModelVideoInfo.Status = VideoState.Playing;
                            }
                            else
                            {
                                _isChangedByController = true;
                                viewModelVideoInfo.Status = VideoState.Pause;
                            }
                        }
                        else
                        {
                            if (viewModelVideoInfo.HasVideo)
                            {
                                _isChangedByController = true;
                                viewModelVideoInfo.Status = VideoState.Pause;
                            }
                        }
                    }
                }
            }
        }
示例#9
0
 private void HandlePlayerDisposedEvent(Event disposedEvent)
 {
     _cachedCommand = null;
     _playerInitialised = false;
     if (disposedEvent.EventArgs != null && disposedEvent.ContainsEventArg("NodeId"))
     {
         string viewModelIdAsString = disposedEvent.GetEventArgValue("NodeId");
         var viewModelId = new Guid(viewModelIdAsString);
         if (ViewModels.ContainsKey(viewModelId))
         {
             VideoInfo viewModelVideoInfo = ViewModels[viewModelId];
             _isChangedByController = true;
             viewModelVideoInfo.Status = VideoState.Pause;
         }
     }
 }
示例#10
0
        private void HandleGetSourceAndPositionCallback(Event callback)
        {
            if (callback.EventArgs != null && callback.ContainsEventArg("CallbackId")
                && callback.ContainsEventArg("Position") && callback.ContainsEventArg("Source")
                && callback.ContainsEventArg("NodeId"))
            {
                string callbackId = callback.GetEventArgValue("CallbackId");
                string source = callback.GetEventArgValue("Source");
                source = HttpUtility.UrlDecode(source); 
                string viewModelIdAsString = callback.GetEventArgValue("NodeId");

                if (!string.IsNullOrEmpty(viewModelIdAsString) && !string.IsNullOrEmpty(source))
                {
                    var chain = new TransactionChain();
                    var viewModelId = new Guid(viewModelIdAsString);
                    var viewModelVideoInfo = ViewModels[viewModelId];

                    switch (callbackId)
                    {
                        case "StartPosition":
                            {
                                TimeSpan startPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));
                                // Just add a temporary end position so that the entry doesn't end up in a bad state.
                                ViewModel.IMetadata startPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.StartPosition"];

                                if (startPositionMetadata != null)
                                {
                                    startPositionMetadata.SetValue(startPosition.ToString(), ref chain); 
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata["Video.StartPosition"] = startPosition.ToString();
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.StartPosition", startPosition.ToString(), ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.StartPosition", startPosition.ToString());
                                }

                                ViewModel.IMetadata endPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.EndPosition"];

                                if (endPositionMetadata != null)
                                {
                                    endPositionMetadata.SetValue("", ref chain);
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.EndPosition", "", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.EndPosition", "");
                                }

                                viewModelVideoInfo.HasVideo = true;
                                viewModelVideoInfo.StartPosition = startPosition;
                                viewModelVideoInfo.StopPosition = null;
                                break;
                            }
                        case "EndPosition":
                            {
                                TimeSpan endPosition = TimeSpan.Parse(callback.GetEventArgValue("Position"));

                                ViewModel.IMetadata endPositionMetadata = viewModelVideoInfo.Context.Metadata["Video.EndPosition"];

                                if (endPositionMetadata != null)
                                {
                                    endPositionMetadata.SetValue("", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata["Video.EndPosition"] = endPosition.ToString();
                                }
                                else
                                {
                                    viewModelVideoInfo.Context.Metadata.Add("Video.EndPosition", "", ref chain);
                                    ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.EndPosition", endPosition.ToString());
                                }

                                viewModelVideoInfo.Context.Metadata.Add(null, null, "Video.EndPosition", endPosition.ToString(), ref chain);
                                viewModelVideoInfo.StopPosition = endPosition;
                                viewModelVideoInfo.HasVideo = true;
                                break;
                            }
                    }

                    ViewModel.IMetadata videoSourceMetadata = viewModelVideoInfo.Context.Metadata["Video.Source"];

                    if (videoSourceMetadata != null)
                    {
                        videoSourceMetadata.SetValue(source, ref chain);
                        ((SuperGraph.ViewModel.Node) viewModelVideoInfo.Context).NodeProperties.UIMetadata[
                            "Video.Source"] = source;
                    }
                    else
                    {
                        viewModelVideoInfo.Context.Metadata.Add(null, null, "Video.Source", source, ref chain);
                        ((SuperGraph.ViewModel.Node)viewModelVideoInfo.Context).NodeProperties.UIMetadata.Add("Video.Source", source);
                    }
                    viewModelVideoInfo.VideoSource = source;
                    viewModelVideoInfo.Context.Proxy.MapManager.ExecuteTransaction(chain);
                }
            }
        }