public NodesEventArgs(string eventType, INodeProxy contextNode, Guid[] nodeIds) : this() { EventType = eventType; ContextNode = contextNode; NodeIds = nodeIds; }
public NodesEventArgs(string eventType, Guid contextNodeId, INodeProxy[] nodes) : this() { EventType = eventType; ContextNodeId = contextNodeId; Nodes = nodes; }
private string GetMapNodeChildCount(INodeProxy nodeProxy) { int count = 0; if (nodeProxy != null) { foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name == "MapContainerRelationship") { count++; } } List <Guid> transcludedNodes = new List <Guid>(); foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { foreach (IDescriptorProxy transDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (!transcludedNodes.Contains(transDesc.NodeId) && transDesc.Node != null) { transcludedNodes.Add(transDesc.NodeId); count++; } } } } return(count.ToString()); }
public NodeControl RenderSkinElements(INodeProxy node, string skinName, Dictionary <string, object> skinProperties) { NodeControl nodeElement = null; try { nodeElement = new NodeControl(); nodeElement.DataContext = node; foreach (string propertyName in skinProperties.Keys) { PropertyInfo propInfo = nodeElement.GetType().GetProperty(propertyName); Type propertyType = propInfo.PropertyType; if (propertyType != typeof(string)) { TypeConverter converter = GetTypeConverter(propertyType); object obj = converter.ConvertFrom(skinProperties[propertyName]); propInfo.SetValue(nodeElement, obj, null); } else { propInfo.SetValue(nodeElement, skinProperties[propertyName], null); } } } catch (Exception) { nodeElement = null; } // TODO: Load an 'ApplicationSettings' object here so that the NodeFontSize can be determined through application/user settings. return(nodeElement); }
private IEnumerable <Guid> GetAllChildNodes(INodeProxy nodeProxy) { List <Guid> nodes = new List <Guid>(); if (nodeProxy.Descriptors != null) { foreach (DescriptorProxy descriptorProxy in nodeProxy.Descriptors.GetByDescriptorTypeName("To")) { foreach (DescriptorProxy dp in descriptorProxy.Relationship.Descriptors.GetByDescriptorTypeName("From")) { if (descriptorProxy.Relationship.RelationshipType.Name != "TransclusionRelationship") { if (!nodes.Contains(dp.NodeId)) { nodes.Add(dp.NodeId); } } else { if (IsChildInCurrentView(nodeProxy, dp.NodeId)) { if (!nodes.Contains(dp.NodeId)) { nodes.Add(dp.NodeId); } } } } } } return(nodes.ToArray()); }
/// <summary> /// When a relationship is drawn by right clicking on one node and dragging the line to the another node a FromToRelationship /// will be constructed, that is the event that triggers this method. /// </summary> /// <param name="sender">The NodeRelationshipHelper that has detected the connection has been drawn</param> /// <param name="e"></param> private void OnNodesConnected(object sender, EventArgs e) { NodeRelationshipHelper nrh = sender as NodeRelationshipHelper; if (nrh != null) { IDescriptorTypeProxy toDescriptorTypeProxy = _typeManager.GetDescriptorType("To"); IDescriptorTypeProxy fromDescriptorTypeProxy = _typeManager.GetDescriptorType("From"); IDescriptorTypeProxy transMapDescriptorTypeProxy = _typeManager.GetDescriptorType("TransclusionMap"); INodeProxy fromNode = nrh.FromNode.DataContext as INodeProxy; INodeProxy toNode = nrh.ToNode.DataContext as INodeProxy; Dictionary <IDescriptorTypeProxy, Guid> nodes = new Dictionary <IDescriptorTypeProxy, Guid>(); nodes.Add(toDescriptorTypeProxy, toNode.Id); nodes.Add(fromDescriptorTypeProxy, fromNode.Id); IRelationshipTypeProxy relationshipTypeProxy = null; if (fromNode.ParentMapNodeUid != this.Navigator.FocalNodeId || toNode.ParentMapNodeUid != this.Navigator.FocalNodeId) { nodes.Add(transMapDescriptorTypeProxy, this.Navigator.FocalNodeId); relationshipTypeProxy = _typeManager.GetRelationshipType("TransclusionRelationship"); } else { relationshipTypeProxy = _typeManager.GetRelationshipType("FromToRelationship"); } _navigator.ConnectNodesAsync(nodes, relationshipTypeProxy, string.Empty); _navigator.GetCurrentNodesAsync(); } }
protected bool ContainsKey(INodeProxy node) { if (node.HasMetadata(Key) && node.GetNodeMetadata(Key) != null) { return(true); } return(false); }
protected bool ContainsKey(INodeProxy node) { if (node.HasMetadata(Key) && node.GetNodeMetadata(Key) != null) { return true; } return false; }
/// <summary> /// Compares if the nodes metadata value is ==, !=, >, >=, <, <=, to the value passed as a parameter. /// </summary> /// <param name="node"></param> /// <param name="value">The string representaion of a TimeSpan</param> /// <returns></returns> public override bool HasMatch(INodeProxy node) { bool result = false; if (!ContainsKey(node)) { return false; } TimeSpan metaValue = TimeSpan.MinValue; TimeSpan compareValue = TimeSpan.MinValue; if (TimeSpan.TryParse(node.GetNodeMetadata(Key).MetadataValue, out metaValue) && TimeSpan.TryParse(Value, out compareValue)) { switch (Operator) { case MetadataFilterOperator.EQUAL: if (metaValue.Equals(compareValue)) { result = true; } break; case MetadataFilterOperator.NOT_EQUAL: if (!metaValue.Equals(compareValue)) { result = true; } break; case MetadataFilterOperator.GREATER_THAN: if (metaValue > compareValue) { result = true; } break; case MetadataFilterOperator.GREATER_THAN_OR_EQUAL: if (metaValue >= compareValue) { result = true; } break; case MetadataFilterOperator.LESS_THAN: if (metaValue < compareValue) { result = true; } break; case MetadataFilterOperator.LESS_THAN_OR_EQUAL: if (metaValue <= compareValue) { result = true; } break; default: result = false; break; } } return result; }
public VideoSizeHelper(INodeProxy nodeProxy) { MetadataContext videoSizeKey = new MetadataContext() { MetadataName = "Video.Size", NodeUid = nodeProxy.Id }; string videoSize = null; if (nodeProxy.HasMetadata(videoSizeKey)) { videoSize = nodeProxy.GetNodeMetadata(videoSizeKey).MetadataValue; } Size = ParseVideoSize(videoSize); }
/// <summary> /// Builds out the nodes and descriptors on the client side. Adds to a _cachedNodes list and keeps it updated. /// </summary> /// <param name="relatedNodesResult"></param> /// <returns></returns> private List <INodeProxy> BuildNodeList(RelatedNodesSearchResult relatedNodesResult) { List <INodeProxy> nodes = new List <INodeProxy>(); if (relatedNodesResult.Nodes.Count > 0) { foreach (SoapNode soapNode in relatedNodesResult.Nodes.Values) { if (_cachedNodes.ContainsKey(soapNode.Id)) { _cachedNodes.Remove(soapNode.Id); } NodeProxy node = new NodeProxy(soapNode); _cachedNodes.Add(soapNode.Id, node); } foreach (SoapNode soapNode in relatedNodesResult.Nodes.Values) { foreach (SoapRelationship relationship in soapNode.Relationships.Values) { RelationshipProxy relationshipProxy = new RelationshipProxy(relationship); foreach (DescriptorProxy descriptor in relationshipProxy.Descriptors) { if (_cachedNodes.ContainsKey(descriptor.NodeId)) { INodeProxy connectedNode = _cachedNodes[descriptor.NodeId]; descriptor.Node = connectedNode; if (!connectedNode.Descriptors.Contains(descriptor)) { connectedNode.Descriptors.Add(descriptor); } } } } } foreach (SoapNode soapNode in relatedNodesResult.Nodes.Values) { nodes.Add(_cachedNodes[soapNode.Id]); } foreach (INodeProxy nodeProxy in nodes) { foreach (IDescriptorProxy descriptorProxy in nodeProxy.Descriptors) { CompleteRelationship(descriptorProxy.Relationship); } } } return(nodes); }
public virtual void SetCurrentNode(INodeProxy node) { //put the last focal node into the history before setting the new one SetHistory(node.Name, node); if (NavigationCompleted != null) { NavigationCompleted.Invoke(this, new EventArgs()); } //Set the new current focal node. FocalNode = node; _currentFocalNode = FocalNode.Id; }
private void SetHistory(string name, INodeProxy node) { if (node != null) { if (name == null) { name = "Home"; } NodeHistoryElement item = new NodeHistoryElement() { Name = name, Node = node }; _navHistory.AddToHistory(item); } }
public void AddNode(string mapNodeId, string nodeTypeName, double x, double y) { INodeProxy nodeProxy = new NodeProxy(); nodeProxy.Id = Guid.NewGuid().ToString(); INodeProxy parentNode = _cachedNodes[mapNodeId]; nodeProxy.ParentNodes = new INodeProxy[1] { parentNode }; nodeProxy.Properties.Add("XPosition", x.ToString()); nodeProxy.Properties.Add("YPosition", y.ToString()); nodeProxy.NodeType = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeTypeManager>().GetNodeType(nodeTypeName); _localNewNodes.Add(nodeProxy.Id, nodeProxy); _cachedNodes.Add(nodeProxy.Id, nodeProxy); }
public void ShowNodePropertiesDialog(INodeProxy node) { NodePropertiesDialog npd = new NodePropertiesDialog(); npd.DataContext = node; MetadataContext noteKey = new MetadataContext() { NodeUid = node.Id, MetadataName = "Note" }; if (node.HasMetadata(noteKey)) { npd.Note = node.GetNodeMetadata(noteKey).MetadataValue; } npd.Closed += new EventHandler(NodePropertiesDialog_Close); npd.Show(); }
public NodeContextMenu(INodeProxy nodeProxy, IMapControl map, INodeService service, Point location) : base() { messageHandler = new EventHandler <MessageReceivedEventArgs>(map_MessageReceived); NodeProxy = nodeProxy; //MessageSender = map.MessageSender; Navigator = map.Navigator; NodeService = service; map.MessageReceived += messageHandler; MapControl = map; Location = location; this.Loaded += new RoutedEventHandler(NodeContextMenu_Loaded); this.Unloaded += new RoutedEventHandler(NodeContextMenu_Unloaded); }
public NodeContextMenu(INodeProxy nodeProxy, IMapControl map, INodeService service, Point location) : base() { messageHandler = new EventHandler<MessageReceivedEventArgs>(map_MessageReceived); NodeProxy = nodeProxy; //MessageSender = map.MessageSender; Navigator = map.Navigator; NodeService = service; map.MessageReceived += messageHandler; MapControl = map; Location = location; this.Loaded += new RoutedEventHandler(NodeContextMenu_Loaded); this.Unloaded += new RoutedEventHandler(NodeContextMenu_Unloaded); }
public NodeRenderer(NavigatorView parentNavigatorView, INodeProxy nodeProxy, ThemeManager themeManager, string skinName) : this() { Node = nodeProxy; ParentNavigatorView = parentNavigatorView; ThemeManagementObject = themeManager; SkinName = skinName; Skin = ThemeManagementObject.GetSkin(Node.NodeType, SkinName); this.Loaded += new RoutedEventHandler(OnLoaded); this.MouseLeftButtonDown += new MouseButtonEventHandler(OnMouseLeftButtonDown); this.MouseLeftButtonUp += new MouseButtonEventHandler(OnMouseLeftButtonUp); this.MouseMove += new MouseEventHandler(OnMouseMove); }
private IEnumerable <IRelationshipProxy> GetTransclusionRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("To")) { //filter to MapContainerRelationships only if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { if (alternateDescriptor.NodeId == Navigator.FocalNodeId) { yield return(descriptor.Relationship); } } } } }
private IEnumerable <IRelationshipProxy> GetTransclusionRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { //return a transclusion relationship that is in this map being rendered. if (alternateDescriptor.NodeId == ParentNavigatorView.ContextNode.Id) { yield return(descriptor.Relationship); } } } } }
/// <summary> /// Helper method for getting the relationship that matches nodes relationship to the map currently being rendered /// </summary> /// <param name="node"></param> /// <returns></returns> private IRelationshipProxy GetMapRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name == "MapContainerRelationship") { //filter to MapContainerRelationships only foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (alternateDescriptor.NodeId == ParentNavigatorView.ContextNode.Id) { return(descriptor.Relationship); } } } } return(null); }
public void Add(INodeProxy node) { if (node is BodyProxy) { this.Body = (BodyProxy)node; } else if (node is HeaderProxy) { this.headers.Add((HeaderProxy)node); } else if (node is FooterProxy) { this.footers.Add((FooterProxy)node); } else { throw new InvalidOperationException("node of type " + node.GetType() + " is not allowed as a child of Section"); } }
private void ToggleParentNodes(bool isSelected, INodeProxy nodeProxy) { foreach (Guid parentNodeId in nodeProxy.ParentNodes) { if (ParentNavigatorView.ContextNode.Id == parentNodeId) { continue; //a map node shouldn't really ever get in this situation where it is transcluded within itself } if (ParentNavigatorView.NodeRenderers.ContainsKey(parentNodeId)) { NodeRenderer nodeRenderer = ParentNavigatorView.NodeRenderers[parentNodeId]; if (!IsParentInCurrentView(nodeProxy, nodeRenderer.Node)) { continue; } nodeRenderer.IsSelected = isSelected; INodeProxy parentNode = nodeRenderer.Node; foreach (IDescriptorProxy descriptor in parentNode.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name != "MapContainerRelationship" && IsParentRelationship(descriptor.Relationship, nodeProxy.Id) && ParentNavigatorView.RelationshipRenderers.ContainsKey(descriptor.Relationship.Id)) { IRelationshipRenderer relationshipRenderer = ParentNavigatorView.RelationshipRenderers[descriptor.Relationship.Id]; relationshipRenderer.IsSelected = isSelected; } } if (isSelected) { SelectParentNodes(parentNode); } else { UnselectParentNodes(parentNode); } } } }
public static string SerializeNode(INodeProxy[] nodeProxies) { XmlSerializer serializer = new XmlSerializer(typeof(Nodes)); Encoding utf8 = new UTF8Encoding(false); MemoryStream ms = new MemoryStream(); XmlWriter xmlWriter = XmlWriter.Create(ms, new XmlWriterSettings() { Indent = false, NewLineHandling = NewLineHandling.None, CloseOutput = true, Encoding = utf8 }); Nodes nodes = new Nodes(); List<NodesNode> nodesList = new List<NodesNode>(); foreach (INodeProxy nodeProxy in nodeProxies) { NodesNode node = new NodesNode() { NodeUid = nodeProxy.Id, NodeType = new NodesNodeNodeType() { NodeTypeName = nodeProxy.NodeType.Name, NodeTypeUid = nodeProxy.NodeType.Id }, DomainUid = nodeProxy.Domain }; List<NodesNodeMetadata> metadatam = new List<NodesNodeMetadata>(); foreach (MetadataContext key in nodeProxy.Metadata.Keys) { NodesNodeMetadata metaData = new NodesNodeMetadata() { Name = key.MetadataName.Replace(".", "_"), Value = nodeProxy.Metadata[key].MetadataValue }; metadatam.Add(metaData); } node.Metadatum = metadatam.ToArray(); nodesList.Add(node); } nodes.Node = nodesList.ToArray(); serializer.Serialize(xmlWriter, nodes); byte[] bytes = ms.ToArray(); ms.Close(); string xmlString = Encoding.UTF8.GetString(bytes, 0, bytes.Length); return xmlString; }
private void sendMenuItem_Click(object sender, RoutedEventArgs e) { Dictionary <Guid, INodeProxy> nodes = new Dictionary <Guid, INodeProxy>(); nodes.Add(NodeProxy.Id, NodeProxy); //send a basic XML representation of the node if (MapControl.SelectedNodes.Length > 0) { foreach (INodeProxy nodeProxy in MapControl.SelectedNodes) { if (!nodes.ContainsKey(nodeProxy.Id)) { nodes.Add(nodeProxy.Id, nodeProxy); } } } INodeProxy[] nodesArray = new INodeProxy[nodes.Values.Count]; nodes.Values.CopyTo(nodesArray, 0); HtmlPage.Window.Invoke("sendMessage", "'" + NodeSerializer.SerializeNode(nodesArray) + "'"); }
private bool IsParentInCurrentView(INodeProxy nodeProxy, INodeProxy relatedNode) { foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy toNodeDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (toNodeDesc.NodeId == relatedNode.Id) { foreach (IDescriptorProxy transMap in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { if (transMap.NodeId == this.ParentNavigatorView.ContextNode.Id) { return(true); } } } } } else if (descriptor.Relationship.RelationshipType.Name == "FromToRelationship" || descriptor.Relationship.RelationshipType.Name == "MapRelationship") { foreach (IDescriptorProxy fromDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("From")) { if (fromDesc.NodeId == nodeProxy.Id) { foreach (IDescriptorProxy toDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (toDesc.NodeId == relatedNode.Id) { return(true); } } } } } } return(false); }
private void ToggleChildNodes(bool isSelected, INodeProxy nodeProxy) { foreach (Guid childNodeId in GetAllChildNodes(nodeProxy)) { if (ParentNavigatorView.NodeRenderers.ContainsKey(childNodeId)) { NodeRenderer nodeRenderer = ParentNavigatorView.NodeRenderers[childNodeId]; if (nodeProxy.IsTransclusion && !IsChildInCurrentView(nodeProxy, nodeRenderer.Node.Id)) { continue; } nodeRenderer.IsSelected = isSelected; INodeProxy childNode = nodeRenderer.Node; foreach (IDescriptorProxy descriptor in childNode.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name != "MapContainerRelationship" && IsChildRelationship(descriptor.Relationship, nodeProxy.Id) && ParentNavigatorView.RelationshipRenderers.ContainsKey(descriptor.Relationship.Id)) { IRelationshipRenderer relationshipRenderer = ParentNavigatorView.RelationshipRenderers[descriptor.Relationship.Id]; relationshipRenderer.IsSelected = isSelected; } } if (isSelected) { SelectChildNodes(childNode); } else { UnselectChildNodes(childNode); } } } }
private void OnGetMapsNodesCompletedNodeArgs(object sender, ReturnedNodesEventArgs e) { INodeProxy focalNode = FocalNode; List <INodeProxy> filteredNodes = FiltersResults(e.Nodes); CompleteRelationshipLinks(filteredNodes); List <INodeProxy> nodes = new List <INodeProxy>(); foreach (INodeProxy nodeProxy in filteredNodes) { if (nodeProxy.Id == FocalNodeId) { //Set the focal node if this is the main node in focus FocalNode = nodeProxy; focalNode = FocalNode; } else { nodes.Add(nodeProxy); } if (nodeProxy.ParentMapNodeUid != FocalNodeId) { nodeProxy.IsTransclusion = true; } else { nodeProxy.IsTransclusion = false; } } NodesEventArgs nodesEventArgs = new NodesEventArgs(null, focalNode, nodes.ToArray()); if (GetCurrentNodesCompleted != null) { GetCurrentNodesCompleted.Invoke(this, nodesEventArgs); } }
private async Task DiscoverServicesAsync(INodeProxy serviceNode, string serviceName, List <string> serviceIds) { foreach (var sid in serviceIds) { if (!Guid.TryParse(sid, out var serviceId)) { continue; } if (_instanceCache.Exists(serviceName, serviceId)) { continue; } var instanceNode = await serviceNode.ProxyJsonNodeAsync <InstanceEntry>(sid, true); instanceNode.NodeCreated += async(_, __) => { var ent = await instanceNode.GetDataAsync(); WriteToCache(ent, serviceName, serviceId); _logger.LogDebug($"[{serviceName}] add an instance: '{serviceId}'"); }; instanceNode.NodeDeleted += (_, __) => { _instanceCache.Remove(serviceName, serviceId); _logger.LogDebug($"[{serviceName}] lost an instance: '{serviceId}'"); }; instanceNode.DataChanged += (_, args) => { WriteToCache(args.Data, serviceName, serviceId); _logger.LogDebug($"[{serviceName}] update an instance: '{serviceId}'"); }; var entry = await instanceNode.GetDataAsync(); WriteToCache(entry, serviceName, serviceId); _logger.LogDebug($"[{serviceName}] add an instance: '{serviceId}'"); } }
public void Add(INodeProxy node) { this.cells.Add((CellProxy)node); }
public void Add(INodeProxy node) { this.children.Add(node); }
public void Add(INodeProxy node) { this.sections.Add((SectionProxy)node); }
public NodeControl RenderSkinElements(INodeProxy node, string skinName, Dictionary<string, object> skinProperties) { NodeControl nodeElement = null; try { nodeElement = new NodeControl(); nodeElement.DataContext = node; foreach (string propertyName in skinProperties.Keys) { PropertyInfo propInfo = nodeElement.GetType().GetProperty(propertyName); Type propertyType = propInfo.PropertyType; if (propertyType != typeof(string)) { TypeConverter converter = GetTypeConverter(propertyType); object obj = converter.ConvertFrom(skinProperties[propertyName]); propInfo.SetValue(nodeElement, obj, null); } else { propInfo.SetValue(nodeElement, skinProperties[propertyName], null); } } } catch (Exception) { nodeElement = null; } // TODO: Load an 'ApplicationSettings' object here so that the NodeFontSize can be determined through application/user settings. return nodeElement; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (this.isTemplateApplied) return; this.nodeProxy = DataContext as INodeProxy; if (nodeProxy == null) { throw new Exception("The DataContext was not a valid NodeProxy"); } this.imagePart = GetTemplateChild(NodeControl.ImagePartName) as Rectangle; if (this.imagePart != null) { this.imagePart.SetValue(Canvas.LeftProperty, 0.0); this.imagePart.SetValue(Canvas.TopProperty, 0.0); ImageBrush nodeImageBrush = this.imagePart.Fill as ImageBrush; if (nodeImageBrush != null) { nodeImageBrush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(nodeImageBrush_ImageFailed); } } this.playMediaImagePart = GetTemplateChild(NodeControl.PlayMediaImagePartName) as Rectangle; if (this.playMediaImagePart != null) { this.playMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(playMediaImagePart_MouseLeftButtonUp); MetadataContext videoSourceKey = new MetadataContext() { MetadataName = "Video.Source", NodeUid = nodeProxy.Id }; if (nodeProxy.HasMetadata(videoSourceKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue)) { this.playMediaImagePart.Visibility = System.Windows.Visibility.Visible; } else { this.playMediaImagePart.Visibility = System.Windows.Visibility.Collapsed; } ImageBrush brush = playMediaImagePart.Fill as ImageBrush; if (brush != null) { brush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(brush_ImageFailed); } } this.pauseMediaImagePart = GetTemplateChild(NodeControl.PauseMediaImagePartName) as Rectangle; if (this.pauseMediaImagePart != null) { this.pauseMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(pauseMediaImagePart_MouseLeftButtonUp); this.pauseMediaImagePart.Visibility = System.Windows.Visibility.Collapsed; ImageBrush brush = pauseMediaImagePart.Fill as ImageBrush; if (brush != null) { brush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(brush_ImageFailed); } } this.textBlockPart = GetTemplateChild(NodeControl.TextBlockPartName) as TextBlock; this.textBlockBorderPart = GetTemplateChild(NodeControl.TextBlockBorderName) as Border; this.textBoxPart = GetTemplateChild(NodeControl.TextBoxPartName) as TextBox; this.transCntTextBlockPart = GetTemplateChild(NodeControl.TranscludionsCountTextBlockPartName) as TextBlock; this.childCntTextBlockPart = GetTemplateChild(NodeControl.ChildCountTextBlockPartName) as TextBlock; this.noteTextBlockPart = GetTemplateChild(NodeControl.NoteTextBlockPartName) as TextBlock; Rect textLocation = GetTextLocation(); if (this.textBlockBorderPart != null) { this.textBlockBorderPart.SetValue(Canvas.LeftProperty, textLocation.X); this.textBlockBorderPart.SetValue(Canvas.TopProperty, textLocation.Y); this.textBlockBorderPart.Width = textLocation.Width; this.textBlockBorderPart.Height = textLocation.Height; } if (this.textBlockPart != null) { this.textBlockPart.Width = textLocation.Width; this.textBlockPart.Height = textLocation.Height; if (this.textBlockBorderPart != null) { if (textLocation.Height < this.textBlockPart.ActualHeight) { this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight; this.textBlockPart.Height = this.textBlockPart.ActualHeight; } else { if (this.textBlockPart.ActualHeight > 10) { this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight; this.textBlockPart.Height = this.textBlockPart.ActualHeight; } } } this.textBlockHeight = this.textBlockPart.ActualHeight; this.textBlockWidth = this.textBlockPart.ActualWidth; this.textBlockPart.MouseLeftButtonDown += new MouseButtonEventHandler(OnNodeTextBlockMouseLeftButtonDown); } if (this.textBoxPart != null) { this.textBoxPart.SetValue(Canvas.LeftProperty, textLocation.X); this.textBoxPart.SetValue(Canvas.TopProperty, textLocation.Y); this.textBoxPart.Width = textLocation.Width + 5; this.textBoxPart.Height = textLocation.Height + 5; this.textBoxPart.KeyDown += new KeyEventHandler(TextBoxPart_KeyDown); } if (this.transCntTextBlockPart != null) { if (this.transCntTextBlockPart.Text == "1") { this.transCntTextBlockPart.Visibility = Visibility.Collapsed; } else { this.transCntTextBlockPart.Visibility = Visibility.Visible; } } if (this.childCntTextBlockPart != null) { if (nodeProxy.NodeType.Name == "CompendiumMapNode") { this.childCntTextBlockPart.Visibility = Visibility.Visible; this.childCntTextBlockPart.Text = GetMapNodeChildCount(nodeProxy); } else { this.childCntTextBlockPart.Visibility = Visibility.Collapsed; } } if (this.noteTextBlockPart != null) { MetadataContext noteKey = new MetadataContext() { MetadataName = "Note", NodeUid = nodeProxy.Id }; if (nodeProxy.HasMetadata(noteKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(noteKey).MetadataValue)) { this.noteTextBlockPart.Visibility = Visibility.Visible; ToolTipService.SetToolTip(this.noteTextBlockPart, nodeProxy.GetNodeMetadata(noteKey).MetadataValue); } else { this.noteTextBlockPart.Visibility = Visibility.Collapsed; } } BitmapImage nodeImg = new BitmapImage(); //for optimal memory usage and speed only create as many ImageBrush objects as there are images. if (ImageUrl != null) { if (!nodeImageCache.ContainsKey(ImageUrl)) { nodeImg.UriSource = new Uri(ImageUrl); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = nodeImg; NodeImage = imageBrush; nodeImageCache.Add(ImageUrl, imageBrush); } else { NodeImage = nodeImageCache[ImageUrl]; } } else { if (!string.IsNullOrEmpty(NodeImageName)) { switch (NodeImageName) { case "Map": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/network.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; case "Pro": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/plus.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; case "Con": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/minus.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; case "Decision": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; case "Idea": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/exclamation.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; case "Question": nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/question.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; default: nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative); NodeImage = new ImageBrush() { ImageSource = nodeImg }; break; } } } this.okButtonPart = GetTemplateChild(NodeControl.OkButtonPartName) as Button; this.cancelButtonPart = GetTemplateChild(NodeControl.CancelButtonPartName) as Button; if (this.textBlockBorderPart != null && this.okButtonPart != null && this.cancelButtonPart != null) { double left = (double)textBlockBorderPart.GetValue(Canvas.LeftProperty); double top = (double)textBlockBorderPart.GetValue(Canvas.TopProperty); this.okButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 100); this.okButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height); this.okButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxOkClick); this.cancelButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 50); this.cancelButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height); this.cancelButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxCancelClick); } if (InEditState) { GoToState(NodeControl.EdittingStateName, false); if (this.textBoxPart != null) { this.textBoxPart.Focus(); } } else { this.GoToState(NodeControl.NormalStateName, false); } this.isTemplateApplied = true; }
private bool IsParentInCurrentView(INodeProxy nodeProxy, INodeProxy relatedNode) { foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy toNodeDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (toNodeDesc.NodeId == relatedNode.Id) { foreach (IDescriptorProxy transMap in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { if (transMap.NodeId == this.ParentNavigatorView.ContextNode.Id) { return true; } } } } } else if (descriptor.Relationship.RelationshipType.Name == "FromToRelationship" || descriptor.Relationship.RelationshipType.Name == "MapRelationship") { foreach (IDescriptorProxy fromDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("From")) { if (fromDesc.NodeId == nodeProxy.Id) { foreach (IDescriptorProxy toDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (toDesc.NodeId == relatedNode.Id) { return true; } } } } } } return false; }
public override void UnselectParentNodes(INodeProxy nodeProxy) { ToggleParentNodes(false, nodeProxy); }
private void OnConnectNodesCompleted(object sender, ConnectNodesCompletedEventArgs e) { if (e.Error == null) { List <INodeProxy> nodes = new List <INodeProxy>(); ConnectedNodesResult connectResult = e.Result; foreach (SoapNode soapNode in connectResult.Nodes.Values) { if (_cachedNodes.ContainsKey(soapNode.Id)) { _cachedNodes.Remove(soapNode.Id); } NodeProxy node = new NodeProxy(soapNode); _cachedNodes.Add(soapNode.Id, node); nodes.Add(node); } foreach (INodeProxy nodeProxy in nodes) { foreach (IDescriptorProxy descriptorProxy in nodeProxy.Descriptors) { CompleteRelationship(descriptorProxy.Relationship); } } ConnectedNodesEventArgs connectedNodesEventArgs = new ConnectedNodesEventArgs(); connectedNodesEventArgs.Nodes = nodes.ToArray(); connectedNodesEventArgs.Relationship = new RelationshipProxy(e.Result.Relationship); CompleteRelationship(connectedNodesEventArgs.Relationship); //When a node is connected via a MapContainerRelationship the UserState will be the location of the new node //on the map, it can't be stored in the db until the relationship exists since it's the contectual relationship //that determines where it is located in it's view in this map (it may be elsewhere in transclusions) if (e.UserState != null) { INodeProxy nodeProxy = connectedNodesEventArgs.Nodes[1]; Point location = (Point)e.UserState; if (location != null) { TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>(); IDescriptorTypeProxy descriptorType = null; if (e.Result.Relationship.RelationshipType.Name == "TransclusionRelationship") { descriptorType = typeManager.GetDescriptorType("TransclusionMap"); } else { descriptorType = typeManager.GetDescriptorType("From"); } MetadataContext xPositionKey = new MetadataContext() { NodeUid = nodeProxy.Id, RelationshipUid = e.Result.Relationship.Id, DescriptorTypeUid = descriptorType.Id, MetadataName = "XPosition" }; MetadataContext yPositionKey = new MetadataContext() { NodeUid = nodeProxy.Id, RelationshipUid = e.Result.Relationship.Id, DescriptorTypeUid = descriptorType.Id, MetadataName = "YPosition" }; if (nodeProxy.Metadata != null && nodeProxy.GetNodeMetadata(xPositionKey) != null) { nodeProxy.GetNodeMetadata(xPositionKey).MetadataValue = location.X.ToString(); } else { MetadataTypeProxy metaDataTypeProxy = typeManager.GetMetadataType("double") as MetadataTypeProxy; if (metaDataTypeProxy != null) { SoapMetadata soapMetadata = new SoapMetadata(); soapMetadata.MetadataName = "XPosition"; soapMetadata.MetadataType = metaDataTypeProxy.BaseSoapNodeType; soapMetadata.MetadataValue = location.X.ToString(); nodeProxy.Metadata.Add(xPositionKey, soapMetadata); } } if (nodeProxy.Metadata != null && nodeProxy.GetNodeMetadata(yPositionKey) != null) { nodeProxy.GetNodeMetadata(yPositionKey).MetadataValue = location.Y.ToString(); } else { MetadataTypeProxy metaDataTypeProxy = typeManager.GetMetadataType("double") as MetadataTypeProxy; if (metaDataTypeProxy != null) { SoapMetadata soapMetadata = new SoapMetadata(); soapMetadata.MetadataName = "YPosition"; soapMetadata.MetadataType = metaDataTypeProxy.BaseSoapNodeType; soapMetadata.MetadataValue = location.Y.ToString(); nodeProxy.Metadata.Add(yPositionKey, soapMetadata); } } } } if (ConnectNodesCompleted != null) { ConnectNodesCompleted.Invoke(this, connectedNodesEventArgs); } } }
public void DeleteNodePromoteTransclusion(Guid domainId, Guid currentMapId, INodeProxy originalNode) { Client.DeleteNodePromoteTransclusionAsync(domainId, currentMapId, originalNode.Id); ////Find a transclusion version of the node //Guid newMasterMapId = Guid.Empty; //Guid relationshipToPromote = Guid.Empty; //foreach (IDescriptorProxy descriptor in originalNode.Descriptors.GetByDescriptorTypeName("To")) //{ // if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") // { // foreach (IDescriptorProxy transMapDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) // { // if (currentMapId != transMapDescriptor.NodeId) // { // newMasterMapId = transMapDescriptor.NodeId; // relationshipToPromote = descriptor.Relationship.Id; // break; // } // } // } // if (newMasterMapId != Guid.Empty) // { // break; // } //} //if (newMasterMapId != Guid.Empty) //{ // //Find original Map Container Relationship // Guid originalMapNodeContainer = Guid.Empty; // foreach (IDescriptorProxy descriptor in originalNode.Descriptors.GetByDescriptorTypeName("From")) // { // if (descriptor.Relationship.RelationshipType.Name == "MapContainerRelationship") // { // originalMapNodeContainer = descriptor.Relationship.Id; // break; // } // } // if (originalMapNodeContainer != Guid.Empty) // { // //Delete the original Map Container Relationship and remove it...no metadata from it is required. // DeleteRelationship(domainId, originalMapNodeContainer); // //Get the X, Y Position metadata from the Transclusion Relationship being changed to a Map Container Relationship // TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance<TypeManager>(); // IDescriptorTypeProxy transclusionMapDescriptorTypeProxy = typeManager.GetDescriptorType("TransclusionMap"); // MetadataContext xPositionContext = new MetadataContext() // { // MetadataName = "XPosition", // NodeUid = originalNode.Id, // RelationshipUid = relationshipToPromote, // DescriptorTypeUid = transclusionMapDescriptorTypeProxy.Id // }; // MetadataContext yPositionContext = new MetadataContext() // { // MetadataName = "YPosition", // NodeUid = originalNode.Id, // RelationshipUid = relationshipToPromote, // DescriptorTypeUid = transclusionMapDescriptorTypeProxy.Id // }; // SoapMetadata xPositionMetadata = originalNode.GetMetadataItem(xPositionContext); // SoapMetadata yPositionMetadata = originalNode.GetMetadataItem(yPositionContext); // IDescriptorTypeProxy fromDescriptorTypeProxy = typeManager.GetDescriptorType("From"); // IDescriptorTypeProxy toDescriptorTypeProxy = typeManager.GetDescriptorType("To"); // IRelationshipTypeProxy mapContainerRelationshipType = typeManager.GetRelationshipType("MapContainerRelationship"); // IRelationshipTypeProxy fromToRelationshipType = typeManager.GetRelationshipType("FromToRelationship"); // Dictionary<IDescriptorTypeProxy, Guid> nodes = new Dictionary<IDescriptorTypeProxy, Guid>(); // nodes.Load(toDescriptorTypeProxy, newMasterMapId); // nodes.Load(fromDescriptorTypeProxy, originalNode.Id); // //Connect new MapContainerRelationship using the new Map Id // ConnectNodesAsync(originalNode.Domain, nodes, mapContainerRelationshipType, // new Point(Double.Parse(xPositionMetadata.MetadataValue), Double.Parse(yPositionMetadata.MetadataValue)), null); // //Delete the old transclusion map relationship // DeleteRelationship(domainId, relationshipToPromote); // //Convert the Transclusion Map Relationships that are between the node (that was previously transcluded) and other nodes on that map. // //First collect all the transclusion relationships on the map that is now the container of the node. // List<IRelationshipProxy> relationshipsToConvert = new List<IRelationshipProxy>(); // foreach (IDescriptorProxy descriptor in originalNode.Descriptors) // { // if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship" && descriptor.Relationship.Descriptors.Count == 3) // { // foreach (IDescriptorProxy transclusionMapDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) // { // if (transclusionMapDesc.NodeId == newMasterMapId) // { // relationshipsToConvert.Load(descriptor.Relationship); // } // } // } // } // //Then create the new FromToRelationships // foreach (IRelationshipProxy transclusionRelationship in relationshipsToConvert) // { // IDescriptorProxy fromDescritorProxy = null; // IDescriptorProxy toDescriptorProxy = null; // foreach (IDescriptorProxy fromDescriptor in transclusionRelationship.Descriptors.GetByDescriptorTypeName("From")) // { // fromDescritorProxy = fromDescriptor; // break; //there will only be one anyway // } // foreach (IDescriptorProxy toDescriptor in transclusionRelationship.Descriptors.GetByDescriptorTypeName("To")) // { // toDescriptorProxy = toDescriptor; // break; //there will only be one anyway // } // nodes.Clear(); //clear the temporary relationship building nodes dictionary before use // nodes.Load(toDescriptorTypeProxy, toDescriptorProxy.NodeId); // nodes.Load(fromDescriptorTypeProxy, fromDescritorProxy.NodeId); // ConnectNodesAsync(originalNode.Domain, nodes, fromToRelationshipType, null); // DeleteRelationship(domainId, transclusionRelationship.Id); // } // } //} }
private void sendMenuItem_Click(object sender, RoutedEventArgs e) { Dictionary<Guid, INodeProxy> nodes = new Dictionary<Guid, INodeProxy>(); nodes.Add(NodeProxy.Id, NodeProxy); //send a basic XML representation of the node if (MapControl.SelectedNodes.Length > 0) { foreach (INodeProxy nodeProxy in MapControl.SelectedNodes) { if (!nodes.ContainsKey(nodeProxy.Id)) { nodes.Add(nodeProxy.Id, nodeProxy); } } } INodeProxy[] nodesArray = new INodeProxy[nodes.Values.Count]; nodes.Values.CopyTo(nodesArray, 0); HtmlPage.Window.Invoke("sendMessage", "'" + NodeSerializer.SerializeNode(nodesArray) + "'"); }
public void DeleteNodeTransclusion(Guid domainId, Guid currentMapId, INodeProxy transcludedNode) { Client.DeleteNodeTransclusionAsync(domainId, currentMapId, transcludedNode.Id); }
public override void SelectParentNodes(INodeProxy nodeProxy) { ToggleParentNodes(true, nodeProxy); }
public VisualizerViewModel(INodeProxy documentProxy) { this.documentProxy = documentProxy; this.CopyCommand = new RelayCommand(this.CopyToClipboard); }
public abstract bool HasMatch(INodeProxy node);
public override bool HasMatch(INodeProxy node) { bool result = false; string metaValue; if (!ContainsKey(node)) { if (string.IsNullOrEmpty(Value)) { //if the metadata doesn't exist and the compare value is null or string.Empty //set the values to both be string.Empty and allow the operator to work it out metaValue = string.Empty; Value = string.Empty; } else { return false; } } else { metaValue = node.GetNodeMetadata(Key).MetadataValue; } switch (Operator) { case MetadataFilterOperator.EQUAL: if (metaValue == Value) { result = true; } break; case MetadataFilterOperator.NOT_EQUAL: if (metaValue != Value) { result = true; } break; case MetadataFilterOperator.GREATER_THAN: if (metaValue.CompareTo(Value) > 0) { result = true; } break; case MetadataFilterOperator.GREATER_THAN_OR_EQUAL: if (metaValue.CompareTo(Value) == 0) { result = true; } break; case MetadataFilterOperator.LESS_THAN: if (metaValue.CompareTo(Value) < 0) { result = true; } break; case MetadataFilterOperator.LESS_THAN_OR_EQUAL: if (metaValue.CompareTo(Value) == 0) { result = true; } break; case MetadataFilterOperator.CONTAINS: if (metaValue.IndexOf(Value, StringComparison.CurrentCultureIgnoreCase) >= 0) { result = true; } break; default: result = false; break; } return result; }
public abstract void UnselectChildNodes(INodeProxy nodeProxy);
public abstract void UnselectParentNodes(INodeProxy nodeProxy);
/// <summary> /// Helper method for getting the relationship that matches nodes relationship to the map currently being rendered /// </summary> /// <param name="node"></param> /// <returns></returns> private IRelationshipProxy GetMapRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("From")) { if (descriptor.Relationship.RelationshipType.Name == "MapContainerRelationship") { //filter to MapContainerRelationships only foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (alternateDescriptor.NodeId == Navigator.FocalNodeId) { return descriptor.Relationship; } } } } return null; }
private string GetMapNodeChildCount(INodeProxy nodeProxy) { int count = 0; if (nodeProxy != null) { foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name == "MapContainerRelationship") { count++; } } List<Guid> transcludedNodes = new List<Guid>(); foreach (IDescriptorProxy descriptor in nodeProxy.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { foreach (IDescriptorProxy transDesc in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("To")) { if (!transcludedNodes.Contains(transDesc.NodeId) && transDesc.Node != null) { transcludedNodes.Add(transDesc.NodeId); count++; } } } } return count.ToString(); }
public virtual void UpdateNodeMetadataAsync(INodeProxy node, Guid relationshipId, IDescriptorTypeProxy descriptorType, string metadataName, string metadataValue, IMetadataTypeProxy metadataType) { NodeService.UpdateNodeMetadataAsync(DomainId, node.Id, relationshipId, descriptorType, metadataName, metadataValue, metadataType); }
public override bool HasMatch(INodeProxy node) { bool result = false; if (!ContainsKey(node)) { return(false); } double metaValue = double.NaN; double compareValue = double.NaN; if (Double.TryParse(node.GetNodeMetadata(Key).MetadataValue, out metaValue) && Double.TryParse(Value, out compareValue)) { switch (Operator) { case MetadataFilterOperator.EQUAL: if (metaValue.Equals(compareValue)) { result = true; } break; case MetadataFilterOperator.NOT_EQUAL: if (!metaValue.Equals(compareValue)) { result = true; } break; case MetadataFilterOperator.GREATER_THAN: if (metaValue > compareValue) { result = true; } break; case MetadataFilterOperator.GREATER_THAN_OR_EQUAL: if (metaValue >= compareValue) { result = true; } break; case MetadataFilterOperator.LESS_THAN: if (metaValue < compareValue) { result = true; } break; case MetadataFilterOperator.LESS_THAN_OR_EQUAL: if (metaValue <= compareValue) { result = true; } break; default: result = false; break; } } return(result); }
private IEnumerable<IRelationshipProxy> GetTransclusionRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("To")) { if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { //return a transclusion relationship that is in this map being rendered. if (alternateDescriptor.NodeId == ParentNavigatorView.ContextNode.Id) { yield return descriptor.Relationship; } } } } }
private IEnumerable<IRelationshipProxy> GetTransclusionRelationship(INodeProxy node) { foreach (IDescriptorProxy descriptor in node.Descriptors.GetByDescriptorTypeName("To")) { //filter to MapContainerRelationships only if (descriptor.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy alternateDescriptor in descriptor.Relationship.Descriptors.GetByDescriptorTypeName("TransclusionMap")) { if (alternateDescriptor.NodeId == Navigator.FocalNodeId) { yield return descriptor.Relationship; } } } } }
public SingleDepthNodeRenderer(NavigatorView parentNavigatorView, INodeProxy nodeProxy, ThemeManager themeManager, string skinName) : base(parentNavigatorView, nodeProxy, themeManager, skinName) { }
public void RefreshMetadata(INodeProxy node) { nodeProxy.Metadata = node.Metadata; DataContext = nodeProxy; if (nodeProxy != null && isTemplateApplied) { if (transCntTextBlockPart != null) { if (this.transCntTextBlockPart.Text == "1") { this.transCntTextBlockPart.Visibility = Visibility.Collapsed; } else { this.transCntTextBlockPart.Visibility = Visibility.Visible; } } if (this.childCntTextBlockPart != null) { if (nodeProxy.NodeType.Name == "CompendiumMapNode") { this.childCntTextBlockPart.Visibility = Visibility.Visible; this.childCntTextBlockPart.Text = GetMapNodeChildCount(nodeProxy); } else { this.childCntTextBlockPart.Visibility = Visibility.Collapsed; } } if (noteTextBlockPart != null) { MetadataContext noteKey = new MetadataContext() { MetadataName = "Note", NodeUid = nodeProxy.Id }; if (nodeProxy.HasMetadata(noteKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(noteKey).MetadataValue)) { string note = nodeProxy.GetNodeMetadata(noteKey).MetadataValue; if (!string.IsNullOrEmpty(note)) { this.noteTextBlockPart.Visibility = Visibility.Visible; ToolTipService.SetToolTip(this.noteTextBlockPart, note); } else { this.noteTextBlockPart.Visibility = Visibility.Collapsed; } } else { this.noteTextBlockPart.Visibility = Visibility.Collapsed; } } if (playMediaImagePart != null && pauseMediaImagePart != null) { MetadataContext videoSourceKey = new MetadataContext() { MetadataName = "Video.Source", NodeUid = nodeProxy.Id }; if (nodeProxy.HasMetadata(videoSourceKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue)) { this.playMediaImagePart.Visibility = System.Windows.Visibility.Visible; } else { this.playMediaImagePart.Visibility = System.Windows.Visibility.Collapsed; this.pauseMediaImagePart.Visibility = System.Windows.Visibility.Collapsed; } } } }
private IEnumerable<Guid> GetAllChildNodes(INodeProxy nodeProxy) { List<Guid> nodes = new List<Guid>(); if (nodeProxy.Descriptors != null) { foreach (DescriptorProxy descriptorProxy in nodeProxy.Descriptors.GetByDescriptorTypeName("To")) { foreach (DescriptorProxy dp in descriptorProxy.Relationship.Descriptors.GetByDescriptorTypeName("From")) { if (descriptorProxy.Relationship.RelationshipType.Name != "TransclusionRelationship") { if (!nodes.Contains(dp.NodeId)) { nodes.Add(dp.NodeId); } } else { if (IsChildInCurrentView(nodeProxy, dp.NodeId)) { if (!nodes.Contains(dp.NodeId)) { nodes.Add(dp.NodeId); } } } } } } return nodes.ToArray(); }