コード例 #1
0
 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);         
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        /// <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;
        }
コード例 #7
0
        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
ファイル: ReadMulti3Channel.cs プロジェクト: JoePelz/NodeShop
 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
ファイル: DCT.cs プロジェクト: JoePelz/NodeShop
 public DCT(NodeView graph) : base(graph) { }
コード例 #15
0
ファイル: Merge.cs プロジェクト: JoePelz/NodeShop
 public Merge(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #16
0
ファイル: Merge.cs プロジェクト: JoePelz/NodeShop
 public Merge(NodeView graph) : base(graph) { }
コード例 #17
0
ファイル: ColorNode.cs プロジェクト: JoePelz/NodeShop
 public ColorNode(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #18
0
ファイル: ColorNode.cs プロジェクト: JoePelz/NodeShop
 public ColorNode(NodeView graph) : base(graph) { }
コード例 #19
0
ファイル: ColorSpace.cs プロジェクト: JoePelz/NodeShop
 public ColorSpace(NodeView graph) : base(graph) { }
コード例 #20
0
 public ReadMulti2Channel(NodeView graph) : base(graph)
 {
 }
コード例 #21
0
 public MoVecCompose(NodeView graph) : base(graph)
 {
 }
コード例 #22
0
ファイル: DCT.cs プロジェクト: JoePelz/NodeShop
 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
ファイル: NoOp.cs プロジェクト: JoePelz/NodeShop
 public NoOp(NodeView graph) : base(graph) { }
コード例 #25
0
 public void CustomizeView(VolumeFromString model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
 }
コード例 #26
0
ファイル: NoOp.cs プロジェクト: JoePelz/NodeShop
 public NoOp(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #27
0
 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
ファイル: MoVecDecompose.cs プロジェクト: JoePelz/NodeShop
 public MoVecDecompose(NodeView graph) : base(graph) { }
コード例 #30
0
ファイル: PuzzleState.cs プロジェクト: yakupadakli/nodulus
 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
ファイル: Directory.cs プロジェクト: tylerputnam/Dynamo
 public void CustomizeView(Directory model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
     this.model = model;
 }
コード例 #33
0
 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
ファイル: ReadMulti3Channel.cs プロジェクト: JoePelz/NodeShop
 public ReadMulti3Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #36
0
ファイル: ChessboardView.cs プロジェクト: ArthurHsieh/Konane
 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
ファイル: ChessboardView.cs プロジェクト: ArthurHsieh/Konane
 public void ClearSelect()
 {
     mSelectNode?.ToggleSelect(false);
     mSelectNode = null;
 }
コード例 #39
0
 public MoVecCompose(NodeView graph, int posX, int posY) : base(graph, posX, posY)
 {
 }
コード例 #40
0
ファイル: ChannelsToColor.cs プロジェクト: JoePelz/NodeShop
 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
ファイル: ChannelsToColor.cs プロジェクト: JoePelz/NodeShop
 public ChannelsToColor(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #43
0
 public WriteMulti3Channel(NodeView graph) : base(graph)
 {
 }
コード例 #44
0
ファイル: EdgeView.cs プロジェクト: AdrienMarcenat/LD43
 public void SetStart(NodeView start)
 {
     m_Start = start;
 }
コード例 #45
0
 public void CustomizeView(LengthFromString model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
 }
コード例 #46
0
ファイル: EdgeView.cs プロジェクト: AdrienMarcenat/LD43
 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);
        }
コード例 #48
0
 public DynamoConverterControl(DynamoConvert Model, NodeView nodeView)
 {
     InitializeComponent();          
 }      
コード例 #49
0
 public void CustomizeView(ElementSelection <DividedSurface> model, NodeView nodeView)
 {
     base.CustomizeView(model, nodeView);
     model.RevitDynamoModel = nodeView.ViewModel.DynamoViewModel.Model as RevitDynamoModel;
 }
コード例 #50
0
ファイル: ChannelNode.cs プロジェクト: JoePelz/NodeShop
 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
ファイル: ChannelNode.cs プロジェクト: JoePelz/NodeShop
 public ChannelNode(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #56
0
ファイル: WriteChannels.cs プロジェクト: JoePelz/NodeShop
 public WriteChannels(NodeView graph) : base(graph) { }
コード例 #57
0
 public WriteMulti2Channel(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #58
0
ファイル: WriteChannels.cs プロジェクト: JoePelz/NodeShop
 public WriteChannels(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #59
0
ファイル: MoVecDecompose.cs プロジェクト: JoePelz/NodeShop
 public MoVecDecompose(NodeView graph, int posX, int posY) : base(graph, posX, posY) { }
コード例 #60
0
            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);
            }