Ejemplo n.º 1
0
        private void OnCanOpenDialogWindow(object sender, CanExecuteRoutedEventArgs eventArgs)
        {
            DataTemplate dialogEditorTemplate = PropertyEditingHelper.GetDialogEditorTemplate(PropertyEditingHelper.GetEditedProperty(eventArgs.OriginalSource, eventArgs.Parameter));

            eventArgs.CanExecute = dialogEditorTemplate != null;
            eventArgs.Handled    = true;
        }
Ejemplo n.º 2
0
        private void OnOpenDialogWindow(object sender, ExecutedRoutedEventArgs eventArgs)
        {
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)PropertyEditingHelper.GetEditedProperty(eventArgs.OriginalSource, eventArgs.Parameter);
            DataTemplate dialogEditorTemplate           = PropertyEditingHelper.GetDialogEditorTemplate((PropertyEntry)referenceProperty);

            if (dialogEditorTemplate == null)
            {
                return;
            }
            Dialog dialog    = (Dialog) new DialogValueEditorHost(referenceProperty.get_PropertyValue(), dialogEditorTemplate);
            int    remaining = 0;
            SceneEditTransaction sceneEditTransaction = (SceneEditTransaction)null;

            if (this.ActiveDocument != null)
            {
                this.CommitOutstandingTransactions(0);
                sceneEditTransaction = this.ActiveDocument.CreateEditTransaction(string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.DialogValueEditorUndoDescription, new object[1]
                {
                    (object)referenceProperty.get_DisplayName()
                }));
                this.editTransactions.Push(sceneEditTransaction);
                remaining = this.editTransactions.Count;
            }
            bool?nullable = dialog.ShowDialog();

            if (this.ActiveDocument != null)
            {
                this.CommitOutstandingTransactions(remaining);
                if (nullable.HasValue && nullable.Value)
                {
                    sceneEditTransaction.Commit();
                }
                else
                {
                    sceneEditTransaction.Cancel();
                }
                this.editTransactions.Pop();
            }
            eventArgs.Handled = true;
        }