Esempio n. 1
0
        public void Load(FieldList source, Enum fieldID)
        {
            // try to load new sets
            List <FieldList> results = source.GetItems <FieldList>(fieldID);

            if (results.Count > 0)
            {
                foreach (FieldList field in results)
                {
                    Add(field);
                }
            }
        }
        public void Unpack(FieldList source)
        {
            if (source == null)
            {
                return;
            }

            UnpackDefinitionID(source);

            Background = new PaintStyle(source, DefAgentFieldID.BackgroundPaintStyle);
            FirstFocus = source[DefAgentFieldID.FirstFocus].AsByte() ?? (short)-1;

            if (FirstFocus == -1)
            {
                FirstFocus = 0;
            }

            BackgroundImageCrop = (CropStrategy)(source[DefAgentFieldID.BackgroundCropStrategy].AsNumber() ?? 0);

            UIFlowDirection fd = (UIFlowDirection)(source[DefAgentFieldID.FlowDirection].AsByte() ?? (byte)UIFlowDirection.Down);

            IsHorizontal = (fd == UIFlowDirection.Right);

            List <Int16Field> rs = source.GetItems <Int16Field>(DefAgentFieldID.RelativeSize);

            foreach (Int16Field field in rs)
            {
                SizeRatios.Add(field.Data);
            }

            UnpackMarginsAndPadding(source);
            UnpackBlockHints(source);

            // done
            IsUnpacked = true;
        }
Esempio n. 3
0
        public void Unpack(FieldList source)
        {
            if (source == null)
            {
                return;
            }

            UnpackDefinitionID(source);

            Background = new PaintStyle(source, DefAgentFieldID.BackgroundPaintStyle);

            UIFlowDirection fd = (UIFlowDirection)(source[DefAgentFieldID.FlowDirection].AsByte() ?? (byte)UIFlowDirection.Down);

            IsHorizontal = (fd == UIFlowDirection.Right);

            BackgroundImageCrop   = (CropStrategy)(source[DefAgentFieldID.BackgroundCropStrategy].AsNumber() ?? 0);
            SizeToBackgroundImage = source[DefAgentFieldID.BlockSizeToBackground].AsBoolean() ?? false;
            ScrollableBackground  = source[DefAgentFieldID.BackgroundScrollable].AsBoolean() ?? false;

            NumberOfFullyVisibleChildrenInHorizontalMode = source[DefAgentFieldID.VisibleChildren].AsShort() ?? 4;

            AllowAutoScroll       = source.GetItemCount(DefAgentFieldID.AllowAutoscroll) > 0;
            EnforceRadioBehaviour = source.GetItemCount(DefAgentFieldID.EnforceRadio) > 0;

            ScrollIndicationType = (ScrollIndication)(source[DefAgentFieldID.ScrollIndicationType].AsByte() ?? (byte)ScrollIndication.Bar);

            Spacing = source[DefAgentFieldID.Spacing].AsShort() ?? 0;

            UnpackMarginsAndPadding(source);

            BlockFocusBehaviour = (FocusBehaviour)(source[DefAgentFieldID.FocusBehaviour].AsByte() ?? (byte)FocusBehaviour.Normal);
            BlockFocusPosition  = (FocusPosition)(source[DefAgentFieldID.FocusPosition].AsByte() ?? (byte)FocusPosition.Free);

            MaximumNumberOfChildren = source[DefAgentFieldID.MaximumChildren].AsShort() ?? DefaultMaximumNumberOfChildren;

            InsertFromTheTop = !(source[DefAgentFieldID.FromBottom].AsBoolean() ?? false);

            BlockTickerSpeed = (TickerSpeed)(source[DefAgentFieldID.TickerSpeed].AsByte() ?? (byte)TickerSpeed.Medium);

            switch (BlockTickerSpeed)
            {
            case TickerSpeed.Slow:
                TicksPerUnit  = 1;
                PixelsPerUnit = 1;
                break;

            case TickerSpeed.Medium:
            default:
                TicksPerUnit  = 0;
                PixelsPerUnit = 1;
                break;

            case TickerSpeed.Fast:
                TicksPerUnit  = 0;
                PixelsPerUnit = 2;
                break;
            }

            TickerDirection = (TickerFlowDirection)(source[DefAgentFieldID.TickerDirection].AsByte() ?? (byte)TickerFlowDirection.Forwards);

            TickerItemPause tickerPauseSetting = (TickerItemPause)(source[DefAgentFieldID.PauseBetweenItem].AsByte() ?? (byte)TickerItemPause.None);

            switch (tickerPauseSetting)
            {
            case TickerItemPause.Long:
                TickerPauseTimeOnItem = 300;
                break;

            case TickerItemPause.Medium:
                TickerPauseTimeOnItem = 150;
                break;

            case TickerItemPause.Short:
                TickerPauseTimeOnItem = 50;
                break;

            case TickerItemPause.None:
            default:
                TickerPauseTimeOnItem = 0;
                break;
            }

            Paginate = source[DefAgentFieldID.UsePagination].AsBoolean() ?? false;

            // get list of striping palette references
            FieldList stripes = source[DefAgentFieldID.StripeStyles] as FieldList;

            if (stripes != null)
            {
                List <Int16Field> stripesData = source.GetItems <Int16Field>(DefAgentFieldID.PaletteEntryIndex);

                foreach (Int16Field field in stripesData)
                {
                    Stripes.Add(field.Data);
                }
            }

            IsFloating = source[DefAgentFieldID.FloatBehaviour].AsBoolean() ?? false;

            UnpackBlockHints(source);

            // done
            IsUnpacked = true;
        }
Esempio n. 4
0
        private void UnpackNode(FieldList source, string currentNodeURI, CacheItemID?ciid, long targetID, NodeTransition transition, bool isPopup)
        {
            NodeData data = new NodeData();

            data.ApplicationID       = currentApplicationID;
            data.ShouldGoToBackStack = !(source[NaviAgentFieldID.DoNotAddNodeToBackStack].AsBoolean() ?? false); //IMPLEMENT: back stack skipping

            // set node uri
            if (String.IsNullOrEmpty(currentNodeURI))
            {
                currentNodeURI = source[MessageOutFieldID.ItemURI].AsString();
            }

            data.URI = currentNodeURI;

            // set current node ciid
            if (!ciid.HasValue)
            {
                data.WasCached = false;

                byte   cacheHint = 0;
                byte[] ciidData  = source[MessageOutFieldID.CacheItemID].AsByteArray();

                if (ciidData != null)
                {
                    ciid      = new CacheItemID(ciidData);
                    cacheHint = source[MessageOutFieldID.CacheHint].AsByte() ?? 0;

                    data.WasCached = Core.Cache.ShouldCache(cacheHint);
                }
            }
            else
            {
                data.WasCached = true;
            }

            // unpack application id
            UnpackApplicationID(source, data);

            data.ID         = ciid;
            data.Transition = transition;
            data.IsPopup    = isPopup;

            // Update the system events
            ApplicationEvents = Core.Definitions.GetApplicationEvents(data.ApplicationID);

            data.Root = null;

            int definitionID = source[MessageOutFieldID.DefinitionID].AsInteger() ?? 0;

            data.Root        = Core.Definitions.Find(data.ApplicationID, definitionID) as BlockDefinition;
            data.RootContent = source;

            // unpack signpost names (if any)
            List <StringField> signpostNames = source.GetItems <StringField>(NaviAgentFieldID.SignpostName);

            if (signpostNames.Count > 0)
            {
                data.SignpostNames = new List <string>();

                foreach (StringField field in signpostNames)
                {
                    data.SignpostNames.Add(field.Data);
                }
            }

            Core.UI.SignalViewNavigationSuccess(targetID, data);
        }
Esempio n. 5
0
        public TableLayoutTemplate(FieldList source)
            : this()
        {
            Flow = (UIFlowDirection)(source[DefAgentFieldID.FlowDirection].AsByte() ?? 0);

            ColumnCount = source[DefAgentFieldID.NumberOfColumns].AsByte() ?? 0;
            RowCount    = source[DefAgentFieldID.NumberOfRows].AsByte() ?? 0;

            // relative sizes
            RelativeSizes = new short[ColumnCount];
            List <Int16Field> sizes = source.GetItems <Int16Field>(DefAgentFieldID.RelativeSize);

            for (int i = 0; i < sizes.Count; i++)
            {
                RelativeSizes[i] = sizes[i].Data;
            }

            // stretch weights
            StretchWeights = new short[RowCount];
            List <Int16Field> weights = source.GetItems <Int16Field>(DefAgentFieldID.StretchWeight);

            for (int i = 0; i < weights.Count; i++)
            {
                StretchWeights[i] = weights[i].Data;
            }

            // spacing
            Spacing = source[DefAgentFieldID.Spacing].AsShort() ?? 0;

            // layout items
            List <FieldList> layoutItems = source.GetItems <FieldList>(DefAgentFieldID.LayoutItem);

            foreach (FieldList item in layoutItems)
            {
                TableLayoutItemInfo li = new TableLayoutItemInfo();

                // compulsory bits
                li.SlotX    = item[DefAgentFieldID.XPosition].AsShort() ?? 0;
                li.SlotY    = item[DefAgentFieldID.YPosition].AsShort() ?? 0;
                li.SlotXEnd = (short)((item[DefAgentFieldID.Width].AsShort() ?? 0) + li.SlotX - 1);
                li.SlotYEnd = (short)((item[DefAgentFieldID.Height].AsShort() ?? 0) + li.SlotY - 1);

                li.CropStrategy = (CropStrategy)(item[DefAgentFieldID.CropStrategy].AsNumber() ?? 0);

                // optional bits
                li.LeftMargin   = item[DefAgentFieldID.LeftMargin2].AsShort() ?? 0;
                li.TopMargin    = item[DefAgentFieldID.TopMargin2].AsShort() ?? 0;
                li.RightMargin  = item[DefAgentFieldID.RightMargin].AsShort() ?? 0;
                li.BottomMargin = item[DefAgentFieldID.BottomMargin].AsShort() ?? 0;

                li.LeftPadding   = item[DefAgentFieldID.LeftPadding2].AsShort() ?? 0;
                li.TopPadding    = item[DefAgentFieldID.TopPadding2].AsShort() ?? 0;
                li.RightPadding  = item[DefAgentFieldID.RightPadding].AsShort() ?? 0;
                li.BottomPadding = item[DefAgentFieldID.BottomPadding].AsShort() ?? 0;

                li.MaximumChars = item[DefAgentFieldID.MaximumChars].AsShort() ?? 0;
                li.MaximumLines = item[DefAgentFieldID.MaximumLines].AsShort() ?? 0;
                li.MinimumLines = item[DefAgentFieldID.MinimumLines].AsShort() ?? 0;

                LayoutItems.Add(li);
            }
        }
Esempio n. 6
0
        public void Unpack(FieldList source)
        {
            if (source == null)
            {
                return;
            }

            UnpackDefinitionID(source);

            IsCheckable       = false;
            DeviceTextScaling = false;

            // unpacking common attributes
            SpecialTag            = source[DefAgentFieldID.DefinitionSpecialTag].AsInteger() ?? -1;
            BackgroundImageCrop   = (CropStrategy)(source[DefAgentFieldID.BackgroundCropStrategy].AsNumber() ?? 0);
            SizeToBackgroundImage = source[DefAgentFieldID.BlockSizeToBackground].AsBoolean() ?? false;
            AcceptsFocus          = source[DefAgentFieldID.AcceptsFocus].AsBoolean() ?? false;
            SortIndex             = source[DefAgentFieldID.SortSlotIndex].AsShort() ?? -1;

            // static display data
            int numberOfDisplayData = source.GetItemCount(MessageOutFieldID.SlotDisplayDataTypeID);

            if (numberOfDisplayData > 0)
            {
                StaticDisplayData = DisplayData.Parse(source);
            }

            // loop through states
            PairedList <ByteField, FieldList> states =
                source.GetPairedItems <ByteField, FieldList>(DefAgentFieldID.ComponentState, DefAgentFieldID.DataPerComponentState);

            foreach (Pair <ByteField, FieldList> item in states)
            {
                BlockState state   = (BlockState)item.First.Data;
                FieldList  newData = item.Second;

                AtomicBlockStateData data = GetOrCreateDataForState(state);

                // mark as checkable if applicable
                if ((state == BlockState.CheckedNormal) || (state == BlockState.CheckedFocused))
                {
                    IsCheckable = true;
                }

                // set paint styles
                data.ComponentForeground = new PaintStyle(newData, DefAgentFieldID.ForegroundPaintStyle);
                data.ComponentBackground = new PaintStyle(newData, DefAgentFieldID.BackgroundPaintStyle);

                // font reference
                data.ComponentFont = newData[DefAgentFieldID.FontReference].AsShort() ?? 0;

                // margins and paddings
                data.MarginLeft    = newData[DefAgentFieldID.LeftMargin2].AsShort() ?? 0;
                data.MarginTop     = newData[DefAgentFieldID.TopMargin2].AsShort() ?? 0;
                data.MarginRight   = newData[DefAgentFieldID.RightMargin].AsShort() ?? 0;
                data.MarginBottom  = newData[DefAgentFieldID.BottomMargin].AsShort() ?? 0;
                data.PaddingLeft   = newData[DefAgentFieldID.LeftPadding2].AsShort() ?? 0;
                data.PaddingTop    = newData[DefAgentFieldID.TopPadding2].AsShort() ?? 0;
                data.PaddingRight  = newData[DefAgentFieldID.RightPadding].AsShort() ?? 0;
                data.PaddingBottom = newData[DefAgentFieldID.BottomPadding].AsShort() ?? 0;

                // slot data
                List <FieldList> slotsData = newData.GetItems <FieldList>(DefAgentFieldID.SlotData);

                foreach (FieldList sd in slotsData)
                {
                    SlotData info = new SlotData();

                    info.Foreground = new PaintStyle(sd, DefAgentFieldID.ForegroundPaintStyle);
                    info.Background = new PaintStyle(sd, DefAgentFieldID.BackgroundPaintStyle);
                    info.Font       = sd[DefAgentFieldID.FontReference].AsShort() ?? 0;
                    info.SlotIndex  = sd[DefAgentFieldID.SlotIndex].AsShort() ?? 0;

                    // rendering hints
                    if ((SlotHints == null) || (SlotHints.Length <= info.SlotIndex) || (SlotHints[(int)info.SlotIndex] == null))
                    {
                        string newSlotHint = sd[DefAgentFieldID.SlotHint].AsString();

                        if (newSlotHint != null)
                        {
                            if (SlotHints == null)
                            {
                                SlotHints = new string[Math.Max(slotsData.Count, (int)(info.SlotIndex + 1))];
                            }
                            else if (SlotHints.Length <= info.SlotIndex)
                            {
                                Array.Resize <string>(ref SlotHints, Math.Max(slotsData.Count, (int)(info.SlotIndex + 1)));
                            }

                            SlotHints[(int)info.SlotIndex] = newSlotHint;
                        }
                    }

                    data.SlotInfo.Add(info);
                }

                // unpack layout
                LayoutType layoutType = (LayoutType)(newData[DefAgentFieldID.LayoutType].AsByte() ?? 0);

                if (layoutType == LayoutType.Table)
                {
                    // currently only table layout is supported for atomic blocks
                    data.LayoutTemplate = new TableLayoutTemplate(newData);
                }

                stateData.Add(state, data);
            }

            // rendering hints for the block
            UnpackBlockHints(source);

            // done
            IsUnpacked = true;
        }
Esempio n. 7
0
        public void Unpack(FieldList source)
        {
            // set id (saving this as a definition ID for now)
            DefinitionID = source[NaviAgentFieldID.ActionSetID].AsInteger() ?? -1;

            // saving anchors
            List <ByteField> anchorData = source.GetItems <ByteField>(NaviAgentFieldID.AnchorID);

            if (anchorData.Count > 0)
            {
                // add available anchors
                foreach (ByteField field in anchorData)
                {
                    Anchors.Add((Anchor)field.Data);
                }
            }
            else
            {
                // add default anchor ("fire")
                Anchors.Add(Anchor.Fire);
            }

            // save action label
            Label = source[NaviAgentFieldID.ActionSetLabel].AsString();

            // adding actions
            FieldListNavigator nav = new FieldListNavigator(source);

            while (1 == 1)
            {
                ActionBase action   = null;
                byte       actionID = 0;

                if (nav.FindNext(NaviAgentFieldID.ActionRef))
                {
                    actionID = nav.Current.AsByte() ?? 0;
                }

                if (!nav.FindNext(NaviAgentFieldID.ActionTypeID))
                {
                    break;
                }

                ActionType actionType = (ActionType)(nav.Current.AsInteger() ?? (int)ActionType.Invalid);

                switch (actionType)
                {
                    #region Navigation

                case ActionType.GotoNodeVolatile:
                    break;

                case ActionType.GotoNodeStable:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string         uri        = Core.Navigation.CheckURI(nav.Current.AsString());
                    NodeTransition transition = NodeTransition.None;
                    bool           isPopup    = false;

                    if (nav.FindNext(NaviAgentFieldID.ActionPayload))
                    {
                        transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                        if (nav.FindNext(NaviAgentFieldID.ActionPopUp))
                        {
                            isPopup = nav.Current.AsBoolean() ?? false;
                        }
                    }

                    action = new GotoNodeStableAction(actionID, uri, transition, isPopup);
                    break;
                }

                case ActionType.GotoNodeStableSSP:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    short signpost = nav.Current.AsShort() ?? -1;

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    NodeTransition transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                    nav.FindNext(NaviAgentFieldID.ActionPopUp);
                    bool isPopup = nav.Current.AsBoolean() ?? false;

                    action = new GotoNodeStableSSPAction(actionID, signpost, transition, isPopup);
                    break;
                }

                case ActionType.GotoNodeInFrame:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string uri = Core.Navigation.CheckURI(nav.Current.AsString());

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    NodeTransition transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                    nav.FindNext(NaviAgentFieldID.ActionPopUp);
                    bool isPopup = nav.Current.AsBoolean() ?? false;

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string frameID = nav.Current.AsString();

                    action = new GotoNodeInFrameAction(actionID, uri, frameID, transition, isPopup);
                    break;
                }

                case ActionType.GotoBack:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    NodeTransition transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                    action = new GotoBackAction(actionID, transition);
                    break;
                }

                case ActionType.GotoApplicationHome:
                {
                    nav.FindNext(NaviAgentFieldID.ApplicationURN);
                    string uri = nav.Current.AsText();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    NodeTransition transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                    nav.FindNext(NaviAgentFieldID.ActionPopUp);
                    bool isPopup = nav.Current.AsBoolean() ?? false;

                    action = new GotoApplicationHomeAction(actionID, uri, transition, isPopup);
                    break;
                }

                case ActionType.GotoApplicationNode:
                {
                    string urn = null, uri = null;

                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    FieldList fl = nav.Current as FieldList;

                    if (fl != null)
                    {
                        urn = fl[NaviAgentFieldID.ApplicationURN].AsText();
                        uri = fl[MessageOutFieldID.ItemURI].AsText();
                    }

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    NodeTransition transition = (NodeTransition)(nav.Current.AsInteger() ?? (int)NodeTransition.None);

                    nav.FindNext(NaviAgentFieldID.ActionPopUp);
                    bool isPopup = nav.Current.AsBoolean() ?? false;

                    action = new GotoApplicationNodeAction(actionID, urn, uri, transition, isPopup);
                    break;
                }

                case ActionType.Refresh:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string frameID = nav.Current.AsString();

                    if (!String.IsNullOrEmpty(frameID))
                    {
                        action = new RefreshAction(actionID, frameID);
                    }
                    break;
                }

                case ActionType.ClearBackStack:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string frameID = nav.Current.AsString();

                    if (!String.IsNullOrEmpty(frameID))
                    {
                        action = new ClearBackstackAction(actionID, frameID);
                    }
                    break;
                }

                    #endregion

                    #region Media playback and control

                case ActionType.PlayMedia:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    action = new PlayMediaAction(actionID, nav.Current.AsString());
                    break;
                }

                case ActionType.PlayMediaSSP:
                    goto default;

                case ActionType.PlayMediaWithAd:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string mediaCRef = nav.Current.AsString();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string adCRef = nav.Current.AsString();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    int delay = nav.Current.AsInteger() ?? 0;

                    action = new PlayMediaWithAdAction(actionID, mediaCRef, adCRef, delay);
                    break;
                }

                case ActionType.StopMedia:
                case ActionType.FullScreenVideo:
                case ActionType.MediaListPlayMedia:
                    goto default;

                    #endregion

                    #region Slot content

                case ActionType.SetSlotContent:
                {
                    Signpost sp = new Signpost(nav);

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    FieldList fl = nav.Current.AsFieldList();

                    if (fl != null)
                    {
                        DisplayDataCollection dc = DisplayData.Parse(fl);

                        if (dc.Count > 0)
                        {
                            action = new SetSlotContentAction(actionID, sp, dc[0]);
                        }
                    }

                    break;
                }

                case ActionType.SetSlotContentSSP:
                case ActionType.PrefetchContent:
                    goto default;

                    #endregion

                    #region Forms

                case ActionType.SubmitForm:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    FieldList fl = nav.Current as FieldList;

                    if (fl != null)
                    {
                        int            formID      = fl[NaviAgentFieldID.FormID].AsInteger() ?? -1;
                        string         formURL     = fl[NaviAgentFieldID.FormRequestURL].AsString();
                        NodeTransition transition  = (NodeTransition)(fl[NaviAgentFieldID.FormTransition].AsInteger() ?? (int)NodeTransition.None);
                        bool           waitForNode = fl[NaviAgentFieldID.FormRequiresNoWait].AsBoolean() ?? true;
                        bool           popUp       = fl[NaviAgentFieldID.ActionPopUp].AsBoolean() ?? false;

                        action = new SubmitFormAction(actionID, formID, formURL, transition, waitForNode, popUp);
                    }

                    break;
                }

                case ActionType.SubmitFormToFrame:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    FieldList fl = nav.Current as FieldList;

                    if (fl != null)
                    {
                        string         frameID    = fl[NaviAgentFieldID.FrameID].AsString();
                        int            formID     = fl[NaviAgentFieldID.FormID].AsInteger() ?? -1;
                        string         formURL    = fl[NaviAgentFieldID.FormRequestURL].AsString();
                        NodeTransition transition = (NodeTransition)(fl[NaviAgentFieldID.FormTransition].AsInteger() ?? (int)NodeTransition.None);
                        bool           popUp      = fl[NaviAgentFieldID.ActionPopUp].AsBoolean() ?? false;

                        action = new SubmitFormToFrameAction(actionID, frameID, formID, formURL, transition, popUp);
                    }

                    break;
                }

                case ActionType.UploadContentAndSubmitForm:
                    goto default;

                    #endregion

                    #region Visibility

                case ActionType.SetVisibility:
                {
                    Signpost sn = new Signpost(nav);

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    bool isVisible = nav.Current.AsBoolean() ?? true;

                    action = new SetVisibilityAction(actionID, sn, isVisible);
                    break;
                }

                case ActionType.ToggleVisibility:
                {
                    action = new ToggleVisibilityAction(actionID, new Signpost(nav));
                    break;
                }

                    #endregion

                    #region Data channels

                case ActionType.SubscribeToDataChannel:
                case ActionType.SubscribeToDataChannelSSP:
                case ActionType.UnsubscribeFromChannel:
                case ActionType.ApplyFilterToDataChannel:
                    goto default;

                    #endregion

                    #region Downloads

                case ActionType.StartBackgroundDownload:
                case ActionType.StopBackgroundDownload:
                case ActionType.BackgroundDownloadWithEndNode:
                case ActionType.BackgroundHTTPRequest:
                    goto default;

                    #endregion

                    #region Telephony

                case ActionType.TelephonySendSMSWithMessage:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string phoneNumber = nav.Current.AsText();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string message = nav.Current.AsText();

                    if (!String.IsNullOrEmpty(phoneNumber) && !String.IsNullOrEmpty(message))
                    {
                        action = new TelephonySendSMSWithMessageAction(actionID, phoneNumber, message);
                    }

                    break;
                }

                case ActionType.TelephonyMakeCall:
                    goto default;

                case ActionType.TelephonySendSMSSSP:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    FieldList fld = nav.Current as FieldList;

                    if ((fld != null) && (fld.Count >= 2))
                    {
                        short?signpost1 = fld[0].AsShort();
                        short?signpost2 = fld[1].AsShort();

                        if (signpost1.HasValue && signpost2.HasValue)
                        {
                            action = new TelephonySendSMSSSPAction(actionID, signpost1.Value, signpost2.Value);
                        }
                    }

                    break;
                }

                    #endregion

                    #region E-mail

                case ActionType.SendEmail:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string to = nav.Current.AsText();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string subject = nav.Current.AsText();

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string body = nav.Current.AsText();

                    if (!String.IsNullOrEmpty(to) && !String.IsNullOrEmpty(subject) && (body != null))
                    {
                        action = new SendMailAction(actionID, to, subject, body);
                    }

                    break;
                }

                case ActionType.SendEmailSSP:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    int toSignpost = nav.Current.AsNumber() ?? Signpost.Invalid;

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    int subjectSignpost = nav.Current.AsNumber() ?? Signpost.Invalid;

                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    int bodySignpost = nav.Current.AsNumber() ?? Signpost.Invalid;

                    if ((toSignpost != Signpost.Invalid) && (subjectSignpost != Signpost.Invalid) && (bodySignpost != Signpost.Invalid))
                    {
                        action = new SendMailSSPAction(actionID, toSignpost, subjectSignpost, bodySignpost);
                    }

                    break;
                }

                    #endregion

                    #region Browser

                case ActionType.ConnectOpenBrowser:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string url = nav.Current.AsText();

                    if (!String.IsNullOrEmpty(url))
                    {
                        action = new OpenBrowserAction(actionID, url);
                    }

                    break;
                }

                case ActionType.OpenEmbeddedBrowser:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string url = nav.Current.AsText();

                    if (!String.IsNullOrEmpty(url))
                    {
                        action = new OpenBrowserEmbeddedAction(actionID, url);
                    }

                    break;
                }

                    #endregion

                    #region Contacts

                case ActionType.GetContact:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    short signpost = (short)(nav.Current.AsNumber() ?? -1);

                    if (signpost >= 0)
                    {
                        action = new GetContactAction(actionID, signpost);
                    }

                    break;
                }

                case ActionType.GetContactNoThumbnail:
                    break;

                case ActionType.SetContact:
                case ActionType.GetAllContacts:
                    goto default;

                    #endregion

                    #region Mapping and location sharing

                case ActionType.ToggleMapPin:
                case ActionType.SetMapPin:
                case ActionType.ShowMap:
                    goto default;

                case ActionType.SetLocationSharing:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    action = new SetLocationSharingAction(actionID, nav.Current.AsBoolean() ?? false);
                    break;
                }

                    #endregion

                    #region Social

                case ActionType.PublishOnOnlineCommunity:
                {
                    // social network ID
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    SocialNetwork target = (SocialNetwork)(nav.Current.AsNumber() ?? (int)SocialNetwork.Unknown);

                    // message
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    string messageData = nav.Current.AsString();

                    if (messageData != null)
                    {
                        action = new PublishOnSocialNetworkAction(actionID, target, messageData);
                    }

                    break;
                }

                case ActionType.PublishOnOnlineCommunitySSP:
                {
                    // social network ID signpost
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    SocialNetwork target = (SocialNetwork)(nav.Current.AsNumber() ?? (int)SocialNetwork.Unknown);

                    // message signpost
                    nav.FindNext(NaviAgentFieldID.ActionPayload);
                    int messageSignpost = nav.Current.AsNumber() ?? Signpost.Invalid;

                    if (messageSignpost != Signpost.Invalid)
                    {
                        action = new PublishOnSocialNetworkSSPAction(actionID, target, messageSignpost);
                    }

                    break;
                }

                    #endregion

                    #region Get media

                case ActionType.GetPhotoFromCamera:
                case ActionType.GetPhotoFromFile:
                case ActionType.GetVideoFromCamera:
                case ActionType.GetVideoFromFile:
                case ActionType.GetAudioFromRecorder:
                case ActionType.GetAudioFromFile:
                    goto default;

                    #endregion

                    #region Vectors

                case ActionType.VectorSetAllObjectState:
                case ActionType.VectorSetObjectState:
                case ActionType.VectorSetAllObjectStateSSP:
                case ActionType.VectorSetObjectStateSSP:
                    goto default;

                    #endregion

                    #region EPG

                case ActionType.EPGViewportUp:
                case ActionType.EPGViewportDown:
                case ActionType.EPGViewportForward:
                case ActionType.EPGViewportBackward:
                case ActionType.EPGViewportForward24Hours:
                case ActionType.EPGViewportBackward24Hours:
                case ActionType.EPGViewportGotoChannel:
                case ActionType.EPGSubmitForm:
                case ActionType.EPGSetSlotContent:
                case ActionType.EPGPlayMedia:
                case ActionType.EPGSendSMS:
                    DebugHelper.Out("EPG functionality is not supported.");
                    break;

                    #endregion

                    #region UI

                case ActionType.IncreaseFontSize:
                case ActionType.DecreaseFontSize:
                    goto default;

                    #endregion

                    #region State management

                case ActionType.SetStateSSP:
                case ActionType.ToggleStateSSP:
                    goto default;

                    #endregion

                    #region Application

                case ActionType.Quit:
                    action = new QuitAction(actionID);
                    break;

                case ActionType.SaveApplicationToFavourites:
                case ActionType.WaveSendAuditEvent:
                case ActionType.SendCredentials:
                case ActionType.ToggleBacklight:
                case ActionType.ToggleInactivityTimer:
                    goto default;

                    #endregion

                    #region Custom

                case ActionType.Custom:
                {
                    nav.FindNext(NaviAgentFieldID.ActionPayload);

                    FieldList fl = nav.Current as FieldList;

                    if (fl != null)
                    {
                        List <string> strings = new List <string>();

                        foreach (IFieldBase field in fl)
                        {
                            if (field is StringField)
                            {
                                strings.Add(field.AsString());
                            }
                        }

                        action = new CustomAction(actionID, strings);
                    }

                    break;
                }

                    #endregion

                default:
                    DebugHelper.Out("Unsupported action type: {0}", actionType);
                    break;
                }

                if (action != null)
                {
                    Actions.Add(action);
                }
            }

            // done!
            IsUnpacked = true;
        }