예제 #1
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);
                }
            }
        }