예제 #1
0
        private void GoToApplication(string applicationHome, string applicationHomeNode, NodeTransition transition, bool isPopup, long sourceViewID)
        {
            //TODO: check in cache first, before trying to send a message

            WaveMessage msg = new WaveMessage();

            Core.Navigation.Requests.Add(msg, sourceViewID, transition, isPopup);
            msg.AddString(NaviAgentFieldID.ApplicationURN, applicationHome);

            if (applicationHomeNode != null)
            {
                msg.AddString(MessageOutFieldID.ItemURI, applicationHomeNode);
            }

            Core.System.Location.AddLocationData(msg);

            msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.GotoAnotherApplicationNode);

            Core.UI.SignalViewNavigationStart(sourceViewID);
        }
예제 #2
0
        private void SendForm(FormAction trigger, ActionSet actionSet, Node sourceNode, BlockBase sourceBlock, long sourceViewID, bool expectResponse = false)
        {
            if (sourceNode != null)
            {
                WaveMessage msg = new WaveMessage();

                Core.Navigation.Requests.Add(msg, sourceViewID, trigger.Transition, trigger.IsPopUp);

                if (Core.CSLVersion == WaveCSLVersion.Version5)
                {
                    msg.AddInt16(NaviAgentFieldID.ActionTypeID, (short)trigger.ActionType);
                    msg.AddBoolean(NaviAgentFieldID.FormRequiresNoWait, trigger.WaitForNode);
                }
                else
                {
                    msg.AddByte(NaviAgentFieldID.ActionRef, (byte)trigger.FormID);
                }

                FieldList payload = FieldList.CreateField(NaviAgentFieldID.ActionPayload);

                payload.AddString(NaviAgentFieldID.FormRequestURL, trigger.FormURL);
                sourceNode.AttachFormData((short)trigger.FormID, payload);

                msg.AddFieldList(payload);

                Core.System.Location.AddLocationData(msg);

                if (sourceNode.CacheID != null)
                {
                    msg.AddBinary(MessageOutFieldID.CacheItemID, sourceNode.CacheID.Value.ToByteArray());
                }
                else
                {
                    msg.AddString(MessageOutFieldID.ItemURI, sourceNode.URI);
                }

                if (Core.CSLVersion != WaveCSLVersion.Version5)
                {
                    msg.AddInt32(NaviAgentFieldID.ActionSetID, actionSet.DefinitionID);
                }

                msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.Action);

                if (expectResponse)
                {
                    Core.UI.SignalViewNavigationStart(sourceViewID);
                }
            }
        }
예제 #3
0
        private void GoToNodeByID(CacheItemID?id, string nodeURI, NodeTransition transition, bool isPopup, long targetViewID)
        {
            // check if node is in the cache
            object data = null;

            if (id.HasValue)
            {
                data = Core.Cache.Server[id.Value];
            }

            if (data == null)
            {
                // request node from server
                if (!String.IsNullOrEmpty(nodeURI))
                {
                    WaveMessage msg = new WaveMessage();

                    Core.Navigation.Requests.Add(msg, targetViewID, transition, isPopup);
                    msg.AddString(MessageOutFieldID.ItemURI, nodeURI);
                    Core.System.Location.AddLocationData(msg);

                    msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.RequestNodeOnCacheError);

                    Core.UI.SignalViewNavigationStart(targetViewID);
                }
            }
            else
            {
                // load node from cache
                UnpackCachedNode((FieldList)data, transition, isPopup, targetViewID);

                // inform server
                if (id.HasValue || !String.IsNullOrEmpty(nodeURI))
                {
                    WaveMessage msg = new WaveMessage();

                    if (id.HasValue)
                    {
                        msg.AddBinary(MessageOutFieldID.CacheItemID, id.Value.ToByteArray());
                    }
                    else
                    {
                        msg.AddString(MessageOutFieldID.ItemURI, nodeURI);
                    }

                    msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.SubscribeToNodeWithoutRequest);
                }
            }
        }
예제 #4
0
        public void GoToNodeByURI(string nodeURI, NodeTransition transition, bool isPopup, long sourceViewID, bool refresh = false)
        {
            // check if node is in the cache
            object data = Core.Cache.Server[nodeURI];

            if ((data == null) || refresh)
            {
                // not in cache, ask server
                Core.Network.EnsureConnection();

                WaveMessage msg = new WaveMessage();

                Core.Navigation.Requests.Add(msg, sourceViewID, transition, isPopup);

                if (refresh)
                {
                    msg.AddBoolean(MessageOutFieldID.RefreshingNode, true);
                }

                msg.AddString(MessageOutFieldID.ItemURI, nodeURI);
                Core.System.Location.AddLocationData(msg);

                msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.RequestNode);

                Core.UI.SignalViewNavigationStart(sourceViewID);
            }
            else
            {
                if (data is FieldList)
                {
                    // inform server
                    WaveMessage msg = new WaveMessage();
                    msg.AddString(MessageOutFieldID.ItemURI, nodeURI);
                    msg.Send(WaveServerComponent.NavigationAgent, NaviAgentMessageID.SubscribeToNodeWithoutRequest);

                    // unpack
                    UnpackCachedNode((FieldList)data, transition, isPopup, sourceViewID);
                }
                else
                {
                    DebugHelper.Out("Unexpected data type: {0}", data.GetType().FullName);
                }
            }
        }