コード例 #1
0
 public void Refresh()
 {
     bindingEditor = new BindingEditor();
     filterEditor.UpdateStore(Settings?.Filters);
     toolEditor.UpdateStore(Settings?.Tools);
     outputModeEditor.Refresh();
 }
コード例 #2
0
        private ElementBindingSourceNode BuildTree(SceneElement element, BindingEditor bindingEditor)
        {
            ElementBindingSourceNode bindingSourceNode1 = new ElementBindingSourceNode(element, this.selectionContext);

            foreach (SceneNode sceneNode in element.GetAllContent())
            {
                BaseFrameworkElement frameworkElement = sceneNode as BaseFrameworkElement;
                if (frameworkElement != null)
                {
                    ElementBindingSourceNode bindingSourceNode2 = this.BuildTree((SceneElement)frameworkElement, bindingEditor);
                    if (bindingSourceNode2 != null)
                    {
                        bindingSourceNode1.AddChild((ElementNode)bindingSourceNode2);
                    }
                }
            }
            if (element.ViewModel.TimelineItemManager.SortByZOrder)
            {
                bindingSourceNode1.Children.Reverse();
            }
            if (bindingSourceNode1.Element is StyleNode)
            {
                bindingSourceNode1.IsSelectable = false;
            }
            return(bindingSourceNode1);
        }
コード例 #3
0
        private bool BindingFilter(DataSchemaItem item)
        {
            switch (this.CurrentBindingFilterMode)
            {
            case BindingFilterMode.None:
                return(true);

            case BindingFilterMode.FilterByType:
                DataSchemaItem  dataSchemaItem = item;
                IProjectContext projectContext = this.TargetElement.ProjectContext;
                if (item.Parent != null && !BindingEditor.CanBindToSchemaNode(this.TargetElement, (IPropertyId)this.TargetProperty, dataSchemaItem.DataSchemaNode))
                {
                    return(dataSchemaItem.HasChildren);
                }
                return(true);

            default:
                return(true);
            }
        }
コード例 #4
0
        private Control ConstructMainControls()
        {
            // Main Content
            var tabControl = new TabControl
            {
                Pages =
                {
                    new TabPage
                    {
                        Text    = "Output",
                        Content = outputModeEditor = new OutputModeEditor()
                    },
                    new TabPage
                    {
                        Text    = "Bindings",
                        Content = bindingEditor = new BindingEditor()
                    },
                    new TabPage
                    {
                        Text    = "Filters",
                        Padding = 5,
                        Content = filterEditor = new PluginSettingStoreCollectionEditor <IPositionedPipelineElement <IDeviceReport> >
                        {
                            FriendlyTypeName = "Filter"
                        }
                    },
                    new TabPage
                    {
                        Text    = "Tools",
                        Padding = 5,
                        Content = toolEditor = new PluginSettingStoreCollectionEditor <ITool>
                        {
                            FriendlyTypeName = "Tool"
                        }
                    },
                    new TabPage
                    {
                        Text    = "Console",
                        Padding = 5,
                        Content = new LogView()
                    }
                }
            };

            outputModeEditor.StoreBinding.BindDataContext <App>(a => a.Settings.OutputMode);
            bindingEditor.TipButtonStoreBinding.BindDataContext <App>(a => a.Settings.TipButton);
            bindingEditor.EraserButtonStoreBinding.BindDataContext <App>(a => a.Settings.EraserButton);
            bindingEditor.TipPressureValueBinding.BindDataContext <App>(a => a.Settings.TipActivationPressure);
            bindingEditor.EraserPressureValueBinding.BindDataContext <App>(a => a.Settings.EraserActivationPressure);
            bindingEditor.PenButtonItemSourceBinding.BindDataContext <App>(a => a.Settings.PenButtons);
            bindingEditor.AuxiliaryButtonItemSourceBinding.BindDataContext <App>(a => a.Settings.AuxButtons);
            filterEditor.StoreCollectionBinding.BindDataContext <App>(a => a.Settings.Filters);
            toolEditor.StoreCollectionBinding.BindDataContext <App>(a => a.Settings.Tools);

            var commandsPanel = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                Padding = new Padding(0, 5),
                Spacing = 5,
                Items   =
                {
                    new Button(async(s, e) => await SaveSettings(App.Current.Settings))
                    {
                        Text = "Save"
                    },
                    new Button(async(s, e) => await ApplySettings())
                    {
                        Text = "Apply"
                    }
                }
            };

            outputModeEditor.SetDisplaySize(DesktopInterop.VirtualScreen.Displays);

            return(new StackLayout
            {
                Items =
                {
                    new StackLayoutItem(tabControl,    HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(commandsPanel, HorizontalAlignment.Right)
                }
            });
        }
コード例 #5
0
        private Control ConstructMainControls()
        {
            // Main Content
            var tabControl = new TabControl
            {
                Pages =
                {
                    new TabPage
                    {
                        Text    = "Output",
                        Content = outputModeEditor = new OutputModeEditor()
                    },
                    new TabPage
                    {
                        Text    = "Bindings",
                        Content = bindingEditor = new BindingEditor()
                    },
                    new TabPage
                    {
                        Text    = "Filters",
                        Padding = 5,
                        Content = filterEditor = new PluginSettingStoreCollectionEditor <IFilter>(
                            Settings?.Filters,
                            "Filter"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Tools",
                        Padding = 5,
                        Content = toolEditor = new PluginSettingStoreCollectionEditor <ITool>(
                            Settings?.Tools,
                            "Tool"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Interpolators",
                        Padding = 5,
                        Content = interpolatorEditor = new PluginSettingStoreCollectionEditor <Interpolator>(
                            Settings?.Interpolators,
                            "Interpolator"
                            )
                    },
                    new TabPage
                    {
                        Text    = "Console",
                        Padding = 5,
                        Content = new LogView()
                    }
                }
            };

            SettingsChanged += (settings) =>
            {
                filterEditor.UpdateStore(Settings?.Filters);
                toolEditor.UpdateStore(Settings?.Tools);
                interpolatorEditor.UpdateStore(Settings?.Interpolators);
            };

            var commandsPanel = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                Padding = new Padding(0, 5),
                Spacing = 5,
                Items   =
                {
                    new Button(async(s, e) => await SaveSettings(Settings))
                    {
                        Text = "Save"
                    },
                    new Button(async(s, e) => await ApplySettings())
                    {
                        Text = "Apply"
                    }
                }
            };

            outputModeEditor.SetDisplaySize(SystemInterop.VirtualScreen.Displays);

            return(new StackLayout
            {
                Items =
                {
                    new StackLayoutItem(tabControl,    HorizontalAlignment.Stretch, true),
                    new StackLayoutItem(commandsPanel, HorizontalAlignment.Right)
                }
            });
        }
コード例 #6
0
        public static SceneNode CreateAndSetBindingOrData(DesignerContext designerContext, SceneNode target, ReferenceStep targetProperty)
        {
            SceneNode sceneNode = (SceneNode)null;

            using (DataBindingDialog dataBindingDialog = new DataBindingDialog(target, targetProperty))
            {
                bool?nullable = dataBindingDialog.ShowDialog();
                if ((!nullable.GetValueOrDefault() ? 1 : (!nullable.HasValue ? true : false)) != 0)
                {
                    return((SceneNode)null);
                }
                using (target.ViewModel.AnimationEditor.DeferKeyFraming())
                {
                    using (SceneEditTransaction editTransaction = target.ViewModel.CreateEditTransaction(StringTable.UndoUnitSetBinding))
                    {
                        sceneNode = dataBindingDialog.model.CreateBindingOrData();
                        bool             flag    = sceneNode != null;
                        BindingSceneNode binding = sceneNode as BindingSceneNode;
                        if (binding != null)
                        {
                            flag = false;
                            if (binding.ElementBindingTarget != null)
                            {
                                binding.ElementBindingTarget.EnsureNamed();
                                binding.ElementName = binding.ElementBindingTarget.Name;
                            }
                            string errorMessage;
                            if (!binding.IsBindingLegal(target, targetProperty, out errorMessage))
                            {
                                MessageBoxArgs args = new MessageBoxArgs()
                                {
                                    Message = errorMessage,
                                    Button  = MessageBoxButton.OK,
                                    Image   = MessageBoxImage.Hand
                                };
                                int num = (int)designerContext.MessageDisplayService.ShowMessage(args);
                            }
                            else
                            {
                                IPropertyId propertyKey = (IPropertyId)targetProperty;
                                if (binding.Source != null)
                                {
                                    ISchema schema = dataBindingDialog.model.CurrentBindingSource.Schema;
                                    if (schema != null && schema.DataSource != null && schema.DataSource.DocumentNode != null)
                                    {
                                        propertyKey = BindingEditor.RefineDataContextProperty(target, (IPropertyId)targetProperty, schema.DataSource.DocumentNode);
                                    }
                                }
                                target.SetBinding(propertyKey, binding);
                                flag = true;
                            }
                        }
                        if (flag)
                        {
                            editTransaction.Commit();
                        }
                        else
                        {
                            editTransaction.Cancel();
                        }
                    }
                }
                return(sceneNode);
            }
        }