public ExportWithUnitsViewModel(ExportWithUnits model, NodeView nodeView)
 {
     exportWithUnitsModel = model;           
     nodeViewModel = nodeView.ViewModel;
     nodeModel = nodeView.ViewModel.NodeModel;
     model.PropertyChanged +=model_PropertyChanged;      
 }
Пример #2
0
 public ConverterViewModel(DynamoConvert model,NodeView nodeView)
 {
     dynamoConvertModel = model;           
     nodeViewModel = nodeView.ViewModel;
     nodeModel = nodeView.ViewModel.NodeModel;
     model.PropertyChanged +=model_PropertyChanged;
     ToggleButtonClick = new DelegateCommand(OnToggleButtonClick, CanToggleButton);         
 }
 private void TryApplyCustomization(NodeModel model, NodeView view, InternalNodeViewCustomization customization)
 {
     try
     {
         var disposable = customization.CustomizeView(model, view);
         view.Unloaded += (s, a) => disposable.Dispose();
     }
     catch (Exception e)
     {
         var message = string.Format(Wpf.Properties.Resources.MessageFailedToApplyCustomization, model.GetType().Name);
         logger.LogError(message);
         logger.Log(e);
     }
 }
        /// <summary>
        /// Create CodeCOmpletionEditor with NodeViewModel
        /// </summary>
        /// <param name="nodeView"></param>
        public CodeCompletionEditor(NodeView nodeView)
        {
            InitializeComponent();

            nodeView.Unloaded += (obj, args) => IsDisposed = true;
            this.nodeViewModel = nodeView.ViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.InnerTextEditor.TextChanged += OnTextChanged;
            this.InnerTextEditor.TextArea.LostFocus += OnTextAreaLostFocus;
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            CodeHighlightingRuleFactory.CreateHighlightingRules(InnerTextEditor, dynamoViewModel.EngineController);
        }
Пример #5
0
        private void DelimitFieldView()
        {
            NodeView nvTmp;
            Point startPositionNode = new Point(135,780);

            for (int i = 0; i < 6; ++i)
            {
                for (int j = 0; j < 12; ++j)
                {
                    nvTmp = new NodeView();
                   // nvTmp.Margin = new Thickness(startPositionNode.X + i * 64, startPositionNode.Y - j * 61, 0, 0);
                    GridField.Children.Add(nvTmp);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Create code block editor by the view of code block node.
        /// </summary>
        /// <param name="nodeView"></param>
        public CodeBlockEditor(NodeView nodeView): base(nodeView)
        {
            this.codeBlockNode = nodeViewModel.NodeModel as CodeBlockNodeModel;
            if (codeBlockNode == null)
            {
                throw new InvalidOperationException(
                    "Should not be used for nodes other than code block");
            }

            // Determines if this editor is created for a new code block node.
            // In cases like an undo/redo operation, the editor is created for 
            // an existing code block node.
            createdForNewCodeBlock = string.IsNullOrEmpty(codeBlockNode.Code);

            // the code block should not be in focus upon undo/redo actions on node
            if (codeBlockNode.ShouldFocus)
            {
                Loaded += (obj, args) => SetFocus(); 
            }

            WatermarkLabel.Text = Properties.Resources.WatermarkLabelText;
        }
        internal void Apply(NodeView view)
        {
            var model = view.ViewModel.NodeModel;

            // We only apply the most specific INodeViewCustomization!

            // By "specific", we mean the INodeViewCustomization<T> where
            // T is closest to the runtime type of the NodeModel

            Type nodeModelType = model.GetType();
            Type customizableType = null;

            do
            {
                if (lookupDict.ContainsKey(nodeModelType))
                {
                    customizableType = nodeModelType;
                    break;
                }

                nodeModelType = nodeModelType.BaseType;

            } while (nodeModelType != typeof(NodeModel));

            // If there is a NodeViewCustomization<T>, apply the most specific one
            if (customizableType != null)
            {
                // There may be multiple customizations to apply
                List<InternalNodeViewCustomization> custs;
                if (lookupDict.TryGetValue(customizableType, out custs))
                {
                    foreach (var customization in custs)
                    {
                        TryApplyCustomization(model, view, customization);
                    }
                }
            }
        }
Пример #8
0
        public CodeBlockEditor(NodeView nodeView): this()
        {
           
            this.nodeViewModel = nodeView.ViewModel;
            this.dynamoViewModel = nodeViewModel.DynamoViewModel;
            this.DataContext = nodeViewModel.NodeModel;
            this.nodeModel = nodeViewModel.NodeModel as CodeBlockNodeModel;
            
            if (nodeModel == null)
            {
                throw new InvalidOperationException(
                    "Should not be used for nodes other than code block");
            }

            // Determines if this editor is created for a new code block node.
            // In cases like an undo/redo operation, the editor is created for 
            // an existing code block node.
            createdForNewCodeBlock = string.IsNullOrEmpty(nodeModel.Code);

            // Register text editing events            
            this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged;
            this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus;
            nodeView.Unloaded += (obj, args) => isDisposed = true;

            // the code block should not be in focus upon undo/redo actions on node
            if (this.nodeModel.ShouldFocus)
            {
                this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus();
            }

            // Register auto-completion callbacks
            this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering;
            this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered;

            InitializeSyntaxHighlighter();
        }
Пример #9
0
 public ReadMulti3Channel(NodeView graph) : base(graph) { }
Пример #10
0
 private static void OverrideFont(this NodeView widget)
 {
     (widget as Container).OverrideFont(MainFont, Pango.Weight.Semibold);
     (widget as Widget).OverrideFont(CondensedFont);
 }
Пример #11
0
 void SetupNodeView(NodeView nodeView, NodeGraphData.NodeData nodeData)
 {
     nodeView.OnShowContextMenu += (genericMenu) => SetupNodeContextMenuItems(nodeData, genericMenu);
 }
Пример #12
0
 public WriteMulti3Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY)
 {
 }
Пример #13
0
        /// <summary>
        /// 获取节点上的执行者列表
        /// </summary>
        /// <param name="nextNode"></param>
        /// <returns></returns>
        public PerformerList GetPerformerList(NodeView nextNode)
        {
            var performerList = PerformerBuilder.CreatePerformerList(nextNode.Roles);

            return(performerList);
        }
Пример #14
0
 public DCT(NodeView graph) : base(graph) { }
Пример #15
0
 public Merge(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #16
0
 public Merge(NodeView graph) : base(graph) { }
Пример #17
0
 public ColorNode(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #18
0
 public ColorNode(NodeView graph) : base(graph) { }
Пример #19
0
 public ColorSpace(NodeView graph) : base(graph) { }
Пример #20
0
 public ReadMulti2Channel(NodeView graph) : base(graph)
 {
 }
Пример #21
0
 public MoVecCompose(NodeView graph) : base(graph)
 {
 }
Пример #22
0
 public DCT(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #23
0
 public FileNode(NodeView nodeView, string filePath)
     : base(nodeView)
 {
     this.FilePath = filePath;
     this.Text     = Path.GetFileName(filePath);
 }
Пример #24
0
 public NoOp(NodeView graph) : base(graph) { }
Пример #25
0
 public void CustomizeView(VolumeFromString model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
 }
Пример #26
0
 public NoOp(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
 public void CustomizeView(ReferenceSelection model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
     model.RevitDynamoModel = nodeView.ViewModel.DynamoViewModel.Model as RevitDynamoModel;
 }
Пример #28
0
 /// <summary>
 /// Create input editor by the view of symbol node.
 /// </summary>
 /// <param name="view"></param>
 public ParameterEditor(NodeView view) : base(view)
 {
     input = nodeViewModel.NodeModel as Symbol;
 }
Пример #29
0
 public MoVecDecompose(NodeView graph) : base(graph) { }
Пример #30
0
 public void DestroyBoard(bool playSound = true)
 {
     _lastNodePulled = null;
     _puzzleSpawner.DestroyBoard(playSound);
     _saveState.Started = false;
 }
Пример #31
0
        public void CustomizeView(ColorRange model, NodeView nodeView)
        {
            var drawPlane = new Image
            {
                Stretch             = Stretch.Fill,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Width  = 100,
                Height = 200
            };

            var dm = nodeView.ViewModel.DynamoViewModel.Model;

            nodeView.inputGrid.Children.Add(drawPlane);

            model.RequestChangeColorRange += delegate
            {
                model.DispatchOnUIThread(delegate
                {
                    var colorStartNode = model.InPorts[0].Connectors[0].Start.Owner;
                    var startIndex     = model.InPorts[0].Connectors[0].Start.Index;
                    var colorEndNode   = model.InPorts[1].Connectors[0].Start.Owner;
                    var endIndex       = model.InPorts[1].Connectors[0].Start.Index;

                    var startId = colorStartNode.GetAstIdentifierForOutputIndex(startIndex).Name;
                    var endId   = colorEndNode.GetAstIdentifierForOutputIndex(endIndex).Name;

                    var startMirror = dm.EngineController.GetMirror(startId);
                    var endMirror   = dm.EngineController.GetMirror(endId);

                    object start = null;
                    object end   = null;

                    if (startMirror == null)
                    {
                        start = DSCore.Color.ByARGB(255, 192, 192, 192);
                    }
                    else
                    {
                        if (startMirror.GetData().IsCollection)
                        {
                            start = startMirror.GetData().GetElements().
                                    Select(x => x.Data).FirstOrDefault();
                        }
                        else
                        {
                            start = startMirror.GetData().Data;
                        }
                    }

                    if (endMirror == null)
                    {
                        end = DSCore.Color.ByARGB(255, 64, 64, 64);
                    }
                    else
                    {
                        if (endMirror.GetData().IsCollection)
                        {
                            end = endMirror.GetData().GetElements().
                                  Select(x => x.Data).FirstOrDefault();
                        }
                        else
                        {
                            end = endMirror.GetData().Data;
                        }
                    }

                    DSCore.Color startColor = start as DSCore.Color;
                    DSCore.Color endColor   = end as DSCore.Color;
                    if (null != startColor && null != endColor)
                    {
                        WriteableBitmap bmp = CompleteColorScale(startColor, endColor);
                        drawPlane.Source    = bmp;
                    }
                });
            };
        }
Пример #32
0
 public void CustomizeView(Directory model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
     this.model = model;
 }
 public DynamoConverterControl(DynamoConvert Model, NodeView nodeView)
 {
     InitializeComponent();
 }
Пример #34
0
        private void Initialize()
        {
            SetDefaultSize(300, 0);

            AddButton("Ok", ResponseType.Ok);
            AddButton("Cancel", ResponseType.Cancel);

            var grid = new Grid
            {
                ColumnSpacing = 10,
                RowSpacing    = 10,
                Hexpand       = true,
            };

            entrySubject = new Entry {
                Hexpand = true
            };
            entrySecretary = new Entry {
                Hexpand = true
            };
            entryDate = new Entry {
                Hexpand = true
            };

            grid.Attach(new Label("Subject")
            {
                Halign = Align.End
            }, 0, 0, 1, 1);
            grid.Attach(entrySubject, 1, 0, 1, 1);
            grid.Attach(new Label("Date")
            {
                Halign = Align.End
            }, 0, 1, 1, 1);
            grid.Attach(entryDate, 1, 1, 1, 1);
            grid.Attach(new Label("Secretary")
            {
                Halign = Align.End
            }, 0, 2, 1, 1);
            grid.Attach(entrySecretary, 1, 2, 1, 1);


            nodeViewParticiapnts = CreateNodeView <ParticipantModel>();

            grid.Attach(new Label("Participants")
            {
                Halign = Align.End, Valign = Align.Start
            }, 0, 3, 1, 1);
            var participantsVBox = new VBox()
            {
                Spacing = 10
            };
            var participantsButtonBox = new HButtonBox {
                Halign = Align.Start
            };
            var addParticipantButton = new Button {
                Label = "Add participant"
            };

            addParticipantButton.Clicked += AddParticipantButton_Clicked;;
            participantsButtonBox.PackStart(addParticipantButton, false, false, 0);
            participantsVBox.PackStart(participantsButtonBox, false, false, 0);
            participantsVBox.PackStart(nodeViewParticiapnts, true, true, 0);
            grid.Attach(participantsVBox, 1, 3, 1, 1);


            nodeViewDecisions = CreateNodeView <DecisionModel>();

            grid.Attach(new Label("Decisions")
            {
                Halign = Align.End, Valign = Align.Start
            }, 0, 4, 1, 1);
            var decisionsVBox = new VBox()
            {
                Spacing = 10
            };
            var decisionsButtonBox = new HButtonBox()
            {
                Halign = Align.Start
            };
            var addDecisionButton = new Button {
                Label = "Add decision"
            };

            addDecisionButton.Clicked += AddDecisionButton_Clicked;;
            decisionsButtonBox.PackStart(addDecisionButton, false, false, 0);
            decisionsVBox.PackStart(decisionsButtonBox, false, false, 0);
            decisionsVBox.PackStart(nodeViewDecisions, true, true, 0);
            grid.Attach(decisionsVBox, 1, 4, 1, 1);

            ContentArea.PackStart(grid, true, true, 10);
        }
Пример #35
0
 public ReadMulti3Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #36
0
 public void SetNodeSelect(int index)
 {
     ClearSelect();
     mSelectNode = mNodes[index];
     mSelectNode?.ToggleSelect(true);
 }
Пример #37
0
 public ReadMulti2Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY)
 {
 }
Пример #38
0
 public void ClearSelect()
 {
     mSelectNode?.ToggleSelect(false);
     mSelectNode = null;
 }
Пример #39
0
 public MoVecCompose(NodeView graph, int posX, int posY) : base(graph, posX, posY)
 {
 }
Пример #40
0
 public ChannelsToColor(NodeView graph) : base(graph) { }
Пример #41
0
 public override void ConnectShow(Rect rect, NodeView <AINode> node)
 {
     // node.dataNode.trigger=(SkillTrigger) EditorGUI.EnumPopup(rect,node.dataNode.trigger);
 }
Пример #42
0
 public ChannelsToColor(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #43
0
 public WriteMulti3Channel(NodeView graph) : base(graph)
 {
 }
Пример #44
0
 public void SetStart(NodeView start)
 {
     m_Start = start;
 }
Пример #45
0
 public void CustomizeView(LengthFromString model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
 }
Пример #46
0
 public void SetEnd(NodeView end)
 {
     m_End = end;
 }
Пример #47
0
        public void CustomizeView(UnitInput stringInput, NodeView nodeView)
        {
            this.nodeModel       = stringInput;
            this.dynamoViewModel = nodeView.ViewModel.DynamoViewModel;

            this.editWindowItem = new MenuItem
            {
                Header      = Dynamo.Wpf.Properties.Resources.StringInputNodeEditMenu,
                IsCheckable = false
            };
            nodeView.MainContextMenu.Items.Add(editWindowItem);

            editWindowItem.Click += editWindowItem_Click;

            var grid = new Grid()
            {
                Height = Double.NaN,
                Width  = Double.NaN
            };

            RowDefinition rowDef1 = new RowDefinition();
            RowDefinition rowDef2 = new RowDefinition();

            grid.RowDefinitions.Add(rowDef1);
            grid.RowDefinitions.Add(rowDef2);

            //add a text box to the input grid of the control
            var tb = new StringTextBox
            {
                TextWrapping      = TextWrapping.Wrap,
                MinHeight         = Configurations.PortHeightInPixels,
                MinWidth          = 200,
                MaxWidth          = 300,
                VerticalAlignment = VerticalAlignment.Stretch
            };

            grid.Children.Add(tb);

            Grid.SetColumn(tb, 0);
            Grid.SetRow(tb, 0);

            tb.DataContext = stringInput;
            tb.BindToProperty(new Binding("Value")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new StringDisplay(),
                Source              = stringInput,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            //add a drop down list to the window
            var combo = new ComboBox
            {
                Width               = System.Double.NaN,
                MinWidth            = 200,
                MaxWidth            = 300,
                Height              = Configurations.PortHeightInPixels,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Center,
                Margin              = new Thickness(0, 3, 0, 0)
            };

            var dataTemplate = new DataTemplate();
            var fef          = new FrameworkElementFactory(typeof(TextBlock));

            fef.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Converter = new ForgeUnitToTextConverter()
            });

            dataTemplate.DataType   = (typeof(TextBlock));
            dataTemplate.VisualTree = fef;

            combo.ItemTemplate = dataTemplate;
            combo.Style        = (Style)SharedDictionaryManager.DynamoModernDictionary["RefreshComboBox"];

            grid.Children.Add(combo);
            Grid.SetColumn(combo, 0);
            Grid.SetRow(combo, 1);

            combo.SelectionChanged += delegate
            {
                if (combo.SelectedIndex != -1)
                {
                    nodeModel.OnNodeModified();
                }
            };

            combo.DataContext = nodeModel;

            // bind this combo box to the selected item hash
            var bindingVal = new System.Windows.Data.Binding("Items")
            {
                Source = nodeModel
            };

            combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal);

            // bind the selected index to the model property SelectedIndex
            var indexBinding = new Binding("SelectedUnit")
            {
                Mode   = BindingMode.TwoWay,
                Source = nodeModel
            };

            combo.SetBinding(Selector.SelectedItemProperty, indexBinding);

            nodeView.inputGrid.Children.Add(grid);
        }
 public DynamoConverterControl(DynamoConvert Model, NodeView nodeView)
 {
     InitializeComponent();          
 }      
 public void CustomizeView(ElementSelection <DividedSurface> model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
     model.RevitDynamoModel = nodeView.ViewModel.DynamoViewModel.Model as RevitDynamoModel;
 }
Пример #50
0
 public ChannelNode(NodeView graph) : base(graph) { }
Пример #51
0
        public void CustomizeView(Watch3D model, NodeView nodeView)
        {
            model.ViewModel   = nodeView.ViewModel.DynamoViewModel;
            this.watch3dModel = model;

            var renderingTier = (RenderCapability.Tier >> 16);

            if (renderingTier < 2)
            {
                return;
            }

            View = new Watch3DView(model.GUID, watch3dModel)
            {
                Width  = model.WatchWidth,
                Height = model.WatchHeight
            };

            var pos     = model.CameraPosition;
            var viewDir = model.LookDirection;

            View.View.Camera.Position      = new Point3D(pos.X, pos.Z, -pos.Y);
            View.View.Camera.LookDirection = new Vector3D(viewDir.X, viewDir.Z, -viewDir.Y);

            // When user sizes a watch node, only view gets resized. The actual
            // NodeModel does not get updated. This is where the view updates the
            // model whenever its size is updated.
            //Updated from (Watch3d)View.SizeChanged to nodeView.SizeChanged - height
            // and width should correspond to node model and not watch3Dview
            nodeView.SizeChanged += (sender, args) =>
                                    model.SetSize(args.NewSize.Width, args.NewSize.Height);

            model.RequestUpdateLatestCameraPosition += this.UpdateLatestCameraPosition;

            var mi = new MenuItem {
                Header = DynamoWatch3D.Properties.Resources.ZoomToFit
            };

            mi.Click += mi_Click;

            nodeView.MainContextMenu.Items.Add(mi);

            var backgroundRect = new Rectangle
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                IsHitTestVisible    = false
            };
            var bc          = new BrushConverter();
            var strokeBrush = (Brush)bc.ConvertFrom("#313131");

            backgroundRect.Stroke          = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            var backgroundBrush = new SolidColorBrush(Color.FromRgb(240, 240, 240));

            backgroundRect.Fill = backgroundBrush;

            nodeView.PresentationGrid.Children.Add(backgroundRect);
            nodeView.PresentationGrid.Children.Add(View);
            nodeView.PresentationGrid.Visibility = Visibility.Visible;

            DataBridge.Instance.RegisterCallback(
                model.GUID.ToString(),
                obj =>
                nodeView.Dispatcher.Invoke(
                    new Action <object>(RenderData),
                    DispatcherPriority.Render,
                    obj));

            View.Loaded += View_Loaded;
        }
Пример #52
0
 public WriteMulti2Channel(NodeView graph) : base(graph) { }
Пример #53
0
        public void CustomizeView(Watch3D model, NodeView nodeView)
        {
            var dynamoViewModel = nodeView.ViewModel.DynamoViewModel;

            watch3dModel = model;

            var renderingTier = (RenderCapability.Tier >> 16);

            if (renderingTier < 2)
            {
                return;
            }

            var dynamoModel = dynamoViewModel.Model;

            var vmParams = new Watch3DViewModelStartupParams(dynamoModel);

            watch3DViewModel = new HelixWatch3DNodeViewModel(watch3dModel, vmParams);
            watch3DViewModel.Setup(dynamoViewModel,
                                   dynamoViewModel.RenderPackageFactoryViewModel.Factory);

            if (model.initialCameraData != null)
            {
                try
                {
                    // The deserialization logic is unified between the view model and this node model.
                    // For the node model, we need to supply the deserialization method with the camera node.
                    var cameraNode = model.initialCameraData.ChildNodes.Cast <XmlNode>().FirstOrDefault(innerNode => innerNode.Name.Equals("camera", StringComparison.OrdinalIgnoreCase));
                    var cameraData = watch3DViewModel.DeserializeCamera(cameraNode);
                    watch3DViewModel.SetCameraData(cameraData);
                }
                catch
                {
                    watch3DViewModel.SetCameraData(new CameraData());
                }
            }

            model.Serialized += model_Serialized;
            watch3DViewModel.ViewCameraChanged += (s, args) =>
            {
                var camera = watch3DViewModel.GetCameraInformation();
                watch3dModel.Camera.Name  = camera.Name;
                watch3dModel.Camera.EyeX  = camera.EyePosition.X;
                watch3dModel.Camera.EyeY  = camera.EyePosition.Y;
                watch3dModel.Camera.EyeZ  = camera.EyePosition.Z;
                watch3dModel.Camera.LookX = camera.LookDirection.X;
                watch3dModel.Camera.LookY = camera.LookDirection.Y;
                watch3dModel.Camera.LookZ = camera.LookDirection.Z;
                watch3dModel.Camera.UpX   = camera.UpDirection.X;
                watch3dModel.Camera.UpY   = camera.UpDirection.Y;
                watch3dModel.Camera.UpZ   = camera.UpDirection.Z;
            };

            watch3DView = new Watch3DView()
            {
                Width       = model.WatchWidth,
                Height      = model.WatchHeight,
                DataContext = watch3DViewModel
            };

            // When user sizes a watch node, only view gets resized. The actual
            // NodeModel does not get updated. This is where the view updates the
            // model whenever its size is updated.
            // Updated from (Watch3d)View.SizeChanged to nodeView.SizeChanged - height
            // and width should correspond to node model and not watch3Dview
            nodeView.SizeChanged += (sender, args) =>
                                    model.SetSize(args.NewSize.Width, args.NewSize.Height);

            // set WatchSize in model
            watch3DView.View.SizeChanged += (sender, args) =>
                                            model.SetWatchSize(args.NewSize.Width, args.NewSize.Height);

            var mi = new MenuItem {
                Header = Resources.ZoomToFit
            };

            mi.Click += mi_Click;

            nodeView.MainContextMenu.Items.Add(mi);

            var backgroundRect = new Rectangle
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                IsHitTestVisible    = false,
            };
            var bc          = new BrushConverter();
            var strokeBrush = (Brush)bc.ConvertFrom("#313131");

            backgroundRect.Stroke          = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            var backgroundBrush = new SolidColorBrush(Color.FromRgb(240, 240, 240));

            backgroundRect.Fill = backgroundBrush;

            nodeView.PresentationGrid.Children.Add(backgroundRect);
            nodeView.PresentationGrid.Children.Add(watch3DView);
            nodeView.PresentationGrid.Visibility = Visibility.Visible;

            DataBridge.Instance.RegisterCallback(
                model.GUID.ToString(),
                obj =>
                nodeView.Dispatcher.Invoke(
                    new Action <object>(RenderData),
                    DispatcherPriority.Render,
                    obj));
        }
Пример #54
0
    public MainWindow() : base(WindowType.Toplevel)
    {
        VBox mainVBox        = new VBox(false, 0);
        HBox nodeViewHBox    = new HBox(true, 0);
        HBox crudButtonsHBox = new HBox(true, 0);
        HBox transactionContolButtonsHBox = new HBox(true, 0);

        Button refreshButton  = new Button("Refresh");
        Button createButton   = new Button("Create");
        Button deleteButton   = new Button("Delete");
        Button commitButton   = new Button("Commit");
        Button rollbackButton = new Button("Rollback");

        refreshButton.Clicked  += RefreshButtonClicked;
        createButton.Clicked   += CreateButtonClicked;
        deleteButton.Clicked   += DeleteButtonClicked;
        commitButton.Clicked   += CommitButtonClicked;
        rollbackButton.Clicked += RollbackButtonClicked;

        HSeparator separator = new HSeparator();

        view = new NodeView(Store);

        CellRendererText titleRenderer   = new CellRendererText();
        CellRendererText contentRenderer = new CellRendererText();

        titleRenderer.Editable   = true;
        contentRenderer.Editable = true;
        titleRenderer.Edited    += NoteTitleEdited;
        contentRenderer.Edited  += NoteContentEdited;

        view.AppendColumn("Title", titleRenderer, "text", 0);
        view.AppendColumn("Content", contentRenderer, "text", 1);

        ScrolledWindow scrolledWindow = new ScrolledWindow();

        scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
        scrolledWindow.AddWithViewport(view);

        try {
            //Если сервер и клиент запускаются из ИДЕ (по порядку, но практически одновременно),
            //сервер не успевает создать сокет, поэтому надо немного подождать
            System.Threading.Thread.Sleep(1000);
            RemotingConfiguration.Configure("remoteNotes.exe.config", false);

            clientActivated = new NotesClientActivated();
            singleton       = new NotesSingleton();
            singlecall      = new NotesTransactionSinglecall();
        } catch (System.Net.WebException) {
            Logger.Write("Unable to connect");
            return;
        }

        foreach (Note note in singleton.GetPesistentData())
        {
            store.AddNode(new NoteTreeNode(note));
        }

        nodeViewHBox.PackStart(scrolledWindow, false, true, 0);
        nodeViewHBox.SetSizeRequest(200, 200);

        crudButtonsHBox.PackStart(refreshButton, false, true, 0);
        crudButtonsHBox.PackStart(createButton, false, true, 0);
        crudButtonsHBox.PackStart(deleteButton, false, true, 0);

        transactionContolButtonsHBox.PackStart(commitButton, false, true, 0);
        transactionContolButtonsHBox.PackStart(rollbackButton, false, true, 0);

        mainVBox.PackStart(nodeViewHBox, true, false, 0);
        mainVBox.PackStart(crudButtonsHBox, true, false, 0);
        mainVBox.PackStart(separator, true, false, 2);
        mainVBox.PackStart(transactionContolButtonsHBox, true, false, 0);

        Add(mainVBox);

        mainVBox.ShowAll();

        Build();
    }
Пример #55
0
 public ChannelNode(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #56
0
 public WriteChannels(NodeView graph) : base(graph) { }
Пример #57
0
 public WriteMulti2Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #58
0
 public WriteChannels(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
Пример #59
0
 public MoVecDecompose(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
            public void CustomizeView(WindStructureDynamicResponseTypeSelection model, NodeView nodeView)
            {
                base.CustomizeView(model, nodeView);

                WindStrucureDynamicResponseTypeView control = new WindStrucureDynamicResponseTypeView();

                control.DataContext = model;


                nodeView.inputGrid.Children.Add(control);
                base.CustomizeView(model, nodeView);
            }