public void AddCommandBindings(UIElement host, SupportedPropertyCommands supportedCommands) { host.SetValue(ExpressionPropertyValueEditorCommands.ExpressionPropertyValueEditorCommandsProperty, (object)new ExpressionPropertyValueEditorCommands() { BeginTransaction = new ExpressionPropertyValueEditorCommand((ExpressionPropertyValueEditorCommandHandler)(obj => this.OnBeginTransaction(obj))), CommitTransaction = new ExpressionPropertyValueEditorCommand((ExpressionPropertyValueEditorCommandHandler)(obj => this.OnCommitTransaction(obj))), AbortTransaction = new ExpressionPropertyValueEditorCommand((ExpressionPropertyValueEditorCommandHandler)(obj => this.OnAbortTransaction(obj))) }); if ((supportedCommands & SupportedPropertyCommands.Transactions) == SupportedPropertyCommands.Transactions) { host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_BeginTransaction(), new ExecutedRoutedEventHandler(this.OnBeginTransaction))); host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_CommitTransaction(), new ExecutedRoutedEventHandler(this.OnCommitTransaction))); host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_AbortTransaction(), new ExecutedRoutedEventHandler(this.OnAbortTransaction))); } if ((supportedCommands & SupportedPropertyCommands.DialogEditor) == SupportedPropertyCommands.DialogEditor) { host.CommandBindings.Add(new CommandBinding((ICommand)PropertyContainer.get_OpenDialogWindow(), new ExecutedRoutedEventHandler(this.OnOpenDialogWindow), new CanExecuteRoutedEventHandler(this.OnCanOpenDialogWindow))); host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_ShowDialogEditor(), new ExecutedRoutedEventHandler(this.OnShowDialogEditor))); } if ((supportedCommands & SupportedPropertyCommands.PinnedEditor) == SupportedPropertyCommands.PinnedEditor) { host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_ShowExtendedPinnedEditor(), new ExecutedRoutedEventHandler(this.OnShowExtendedPinnedEditor))); } if ((supportedCommands & SupportedPropertyCommands.PopupEditor) == SupportedPropertyCommands.PopupEditor) { host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_ShowExtendedPopupEditor(), new ExecutedRoutedEventHandler(this.OnShowExtendedPopupEditor))); } host.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_ShowInlineEditor(), new ExecutedRoutedEventHandler(this.OnShowInlineEditor))); host.SetValue(PropertyEditingHelper.SupportedPropertyCommandsProperty, (object)supportedCommands); }
public EasingEditorPopup(SceneNodeProperty easingFunctionProperty, SceneView returnView) { this.EasingFunctionProperty = easingFunctionProperty; this.returnView = returnView; this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand))); this.InitializeComponent(); }
public GradientStopColorPopup(PropertyReferenceProperty colorProperty, DesignerContext designerContext) { this.ColorProperty = colorProperty; this.DesignerContext = designerContext; this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand))); this.InitializeComponent(); }
public TransitionEffectPickerPopup(SceneNodeProperty transitionEffectProperty, SceneView returnView) { this.TransitionEffectProperty = transitionEffectProperty; this.returnView = returnView; this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand))); this.InitializeComponent(); }
public ResourceEditorControl(DesignerContext designerContext, SceneNodeProperty editingProperty) { this.designerContext = designerContext; this.editingProperty = editingProperty; this.resourceModel = this.BuildResourceModelFromPropertyReference(); this.editingValue = this.resourceModel.EditorValue; this.transactionHelper = new PropertyEditingHelper(this.resourceModel.Document, (UIElement)this); this.DataContext = (object)this; this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnFinishEditing))); PropertyInspectorHelper.SetOwningPropertyInspectorModel((DependencyObject)this, (IPropertyInspector)this); PropertyInspectorHelper.SetOwningPropertyInspectorElement((DependencyObject)this, (UIElement)this); this.InitializeComponent(); }
internal SceneNodePropertyInspectorPane(PropertyInspectorModel propertyInspectorModel) { this.propertyInspectorModel = propertyInspectorModel; this.DataContext = (object)propertyInspectorModel; PropertyInspectorHelper.SetOwningPropertyInspectorModel((DependencyObject)this, (IPropertyInspector)propertyInspectorModel); PropertyInspectorHelper.SetOwningPropertyInspectorElement((DependencyObject)this, (UIElement)this); propertyInspectorModel.TransactionHelper.AddCommandBindings((UIElement)this, SupportedPropertyCommands.All); this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand))); this.InitializeComponent(); this.SetValue(DesignerProperties.IsInDesignModeProperty, (object)false); this.Loaded += new RoutedEventHandler(this.This_Loaded); this.Unloaded += new RoutedEventHandler(this.This_Unloaded); }
public virtual void ShowDialog(PropertyValue propertyValue, IInputElement commandSource) { this.activeDialog = (Dialog) new DialogValueEditorHost(propertyValue, this.template); ValueEditorUtils.SetHandlesCommitKeys((DependencyObject)this.activeDialog, true); Type genericCollectionType = CollectionAdapterDescription.GetGenericCollectionType(propertyValue.get_ParentProperty().get_PropertyType()); string str = ""; if (genericCollectionType != (Type)null) { str = genericCollectionType.Name + " "; } this.activeDialog.Title = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.CollectionEditorDialogTitle, new object[2] { (object)str, (object)propertyValue.get_ParentProperty().get_PropertyName() }); this.activeDialog.ResizeMode = ResizeMode.CanResize; this.activeDialog.Width = 600.0; this.activeDialog.Height = 600.0; this.activeDialog.SizeToContent = SizeToContent.Manual; this.activeDialog.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.get_FinishEditing(), new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand))); PropertyValueEditorCommands.get_BeginTransaction().Execute((object)new PropertyTransactionParameters() { TransactionDescription = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1] { (object)propertyValue.get_ParentProperty().get_PropertyName() }), TransactionType = SceneEditTransactionType.Normal }, commandSource); bool?nullable = new bool?(); try { nullable = this.activeDialog.ShowDialog(); } catch { this.messageDisplayService.ShowError(StringTable.CollectionEditorErrorMessage); this.activeDialog.Close(); } if (nullable.HasValue && nullable.Value) { PropertyValueEditorCommands.get_CommitTransaction().Execute(null, commandSource); } else { PropertyValueEditorCommands.get_AbortTransaction().Execute(null, commandSource); } }
private void SetPropertyValueCore(SceneNodeProperty parentProperty, SceneNode valueAsSceneNode) { parentProperty.SetValue(valueAsSceneNode.DocumentNode); if (!valueAsSceneNode.TrueTargetType.IsClass) { return; } SceneNodePropertyCollection propertyCollection = (SceneNodePropertyCollection)parentProperty.get_PropertyValue().get_SubProperties(); propertyCollection.Rebuild(); if (((PropertyEntryCollection)propertyCollection).get_Count() <= 0 || !((SceneNodeProperty)this.PropertyValue.get_ParentProperty()).SceneNodeObjectSet.IsViewRepresentationValid) { return; } PropertyValueEditorCommands.get_ShowExtendedPinnedEditor().Execute(null, (IInputElement)this); }
private void ReverseGradientStopsHandler() { PropertyValueEditorCommands.get_BeginTransaction().Execute((object)null, (IInputElement)this.BrushEditor); if (!this.BasisProperty.IsValueLocal) { this.BasisProperty.DoSetLocalValue(); } Dictionary <double, List <GradientStopEditor> > dictionary = new Dictionary <double, List <GradientStopEditor> >(); foreach (GradientStopEditor gradientStopEditor in (IEnumerable)this.GradientStops) { if (!dictionary.ContainsKey(gradientStopEditor.Offset)) { dictionary.Add(gradientStopEditor.Offset, new List <GradientStopEditor>()); } dictionary[gradientStopEditor.Offset].Add(gradientStopEditor); } SceneNodeObjectSet sceneNodeObjectSet = this.BasisProperty.SceneNodeObjectSet; foreach (KeyValuePair <double, List <GradientStopEditor> > keyValuePair in dictionary) { double key = keyValuePair.Key; List <GradientStopEditor> list = keyValuePair.Value; bool flag = list.Count > 1; bool isMixed = false; for (int index = 0; index < list.Count; ++index) { list[index].Offset = RoundingHelper.RoundScale(1.0 - key); if (flag && index < list.Count / 2) { GradientStopEditor gradientStopEditor1 = list[index]; GradientStopEditor gradientStopEditor2 = list[list.Count - 1 - index]; DocumentNode valueAsDocumentNode1 = gradientStopEditor1.ColorProperty.GetLocalValueAsDocumentNode(false, out isMixed); DocumentNode valueAsDocumentNode2 = gradientStopEditor2.ColorProperty.GetLocalValueAsDocumentNode(false, out isMixed); gradientStopEditor1.ColorProperty.SetValue((object)valueAsDocumentNode2); gradientStopEditor2.ColorProperty.SetValue((object)valueAsDocumentNode1); } } } PropertyValueEditorCommands.get_CommitTransaction().Execute((object)null, (IInputElement)this.BrushEditor); this.RebuildModel(-1); }
private void HookEditEndingHandlers(FrameworkElement element) { PropertyEditingHelper.CommandBindingHolder commandBindingHolder = (PropertyEditingHelper.CommandBindingHolder)null; UIElement uiElement = (UIElement)element.GetValue(PropertyInspectorHelper.OwningPropertyInspectorElementProperty); if (this.host == null || this.host != uiElement) { this.host = uiElement; } if (!this.commandBindingReferences.TryGetValue(element, out commandBindingHolder)) { commandBindingHolder = new PropertyEditingHelper.CommandBindingHolder(); commandBindingHolder.AbortCommandBinding = new CommandBinding((ICommand)PropertyValueEditorCommands.get_AbortTransaction(), new ExecutedRoutedEventHandler(this.OnAbortOrCommitTransaction)); commandBindingHolder.CommitCommandBinding = new CommandBinding((ICommand)PropertyValueEditorCommands.get_CommitTransaction(), new ExecutedRoutedEventHandler(this.OnCommitTransaction)); element.CommandBindings.Add(commandBindingHolder.AbortCommandBinding); element.CommandBindings.Add(commandBindingHolder.CommitCommandBinding); this.commandBindingReferences.Add(element, commandBindingHolder); } ++commandBindingHolder.RefCount; }