private void SaveMediaInformation(string nodeId, string source, string markerName, TimeSpan position) { var nodeRenderers = ViewManager.Nodes.Where(n => n.Node.Id.ToString() == nodeId); INodeRenderer nodeRenderer = nodeRenderers.First() as INodeRenderer; IMetadataTypeProxy timeSpanType = TypeManager.GetMetadataType("timespan"); IMetadataTypeProxy stringType = TypeManager.GetMetadataType("string"); Navigator.UpdateNodeMetadataAsync(nodeRenderer.Node, Guid.Empty, null, "Video." + markerName, position.ToString(), timeSpanType); Navigator.UpdateNodeMetadataAsync(nodeRenderer.Node, Guid.Empty, null, "Video.Source", source, stringType); }
private void NodePropertiesDialog_Close(object sender, EventArgs e) { NodePropertiesDialog dialog = sender as NodePropertiesDialog; if (dialog != null) { if (dialog.DialogResult.Value) { TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>(); IMetadataTypeProxy stringMetadataTypeProxy = typeManager.GetMetadataType("string"); Navigator.UpdateNodeMetadataAsync(dialog.NodeProxy, Guid.Empty, null, "Note", dialog.Note, stringMetadataTypeProxy); } else { //cancel was selected } } }
public void SetNodeMetadata(MetadataContext key, string metadataValue, IMetadataTypeProxy metadataType) { if (BaseSoapNode.Metadata != null) { if (HasMetadata(key)) { GetNodeMetadata(key).MetadataValue = metadataValue; } else { BaseSoapNode.Metadata.Add(key, new SoapMetadata() { MetadataName = key.MetadataName, MetadataType = new SoapMetadataType() { Id = metadataType.Id, Name = metadataType.Name }, MetadataValue = metadataValue }); } INodeService nodeService = IoC.IoCContainer.GetInjectionInstance().GetInstance <INodeService>(); TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>(); IDescriptorTypeProxy descriptorType = null; if (key.DescriptorTypeUid.HasValue) { descriptorType = typeManager.GetDescriptorType(key.DescriptorTypeUid.Value); } Guid relationshipId = Guid.Empty; if (key.RelationshipUid.HasValue) { relationshipId = key.RelationshipUid.Value; } nodeService.UpdateNodeMetadataAsync(Domain, this.Id, relationshipId, descriptorType, key.MetadataName, metadataValue, metadataType); } }
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); }
private void TypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { IMetadataTypeProxy proxyType = TypeComboBox.SelectedItem as IMetadataTypeProxy; if (proxyType != null) { this.MetadataTypeUid = proxyType.Id; switch (proxyType.Name) { case "datetime": StringTextBox.Visibility = Visibility.Collapsed; NumericUpDown.Visibility = Visibility.Collapsed; DateTimePicker.Visibility = Visibility.Visible; if (!string.IsNullOrEmpty(Value)) { DatePicker.DisplayDate = DateTime.Parse(Value); DatePicker.Text = DateTime.Parse(Value).ToShortDateString(); //TimeUpDown.Value = DateTime.Parse(Value); //if (TimeUpDown.Value.Value != DateTime.Parse("12:00AM")) //{ // //there is no way to have a DateTime without a time but this check // //makes sure data isn't lost if someone just ok's the dialog and a value // //other than the default existed. // IncludeTimeCheckBox.IsChecked = true; //} } break; case "string": StringTextBox.Visibility = Visibility.Visible; NumericUpDown.Visibility = Visibility.Collapsed; DateTimePicker.Visibility = Visibility.Collapsed; if (!string.IsNullOrEmpty(Value)) { StringTextBox.Text = Value; } break; case "double": StringTextBox.Visibility = Visibility.Collapsed; NumericUpDown.Visibility = Visibility.Visible; DateTimePicker.Visibility = Visibility.Collapsed; if (!string.IsNullOrEmpty(Value)) { NumericUpDown.Value = Double.Parse(Value); } break; case "timespan": StringTextBox.Visibility = Visibility.Visible; NumericUpDown.Visibility = Visibility.Collapsed; DateTimePicker.Visibility = Visibility.Collapsed; if (!string.IsNullOrEmpty(Value)) { StringTextBox.Text = Value; } break; default: StringTextBox.Visibility = Visibility.Visible; break; } } }
private bool Validate() { if (DialogResult.HasValue && DialogResult.Value == false) { return(true); } if (!this.NameTextBox.IsReadOnly) { MetadataName = this.NameTextBox.Text; //it's an add dialog } bool validated = false; IMetadataTypeProxy proxyType = TypeComboBox.SelectedItem as IMetadataTypeProxy; if (proxyType != null) { switch (proxyType.Name) { case "datetime": if (DatePicker.SelectedDate.HasValue) { validated = true; //it can't be wrong from this point DateTime datetime = DatePicker.SelectedDate.Value; //if (TimeUpDown.IsEnabled) //{ // datetime = datetime.Add(TimeUpDown.Value.Value.TimeOfDay); // Value = datetime.ToString(); //} //else //{ // Value = datetime.ToShortDateString(); //} } else { validated = false; DatePicker.Background = new SolidColorBrush(Colors.Yellow); ValidationErrorTextBlock.Text = "No date has been seleccted"; } break; case "string": validated = true; //it can't get it wrong Value = StringTextBox.Text; break; case "double": validated = true; //it can't get it wrong Value = NumericUpDown.Value.ToString(); break; case "timespan": TimeSpan test; validated = TimeSpan.TryParse(StringTextBox.Text, out test); if (validated) { Value = test.ToString(); } else { StringTextBox.Background = new SolidColorBrush(Colors.Yellow); ValidationErrorTextBlock.Text = "Enter a valid TimeSpan value"; } break; default: TypeComboBox.Background = new SolidColorBrush(Colors.Yellow); ValidationErrorTextBlock.Text = "Choose the metadata content type"; break; } } return(validated); }
public void UpdateNodeMetadataAsync(Guid domainId, Guid nodeId, Guid relationshipId, IDescriptorTypeProxy descriptorTypeProxy, string metadataName, string metadataValue, IMetadataTypeProxy metadataType) { Guid soapRelationshipId = Guid.Empty; if (relationshipId != Guid.Empty) { soapRelationshipId = relationshipId; } SoapDescriptorType soapDescriptorType = null; if (descriptorTypeProxy != null) { soapDescriptorType = new SoapDescriptorType() { Id = descriptorTypeProxy.Id, Name = descriptorTypeProxy.Name }; } SoapMetadataType soapMetadataType = null; if (metadataType != null) { soapMetadataType = new SoapMetadataType() { Id = metadataType.Id, Name = metadataType.Name }; } Client.UpdateNodeMetadataAsync(domainId, nodeId, soapRelationshipId, soapDescriptorType, metadataName, metadataValue, soapMetadataType); }
private void OnConnectNodesCompletedNodeArgs(object sender, ConnectedNodesEventArgs e) { List <INodeProxy> nodes = new List <INodeProxy>(); TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>(); IMetadataTypeProxy metaDataTypeProxy = typeManager.GetMetadataType("double"); if (e.Relationship.RelationshipType.Name == "TransclusionRelationship") { foreach (IDescriptorProxy descriptorProxy in e.Relationship.Descriptors.GetByDescriptorTypeName("To")) { nodes.Add(descriptorProxy.Node); } if (e.Nodes.Length == 2) //TODO: Fix this, currently checking if it's just a transcluded node to map relationship { IDescriptorTypeProxy transclusionMapDesc = typeManager.GetDescriptorType("TransclusionMap"); MetadataContext xPositionKey = new MetadataContext() { NodeUid = e.Nodes[1].Id, MetadataName = "XPosition", RelationshipUid = e.Relationship.Id, DescriptorTypeUid = transclusionMapDesc.Id }; MetadataContext yPositionKey = new MetadataContext() { NodeUid = e.Nodes[1].Id, MetadataName = "YPosition", RelationshipUid = e.Relationship.Id, DescriptorTypeUid = transclusionMapDesc.Id }; //it'll be the second node that is the added node, the first node is the map - this is unsafe to assume so needs to be fixed UpdateNodeMetadataAsync(e.Nodes[1], e.Relationship.Id, transclusionMapDesc, "XPosition", e.Nodes[1].GetNodeMetadata(xPositionKey).MetadataValue, metaDataTypeProxy); UpdateNodeMetadataAsync(e.Nodes[1], e.Relationship.Id, transclusionMapDesc, "YPosition", e.Nodes[1].GetNodeMetadata(yPositionKey).MetadataValue, metaDataTypeProxy); } } else if (e.Relationship.RelationshipType.Name == "MapContainerRelationship") { //if it's a MapContainerRelationship update the positioning based on the context of this map it's being added to IDescriptorTypeProxy fromDescriptorTypeProxy = null; if (e.Relationship != null) { fromDescriptorTypeProxy = typeManager.GetDescriptorType("From"); MetadataContext xPositionKey = new MetadataContext() { NodeUid = e.Nodes[1].Id, MetadataName = "XPosition", RelationshipUid = e.Relationship.Id, DescriptorTypeUid = fromDescriptorTypeProxy.Id }; MetadataContext yPositionKey = new MetadataContext() { NodeUid = e.Nodes[1].Id, MetadataName = "YPosition", RelationshipUid = e.Relationship.Id, DescriptorTypeUid = fromDescriptorTypeProxy.Id }; //it'll be the second node that is the added node, the first node is the map - this is unsafe to assume so needs to be fixed UpdateNodeMetadataAsync(e.Nodes[1], e.Relationship.Id, fromDescriptorTypeProxy, "XPosition", e.Nodes[1].GetNodeMetadata(xPositionKey).MetadataValue, metaDataTypeProxy); UpdateNodeMetadataAsync(e.Nodes[1], e.Relationship.Id, fromDescriptorTypeProxy, "YPosition", e.Nodes[1].GetNodeMetadata(yPositionKey).MetadataValue, metaDataTypeProxy); nodes.Add(e.Nodes[1]); } } else { foreach (INodeProxy nodeProxy in e.Nodes) { nodes.Add(nodeProxy); } } NodesEventArgs nodesEventArgs = new NodesEventArgs(null, null, nodes.ToArray()); if (ConnectNodesCompleted != null) { ConnectNodesCompleted.Invoke(this, nodesEventArgs); } }
public void SetNodeMetadata(MetadataContext key, string metadataValue, IMetadataTypeProxy metadataType) { if (BaseSoapNode.Metadata != null) { if (HasMetadata(key)) { GetNodeMetadata(key).MetadataValue = metadataValue; } else { BaseSoapNode.Metadata.Add(key, new SoapMetadata() { MetadataName = key.MetadataName, MetadataType = new SoapMetadataType() { Id = metadataType.Id, Name = metadataType.Name }, MetadataValue = metadataValue }); } INodeService nodeService = IoC.IoCContainer.GetInjectionInstance().GetInstance<INodeService>(); TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance<TypeManager>(); IDescriptorTypeProxy descriptorType = null; if (key.DescriptorTypeUid.HasValue) { descriptorType = typeManager.GetDescriptorType(key.DescriptorTypeUid.Value); } Guid relationshipId = Guid.Empty; if (key.RelationshipUid.HasValue) { relationshipId = key.RelationshipUid.Value; } nodeService.UpdateNodeMetadataAsync(Domain, this.Id, relationshipId, descriptorType, key.MetadataName, metadataValue, metadataType); } }
public void UpdateNodeMetadataAsync(Guid domainId, Guid nodeId, Guid relationshipId, IDescriptorTypeProxy descriptorTypeProxy, string metadataName, string metadataValue, IMetadataTypeProxy metadataType) { Guid soapRelationshipId = Guid.Empty; if (relationshipId != Guid.Empty) { soapRelationshipId = relationshipId; } SoapDescriptorType soapDescriptorType = null; if (descriptorTypeProxy != null) { soapDescriptorType = new SoapDescriptorType() { Id = descriptorTypeProxy.Id, Name = descriptorTypeProxy.Name }; } SoapMetadataType soapMetadataType = null; if (metadataType != null) { soapMetadataType = new SoapMetadataType() { Id = metadataType.Id, Name = metadataType.Name }; } Client.UpdateNodeMetadataAsync(domainId, nodeId, soapRelationshipId, soapDescriptorType, metadataName, metadataValue, soapMetadataType); }
private void NodeContextMenu_Loaded(object sender, RoutedEventArgs e) { Command getPlayingStateCommand = new Command(); getPlayingStateCommand.Name = "GetPlayingState"; getPlayingStateCommand.Params = new List <Param>(); getPlayingStateCommand.Params.Add(new Param() { Name = "NodeId", Value = NodeProxy.Id.ToString() }); //Utilities.SendMessage<Command>(MessageSender, getPlayingStateCommand); playVideoMenuItem = new MenuItem(); playVideoMenuItem.Header = "Play Video Segment"; MetadataContext videoSourceKey = new MetadataContext() { MetadataName = "Video.Source", NodeUid = NodeProxy.Id }; playVideoMenuItem.Click += new RoutedEventHandler(playVideoMenuItem_Click); pauseVideoMenuItem = new MenuItem(); pauseVideoMenuItem.Header = "Pause Video Segment"; pauseVideoMenuItem.Click += delegate(object sender2, RoutedEventArgs e2) { Command pauseCommand = new Command(); pauseCommand.Name = "Pause"; //Utilities.SendMessage<Command>(MessageSender, pauseCommand); }; if (!NodeProxy.HasMetadata(videoSourceKey)) { playVideoMenuItem.IsEnabled = false; pauseVideoMenuItem.IsEnabled = false; } this.Items.Add(playVideoMenuItem); this.Items.Add(pauseVideoMenuItem); Separator videoOpSep = new Separator(); this.Items.Add(videoOpSep); MenuItem recordStartPosition = new MenuItem(); recordStartPosition.Header = "Record Start Position"; recordStartPosition.Click += delegate(object sender2, RoutedEventArgs e2) { Command getStartPositionCommand = new Command(); getStartPositionCommand.Name = "GetSourceAndPosition"; getStartPositionCommand.Params = new List <Param>(); getStartPositionCommand.Params.Add(new Param() { Name = "CallbackId", Value = "StartPosition" }); getStartPositionCommand.Params.Add(new Param() { Name = "NodeId", Value = NodeProxy.Id.ToString() }); //Utilities.SendMessage<Command>(MessageSender, getStartPositionCommand); }; this.Items.Add(recordStartPosition); MenuItem recordEndPosition = new MenuItem(); recordEndPosition.Header = "Record End Position"; recordEndPosition.Click += delegate(object sender2, RoutedEventArgs e2) { Command getEndPositionCommand = new Command(); getEndPositionCommand.Name = "GetSourceAndPosition"; getEndPositionCommand.Params = new List <Param>(); getEndPositionCommand.Params.Add(new Param() { Name = "CallbackId", Value = "EndPosition" }); getEndPositionCommand.Params.Add(new Param() { Name = "NodeId", Value = NodeProxy.Id.ToString() }); //Utilities.SendMessage<Command>(MessageSender, getEndPositionCommand); }; this.Items.Add(recordEndPosition); MenuItem clearVideoData = new MenuItem(); clearVideoData.Header = "Clear Node Video Markers"; clearVideoData.Click += delegate(object sender2, RoutedEventArgs e2) { TypeManager typeManager = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>(); IMetadataTypeProxy stringMetadataTypeProxy = typeManager.GetMetadataType("string"); Navigator.UpdateNodeMetadataAsync(NodeProxy, Guid.Empty, null, "Video.Source", "", stringMetadataTypeProxy); }; clearVideoData.IsEnabled = false; if (NodeProxy.HasMetadata(videoSourceKey)) { if (!string.IsNullOrEmpty(NodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue)) { clearVideoData.IsEnabled = true; } } this.Items.Add(clearVideoData); Separator videoOp2Sep = new Separator(); this.Items.Add(videoOp2Sep); MenuItem deleteNodeMenuItem = new MenuItem(); deleteNodeMenuItem.Header = "Delete Node"; deleteNodeMenuItem.Click += new RoutedEventHandler(deleteNodeMenuItem_Click); this.Items.Add(deleteNodeMenuItem); Separator copyOpSep = new Separator(); this.Items.Add(copyOpSep); MenuItem cloneMenuItem = new MenuItem(); cloneMenuItem.Header = "Clone"; cloneMenuItem.Click += new RoutedEventHandler(cloneMenuItem_Click); this.Items.Add(cloneMenuItem); MenuItem copyMenuItem = new MenuItem(); copyMenuItem.Header = "Copy"; copyMenuItem.Click += new RoutedEventHandler(copyMenuItem_Click); this.Items.Add(copyMenuItem); Separator propertiesSep = new Separator(); this.Items.Add(propertiesSep); MenuItem propertiesMenuItem = new MenuItem(); propertiesMenuItem.Header = "Properties..."; propertiesMenuItem.Click += new RoutedEventHandler(propertiesMenuItem_Click); this.Items.Add(propertiesMenuItem); Separator sendSep = new Separator(); this.Items.Add(sendSep); MenuItem sendMenuItem = new MenuItem(); sendMenuItem.Header = "Send to Web Part Connection"; sendMenuItem.Click += new RoutedEventHandler(sendMenuItem_Click); this.Items.Add(sendMenuItem); }
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); }