示例#1
0
        private void ProcessHintDataPair(string rh, DisplayData dd)
        {
            if (!String.IsNullOrEmpty(rh) && (dd != null))
            {
                HintsDictionary hints = new HintsDictionary();
                hints.Parse(rh);

                if (hints.ValueEquals(HintsDictionary.OfType, RenderingHint.NativeMessageBoxTitle) && (dd.DisplayType == DisplayType.String))
                {
                    Title = (string)dd.Data;
                }
                else if (hints.ValueEquals(HintsDictionary.OfType, RenderingHint.NativeMessageBoxMessage) && (dd.DisplayType == DisplayType.String))
                {
                    Message = (string)dd.Data;
                }
            }
        }
示例#2
0
        private void ProcessHintDataPair(string rh, DisplayData dd)
        {
            if (!String.IsNullOrEmpty(rh) && (dd != null))
            {
                HintsDictionary hints = new HintsDictionary();
                hints.Parse(rh);

                if (hints.ValueEquals(HintsDictionary.OfType, RenderingHint.ApplicationBarButtonIcon))
                {
                    if (dd.DisplayType == DisplayType.String)
                    {
                        string tempPath = dd.Data as string;

                        if (!String.IsNullOrWhiteSpace(tempPath))
                        {
                            Icon = new Uri(String.Concat(SettingsAgent.ResidentIconsPath, tempPath), UriKind.Relative);
                        }
                    }
                    else if (dd.DisplayType == DisplayType.ContentReference)
                    {
                        ContentReference cref = dd.Data as ContentReference;

                        if ((cref != null) && (cref.MediaType == MediaPrimitiveType.Image) && (cref.Delivery == MediaDelivery.ResidentOnHandset))
                        {
                            string tempPath = Core.Settings.ResolveResidentMedia(cref.FileName, cref.DeviceGroup);

                            if (!String.IsNullOrWhiteSpace(tempPath))
                            {
                                Icon = new Uri(tempPath, UriKind.Relative);
                            }
                        }
                    }
                }
                else if (hints.ValueEquals(HintsDictionary.OfType, RenderingHint.ApplicationBarButtonText))
                {
                    if (dd.DisplayType == DisplayType.String)
                    {
                        Text = (string)dd.Data;
                    }
                }
            }
        }
        public ApplicationBarMenuItemBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot)
            : base(hostView, parentNode, parentBlock, definition, content, isRoot)
        {
            Text = String.Empty;

            // parse server display data
            serverDisplayData = DisplayData.Parse(content);

            // extract text
            if ((serverDisplayData.Count > 0) && (Data.SlotHints.Length > 0) &&
                !String.IsNullOrEmpty(Data.SlotHints[0]) && (serverDisplayData[0] != null) &&
                (serverDisplayData[0].DisplayType == DisplayType.String))
            {
                HintsDictionary hints = new HintsDictionary();
                hints.Parse(Data.SlotHints[0]);

                if (hints.ValueEquals(HintsDictionary.OfType, RenderingHint.ApplicationBarMenuItemText))
                {
                    Text = (string)serverDisplayData[0].Data;
                }
            }
        }