private void OnEditResource(object sender, ExecutedRoutedEventArgs e) { TabbedColorEditorControl colorEditorControl = sender as TabbedColorEditorControl; if (colorEditorControl != null) { SceneNodeProperty editingProperty = colorEditorControl.editingProperty; if (!editingProperty.IsValueSystemResource) { if (this.resourcePopupOpen) { this.resourceEditorPopup.IsOpen = false; } else { this.resourceEditorPopup = new WorkaroundPopup(); this.resourceEditorPopup.Child = (UIElement) new ResourceEditorControl(editingProperty.SceneNodeObjectSet.DesignerContext, editingProperty); UIElement uiElement = e.Parameter as UIElement; if (uiElement != null) { Point point = uiElement.TransformToAncestor((Visual)colorEditorControl).Transform(new Point(0.0, 0.0)); this.resourceEditorPopup.PlacementTarget = (UIElement)colorEditorControl; this.resourceEditorPopup.Placement = PlacementMode.RelativePoint; this.resourceEditorPopup.HorizontalOffset = point.X; this.resourceEditorPopup.VerticalOffset = point.Y + uiElement.RenderSize.Height; this.resourceEditorPopup.Closed += new EventHandler(this.EditResourcePopupClosed); this.resourceEditorPopup.IsOpen = true; this.resourcePopupOpen = true; } } } } e.Handled = true; }
private void OnPropertyMarkerCommandsEditResourceCommand(object sender, ExecutedRoutedEventArgs eventArgs) { SceneNodeProperty associatedProperty = this.AssociatedProperty; if (associatedProperty != null) { using (WorkaroundPopup.LockOpen((DependencyObject)this)) associatedProperty.DoEditResource(); } eventArgs.Handled = true; }
private void OnAddItem(object sender, EventArgs e) { if (this.editingValue == null) { return; } SceneNodeProperty sceneNodeProperty = this.editingProperty as SceneNodeProperty; if (sceneNodeProperty == null) { return; } SceneNodeObjectSet sceneNodeObjectSet = sceneNodeProperty.SceneNodeObjectSet; if (sceneNodeObjectSet == null) { return; } CommandTarget commandTarget = sceneNodeObjectSet.DesignerContext.ProjectManager as CommandTarget; if (commandTarget == null) { return; } string commandName = "Project_AddExistingItemOfType"; IProject currentProject = this.GetCurrentProject(); if (currentProject == null) { return; } IDocumentType[] documentTypeArray = this.GetSupportedDocumentTypesFromSelection(); if (documentTypeArray == UriEditor.multiScaleDocuments) { List <IDocumentType> list = Enumerable.ToList <IDocumentType>((IEnumerable <IDocumentType>)documentTypeArray); list.Remove(sceneNodeObjectSet.DesignerContext.DocumentTypeManager.DocumentTypes[DocumentTypeNamesHelper.DeepZoom]); documentTypeArray = list.ToArray(); } commandTarget.SetCommandProperty(commandName, "DocumentTypes", (object)documentTypeArray); commandTarget.SetCommandProperty(commandName, "Project", (object)currentProject); commandTarget.SetCommandProperty(commandName, "SelectAddedItems", (object)false); commandTarget.SetCommandProperty(commandName, "TargetFolder", (object)Microsoft.Expression.Framework.Documents.PathHelper.GetDirectory(sceneNodeObjectSet.ViewModel.Document.DocumentReference.Path)); commandTarget.SetCommandProperty(commandName, "TemporarilyStopProjectPaneActivation", (object)true); using (WorkaroundPopup.LockOpen((DependencyObject)this)) commandTarget.Execute(commandName, CommandInvocationSource.Palette); IProjectItem projectItem = EnumerableExtensions.SingleOrNull <IProjectItem>((IEnumerable <IProjectItem>)commandTarget.GetCommandProperty(commandName, "AddedProjectItems")); if (projectItem == null) { return; } this.ProjectItemSource = new ProjectItemModel(projectItem, this.DocumentContext, 0); }
private void OnPropertyMarkerCommandsCustomExpressionCommand(object sender, ExecutedRoutedEventArgs eventArgs) { SceneNodeProperty associatedProperty = this.AssociatedProperty; if (associatedProperty != null) { using (WorkaroundPopup.LockOpen((DependencyObject)this)) { associatedProperty.DoEditCustomExpression((FrameworkElement)this); PropertyMarker.ResetPropertyContainerMode((RoutedEventArgs)eventArgs); } } eventArgs.Handled = true; }
private void OnPropertyMarkerCommandsTemplateBindingCommand(object sender, ExecutedRoutedEventArgs eventArgs) { SceneNodeProperty associatedProperty = this.AssociatedProperty; if (associatedProperty != null) { using (WorkaroundPopup.LockOpen((DependencyObject)this)) { associatedProperty.DoSetToTemplateBinding((TemplateBindablePropertyModel)eventArgs.Parameter); PropertyMarker.ResetPropertyContainerMode((RoutedEventArgs)eventArgs); } } eventArgs.Handled = true; }
private void OnPropertyMarkerCommandsClearValueCommand(object sender, ExecutedRoutedEventArgs eventArgs) { SceneNodeProperty associatedProperty = this.AssociatedProperty; if (associatedProperty != null) { using (WorkaroundPopup.LockOpen((DependencyObject)this)) { associatedProperty.DoClearValue(); PropertyMarker.ResetPropertyContainerMode((RoutedEventArgs)eventArgs); } } eventArgs.Handled = true; }