public NativeMessageBoxButtonBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { Caption = String.Empty; // parse server display data serverDisplayData = DisplayData.Parse(content); // extract button caption if ((serverDisplayData.Count > 0) && (serverDisplayData[0].DisplayType == DisplayType.String)) { Caption = (string)serverDisplayData[0].Data; } }
public SingleSlotBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { if (Data != null) { // remember state availability hasNormalState = Data.HasState(BlockState.Normal); hasCheckedNormalState = Data.HasState(BlockState.CheckedNormal); hasFocusedState = Data.HasState(BlockState.Focused); hasCheckedFocusedState = Data.HasState(BlockState.CheckedFocused); } UnpackContent(); }
public MapPluginBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { data = Definition as MapPluginBlockDefinition; // creating map control map = new Map(); map.CredentialsProvider = new ApplicationIdCredentialsProvider(BingAppID); Children.Add(map); if (data != null) { map.AnimationLevel = data.IsAnimationEnabled ? AnimationLevel.Full : AnimationLevel.None; switch (data.Mode) { default: case WaveMapMode.Standard: map.Mode = new RoadMode(); break; case WaveMapMode.Satellite: map.Mode = new AerialMode(false); break; case WaveMapMode.Hybrid: map.Mode = new AerialMode(true); break; } } if (Content != null) { int latitude = Content[DefAgentFieldID.MapLatitude].AsNumber() ?? -1; int longitude = Content[DefAgentFieldID.MapLongitude].AsNumber() ?? -1; if ((latitude != -1) && (longitude != -1)) { map.Center = new GeoCoordinate( (double)latitude / (double)LocationObserver.DegreesToMicrodegrees, (double)longitude / (double)LocationObserver.DegreesToMicrodegrees); } map.ZoomLevel = 15; //HACK } }
public override void SignalFocus(BlockBase block) { base.SignalFocus(block); foreach (BlockBase child in WaveChildren) { if (child != block) { child.SetState(false, child.IsChecked); } } if (ParentBlock != null) { ParentBlock.SignalFocus(this); } }
public ListBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { wrapper = new ScrollViewer(); wrapper.BorderThickness = new Thickness(0); if (Data != null) { panel = new ListLayoutPanel(Data, this, wrapper); wrapper.Content = panel; } Children.Add(wrapper); UnpackDefinition(); UnpackContent(); }
private void UnpackContent() { // creating children List <FieldList> children = Content.GetItems <FieldList>(NaviAgentFieldID.BlockData); for (int i = 0; i < children.Count; i++) { int childDefinitionID = children[i][MessageOutFieldID.DefinitionID].AsInteger() ?? 0; DefinitionBase definition = Core.Definitions.Find(ParentNode.ApplicationID, childDefinitionID, true); if ((definition != null) && (definition is BlockDefinition)) { BlockBase newBlock = Core.UIFactory.CreateAndInitialiseBlock(Host, ParentNode, this, definition as BlockDefinition, children[i], false); if (newBlock != null) { if (newBlock is ApplicationBarButtonBlock) { buttons.Add((ApplicationBarButtonBlock)newBlock); } else if (newBlock is ApplicationBarMenuItemBlock) { menuItems.Add((ApplicationBarMenuItemBlock)newBlock); } else if (newBlock is ApplicationBarOptionsBlock) { ApplicationBarOptionsBlock colours = newBlock as ApplicationBarOptionsBlock; if (colours != null) { if (colours.ForegroundColour.HasValue) { foreground = colours.ForegroundColour.Value; } if (colours.BackgroundColour.HasValue) { background = colours.BackgroundColour.Value; } } } } } } }
private void UnpackContent() { //m_nChildInFocus = m_oDefinition.m_nFirstFocus; // unpack palettes List <Int32Field> paletteIDs = Content.GetItems <Int32Field>(NaviAgentFieldID.PaletteID); if (paletteIDs.Count > 0) { // application palette if (ParentNode != null) { ParentNode.ApplicationPalette = Core.Definitions.Find(ParentNode.ApplicationID, paletteIDs[0].Data) as PaletteDefinition; } // other palette(s) if (paletteIDs.Count > 1) { for (int i = 1; i < paletteIDs.Count; i++) { Palette = Core.Definitions.Find(ParentNode.ApplicationID, paletteIDs[i].Data) as PaletteDefinition; } } } // unpack children List <FieldList> children = Content.GetItems <FieldList>(NaviAgentFieldID.BlockData); foreach (FieldList childData in children) { int childDefinitionID = childData[MessageOutFieldID.DefinitionID].AsInteger() ?? 0; DefinitionBase definition = Core.Definitions.Find(ParentNode.ApplicationID, childDefinitionID, true); if ((definition != null) && (definition is BlockDefinition)) { BlockBase newBlock = Core.UIFactory.CreateAndInitialiseBlock(Host, ParentNode, this, definition as BlockDefinition, childData, false); if (newBlock != null) { AddChildBlock(newBlock); } } } }
public ApplicationBarButtonBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { Text = String.Empty; Icon = null; // parse server display data serverDisplayData = DisplayData.Parse(content); // extract text and icon if ((serverDisplayData.Count > 0) && (Data.SlotHints.Length > 0)) { ProcessHintDataPair(Data.SlotHints[0], serverDisplayData[0]); } if ((serverDisplayData.Count > 1) && (Data.SlotHints.Length > 1)) { ProcessHintDataPair(Data.SlotHints[1], serverDisplayData[1]); } }
public AtomicBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { // definition if (Data != null) { // register static display data Core.UI.ReferencedContent.Add(Data.StaticDisplayData); ParentNode.Register(Data.StaticDisplayData); // remember state availability hasNormalState = Data.HasState(BlockState.Normal); hasCheckedNormalState = Data.HasState(BlockState.CheckedNormal); hasFocusedState = Data.HasState(BlockState.Focused); hasCheckedFocusedState = Data.HasState(BlockState.CheckedFocused); } // content UnpackContent(); }
private void UnpackContent() { // creating children List <FieldList> children = Content.GetItems <FieldList>(NaviAgentFieldID.BlockData); for (int i = 0; i < children.Count; i++) { int childDefinitionID = children[i][MessageOutFieldID.DefinitionID].AsInteger() ?? 0; DefinitionBase definition = Core.Definitions.Find(ParentNode.ApplicationID, childDefinitionID, true); if ((definition != null) && (definition is BlockDefinition)) { BlockBase newBlock = Core.UIFactory.CreateAndInitialiseBlock(Host, ParentNode, this, definition as BlockDefinition, children[i], false); if ((newBlock != null) && (newBlock is TabBarButtonBlock)) { buttons.Add((TabBarButtonBlock)newBlock); } } } }
public override void SignalTap(BlockBase block) { base.SignalTap(block); bool changeFocus = (block.CanFocus && !block.IsFocused); bool changeCheck = (block.CanCheck && !block.IsChecked); bool doRadio = (ContainerDefinition != null) ? ContainerDefinition.EnforceRadioBehaviour : false; checkedChild = null; if (changeFocus || changeCheck) { foreach (BlockBase child in WaveChildren) { if (child == block) { child.SetState( changeFocus ? true : child.IsFocused, changeCheck ? true : child.IsChecked); } else { child.SetState( changeFocus ? false : child.IsFocused, changeCheck && doRadio ? false : child.IsChecked); } if (child.IsChecked) { checkedChild = child; } } if (ParentBlock != null) { ParentBlock.SignalFocus(this); } } }
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; } } }
public void Initialise(NodeData source) { // save node data for the future use data = source; // try to create node contents if ((data != null) && (data.Root != null)) { BlockBase block = Core.UIFactory.CreateAndInitialiseBlock(parentView, this, null, data.Root, data.RootContent, true); if (block != null) { // always fill entire area of the node with root element block.HorizontalAlignment = HorizontalAlignment.Stretch; block.VerticalAlignment = VerticalAlignment.Stretch; // show block Content = block; } } // we are done if (RootBlock != null) { // check for native alerts to be triggered on node load and add trigger if it is not there if ((NativeMessageBox != null) && !NativeMessageBox.IntendedForCustomAction && !RootBlock.HasCustomAction(Anchor.OnNodeLoaded, CustomActions.NativeMessageBox)) { RootBlock.AddAction( Anchor.OnNodeLoaded, new CustomAction(ActionSet.DefaultActionID, new string[] { CustomActions.NativeMessageBox })); } // root block may need a special setup RootBlock.SignalIsRoot(); // schedule launch for OnNodeLoaded actions ThreadHelper.Sync(() => RootBlock.FireAction(Anchor.OnNodeLoaded)); } }
public NativeMessageBoxBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { IntendedForCustomAction = false; // check for custom notification parameters if (ContainerDefinition != null) { string notify = ContainerDefinition.RenderingHints["notification"]; switch (notify) { case "none": icon = MessageBoxIcon.None; break; case "alert": icon = MessageBoxIcon.Alert; break; case "error": icon = MessageBoxIcon.Error; break; case "warning": icon = MessageBoxIcon.Warning; break; } IntendedForCustomAction = ContainerDefinition.RenderingHints["show"].Equals("onAction", StringComparison.InvariantCultureIgnoreCase); } // unpack children UnpackContent(); // register with the parent ParentNode.NativeMessageBox = this; }
public TabBarButtonBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { Text = String.Empty; Icon = null; // parse server display data serverDisplayData = DisplayData.Parse(content); // extract text and icon AtomicBlockDefinition data = Definition as AtomicBlockDefinition; if (data != null) { for (int i = 0; i < serverDisplayData.Count; i++) { if (data.SlotHints.Length > i) { ProcessHintDataPair(data.SlotHints[i], serverDisplayData[i]); } } } }
public override void SignalTapAndHold(BlockBase block) { base.SignalTapAndHold(block); if (block.CanFocus && !block.IsFocused) { foreach (BlockBase child in WaveChildren) { if (child == block) { child.SetState(true, child.IsChecked); } else { child.SetState(false, child.IsChecked); } } if (ParentBlock != null) { ParentBlock.SignalFocus(this); } } }
public virtual void SignalFocus(BlockBase block) { }
public PlaceholderBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { UnpackContent(); }
private void UnpackContent() { // creating children List <FieldList> children = Content.GetItems <FieldList>(NaviAgentFieldID.BlockData); AtomicBlock title = null; List <AtomicBlock> itemTitles = new List <AtomicBlock>(); List <FrameBlock> items = new List <FrameBlock>(); for (int i = 0; i < children.Count; i++) { int childDefinitionID = children[i][MessageOutFieldID.DefinitionID].AsInteger() ?? 0; DefinitionBase definition = Core.Definitions.Find(ParentNode.ApplicationID, childDefinitionID, true); if ((definition != null) && (definition is BlockDefinition)) { BlockBase newBlock = Core.UIFactory.CreateAndInitialiseBlock(Host, ParentNode, this, definition as BlockDefinition, children[i], false); if (newBlock != null) { if (newBlock is AtomicBlock) { if (((BlockDefinition)definition).HintedType == UIHintedType.PanoramaTitle) { title = (AtomicBlock)newBlock; } else { itemTitles.Add((AtomicBlock)newBlock); } } else if (newBlock is FrameBlock) { items.Add((FrameBlock)newBlock); } } } } if ((title != null) && !String.IsNullOrWhiteSpace(title.Caption) && (itemTitles.Count > 0) && (items.Count > 0) && (itemTitles.Count == items.Count)) { panorama = new Panorama(); panorama.Title = title.Caption; for (int i = 0; i < items.Count; i++) { PanoramaItem item = new PanoramaItem(); item.Header = !String.IsNullOrWhiteSpace(itemTitles[i].Caption) ? itemTitles[i].Caption : WaveConstant.UnknownText; item.Content = items[i]; panorama.Items.Add(item); } if ((ContainerDefinition != null) && ContainerDefinition.Background.HasValue) { PaintStyleResult bgRes = ResolvePaintStyle(ContainerDefinition.Background.Value); if (bgRes.Brush != null) { panorama.Background = bgRes.Brush; } } Children.Add(panorama); for (int i = 0; i < items.Count; i++) { WaveChildren.Add(items[i]); } } }
public virtual void SignalTap(BlockBase block) { }
public virtual void SignalTapAndHold(BlockBase block) { }
public virtual void AddChildBlock(BlockBase childBlock) { WaveChildren.Add(childBlock); AddSynchronisedBlock(childBlock); }
protected override void AddSynchronisedBlock(BlockBase childBlock) { panel.Children.Add(childBlock); }
protected virtual void AddSynchronisedBlock(BlockBase childBlock) { Children.Add(childBlock); }
public GridBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { }
public ScrollingTextBlock(View hostView, Node parentNode, BlockBase parentBlock, BlockDefinition definition, FieldList content, bool isRoot) : base(hostView, parentNode, parentBlock, definition, content, isRoot) { Caption = String.Empty; // parse content if (Content != null) { DisplayDataCollection ddc = DisplayData.Parse(Content); if ((ddc != null) && (ddc.Count > 0) && (ddc[0].DisplayType == DisplayType.String)) { Caption = (string)ddc[0].Data; } } // creating controls panel = new StackPanel(); panel.Orientation = Orientation.Vertical; wrapper = new ScrollViewer(); wrapper.Content = panel; // apply definition Brush fg = null; FontDefinition fd = null; if (Data != null) { // background if (Data.Background.HasValue) { PaintStyleResult bgRes = ResolvePaintStyle(Data.Background.Value); if (bgRes.Brush != null) { Background = bgRes.Brush; } } // foreground if (Data.Foreground.HasValue) { PaintStyleResult fgRes = ResolvePaintStyle(Data.Foreground.Value); fg = fgRes.Brush; } // apply font if (Data.Font.HasValue && (Data.Font.Value != -1)) { FontReferencePaletteEntry fr = FindCascadedPaletteItem(Data.Font.Value) as FontReferencePaletteEntry; if (fr != null) { fd = fr.Resolve(ParentNode.ApplicationID); } } // padding for text panel.Margin = new Thickness(DefaultPadding); } // apply text string[] parts = Caption.Split('\n'); foreach (string part in parts) { TextBlock paragraph = new TextBlock(); if (fg != null) { paragraph.Foreground = fg; } if (fd != null) { fd.Apply(paragraph); } paragraph.TextWrapping = TextWrapping.Wrap; if (!String.IsNullOrEmpty(part)) { paragraph.Text = part; } else { paragraph.Text = " "; } panel.Children.Add(paragraph); } // display text Children.Add(wrapper); }