Ejemplo n.º 1
0
        public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic)
        {
            this.WorkspaceViewModel = workspaceViewModel;
            this.DynamoViewModel    = workspaceViewModel.DynamoViewModel;

            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged  += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            this.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            this.DynamoViewModel.Model.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel(this.DynamoViewModel);

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                DynamoViewModel.Model.EngineController.AstBuilt += EngineController_AstBuilt;
            }
        }
Ejemplo n.º 2
0
        public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic)
        {
            WorkspaceViewModel = workspaceViewModel;
            DynamoViewModel    = workspaceViewModel.DynamoViewModel;

            nodeLogic = logic;

            //respond to collection changed events to add
            //and remove port model views
            logic.InPorts.CollectionChanged  += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            DynamoViewModel.Model.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel(DynamoViewModel);
            UpdateBubbleContent();

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                DynamoViewModel.EngineController.AstBuilt += EngineController_AstBuilt;
            }

            ShowExecutionPreview = workspaceViewModel.DynamoViewModel.ShowRunPreview;
            IsNodeAddedRecently  = true;
            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;
        }
Ejemplo n.º 3
0
 public InfoBubbleDataPacket(InfoBubbleViewModel.Style style, Point topLeft, Point botRight,
     string text, InfoBubbleViewModel.Direction connectingDirection)
 {
     Style = style;
     TopLeft = topLeft;
     BotRight = botRight;
     Text = text;
     ConnectingDirection = connectingDirection;
 }
Ejemplo n.º 4
0
        public NodeViewModel(NodeModel logic)
        {
            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged  += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            dynSettings.Controller.PropertyChanged += Controller_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel();
            ErrorBubble.PropertyChanged += ErrorBubble_PropertyChanged;

            // Nodes mentioned in switch cases will not have preview bubble
            switch (nodeLogic.Name)
            {
            case "Number":
                break;

            case "String":
                break;

            case "Watch":
                break;

            case "Watch 3D":
                break;

            case "Boolean":
                break;

            default:
                PreviewBubble = new InfoBubbleViewModel();
                PreviewBubble.PropertyChanged += PreviewBubble_PropertyChanged;
                break;
            }
            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            //dynSettings.Controller.RequestNodeSelect += new NodeEventHandler(Controller_RequestNodeSelect);
        }
Ejemplo n.º 5
0
        public NodeViewModel(WorkspaceViewModel workspaceViewModel, NodeModel logic)
        {
            WorkspaceViewModel = workspaceViewModel;
            DynamoViewModel = workspaceViewModel.DynamoViewModel;
           
            nodeLogic = logic;
            
            //respond to collection changed events to add
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            DynamoViewModel.Model.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel(DynamoViewModel);
            UpdateBubbleContent();

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                DynamoViewModel.EngineController.AstBuilt += EngineController_AstBuilt;
            }

            ShowExecutionPreview = workspaceViewModel.DynamoViewModel.ShowRunPreview;
            IsNodeAddedRecently = true;
            DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;             
        }
Ejemplo n.º 6
0
        private void SetStyle_NodeTooltip(InfoBubbleViewModel.Direction connectingDirection)
        {
            backgroundPolygon.Fill = Configurations.NodeTooltipFrameFill;
            backgroundPolygon.StrokeThickness = Configurations.NodeTooltipFrameStrokeThickness;
            backgroundPolygon.Stroke = Configurations.NodeTooltipFrameStrokeColor;

            ContentContainer.MaxWidth = Configurations.NodeTooltipMaxWidth;
            ContentContainer.MaxHeight = Configurations.NodeTooltipMaxHeight;

            ContentMaxWidth = Configurations.NodeTooltipContentMaxWidth;
            ContentMaxHeight = Configurations.NodeTooltipContentMaxHeight;

            ContentFontSize = Configurations.NodeTooltipTextFontSize;
            ContentForeground = Configurations.NodeTooltipTextForeground;
            ContentFontWeight = Configurations.NodeTooltipTextFontWeight;

            switch (connectingDirection)
            {
                case InfoBubbleViewModel.Direction.Left:
                    ContentMargin = Configurations.NodeTooltipContentMarginLeft;
                    break;
                case InfoBubbleViewModel.Direction.Right:
                    ContentMargin = Configurations.NodeTooltipContentMarginRight;
                    break;
                case InfoBubbleViewModel.Direction.Bottom:
                    ContentMargin = Configurations.NodeTooltipContentMarginBottom;
                    break;
            }
        }
Ejemplo n.º 7
0
        private void HandleInfoBubbleStateChanged(InfoBubbleViewModel.State state)
        {
            switch (state)
            {
                case InfoBubbleViewModel.State.Minimized:
                    // Changing to Minimized
                    this.HideInfoBubble();
                    break;

                case InfoBubbleViewModel.State.Pinned:
                    // Changing to Pinned
                    this.ShowInfoBubble();
                    break;
            }
        }
Ejemplo n.º 8
0
        public NodeViewModel(NodeModel logic)
        {
            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            dynSettings.Controller.PropertyChanged += Controller_PropertyChanged;
            
            ErrorBubble = new InfoBubbleViewModel();
            ErrorBubble.PropertyChanged += ErrorBubble_PropertyChanged;

            // Nodes mentioned in switch cases will not have preview bubble
            switch (nodeLogic.Name)
            {
                case "Number":
                    break;
                case "String":
                    break;
                case "Watch":
                    break;
                case "Watch 3D":
                    break;
                case "Boolean":
                    break;
                default:
                    PreviewBubble = new InfoBubbleViewModel();
                    PreviewBubble.PropertyChanged += PreviewBubble_PropertyChanged;
                    break;
            }
            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            //dynSettings.Controller.RequestNodeSelect += new NodeEventHandler(Controller_RequestNodeSelect);
        }
Ejemplo n.º 9
0
        public void UpdateInfoBubble_ErrorBubble()
        {
            InfoBubbleViewModel infoBubble = new InfoBubbleViewModel(this.ViewModel);
            string content = "This is the test infoBubble";
            InfoBubbleDataPacket inputData_ErrorBubble = new InfoBubbleDataPacket(InfoBubbleViewModel.Style.Error,
                new Point(0, 0), new Point(0, 0), content, InfoBubbleViewModel.Direction.Bottom);

            if (infoBubble.UpdateContentCommand.CanExecute(null))
            {
                infoBubble.UpdateContentCommand.Execute(inputData_ErrorBubble);
                Assert.AreEqual(content, infoBubble.Content);
                Assert.AreEqual(InfoBubbleViewModel.Style.Error, infoBubble.InfoBubbleStyle);
                Assert.AreEqual(InfoBubbleViewModel.Direction.Bottom, infoBubble.ConnectingDirection);
            }
        }
Ejemplo n.º 10
0
        public void UpdateInfoBubble_NodeTooltip()
        {
            var infoBubble = new InfoBubbleViewModel();
            string content = "This is the test infoBubble";
            var inputData_NodeTooltip = new InfoBubbleDataPacket(InfoBubbleViewModel.Style.NodeTooltip,
                new Point(0, 0), new Point(0, 0), content, InfoBubbleViewModel.Direction.Right);

            if (infoBubble.UpdateContentCommand.CanExecute(null))
            {
                infoBubble.UpdateContentCommand.Execute(inputData_NodeTooltip);
                Assert.AreEqual(content, infoBubble.Content);
                Assert.AreEqual(InfoBubbleViewModel.Style.NodeTooltip, infoBubble.InfoBubbleStyle);
                Assert.AreEqual(InfoBubbleViewModel.Direction.Right, infoBubble.ConnectingDirection);
            }
        }
Ejemplo n.º 11
0
        public void UpdateInfoBubble_LibItem()
        {
            InfoBubbleViewModel infoBubble = new InfoBubbleViewModel();
            string content = "This is the test infoBubble";
            InfoBubbleDataPacket inputData_LibItem = new InfoBubbleDataPacket(InfoBubbleViewModel.Style.LibraryItemPreview,
                new Point(0, 0), new Point(0, 0), content, InfoBubbleViewModel.Direction.Left);

            if (infoBubble.UpdateContentCommand.CanExecute(null))
            {
                infoBubble.UpdateContentCommand.Execute(inputData_LibItem);
                Assert.AreEqual(content, infoBubble.Content);
                Assert.AreEqual(InfoBubbleViewModel.Style.LibraryItemPreview, infoBubble.InfoBubbleStyle);
                Assert.AreEqual(InfoBubbleViewModel.Direction.Left, infoBubble.ConnectingDirection);
            }
        }
Ejemplo n.º 12
0
 public void Collapse()
 {
     InfoBubbleViewModel infoBubble = new InfoBubbleViewModel();
     infoBubble.InstantCollapseCommand.Execute(null);
     Assert.AreEqual(0, infoBubble.Opacity);
 }
Ejemplo n.º 13
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(Type viewModelType, string context, string commandFilePath, IUpdateManager updateManager, IWatchHandler watchHandler, IPreferences preferences)
        {
            DynamoLogger.Instance.StartLogging();

            dynSettings.Controller = this;

            Context = context;

            //Start heartbeat reporting
            InstrumentationLogger.Start();

            PreferenceSettings = preferences;
            ((PreferenceSettings) PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged;

            SIUnit.LengthUnit = PreferenceSettings.LengthUnit;
            SIUnit.AreaUnit = PreferenceSettings.AreaUnit;
            SIUnit.VolumeUnit = PreferenceSettings.VolumeUnit;
            SIUnit.NumberFormat = PreferenceSettings.NumberFormat;

            UpdateManager = updateManager;
            UpdateManager.UpdateDownloaded += updateManager_UpdateDownloaded;
            UpdateManager.ShutdownRequested += updateManager_ShutdownRequested;
            UpdateManager.CheckForProductUpdate(new UpdateRequest(new Uri(Configurations.UpdateDownloadLocation),DynamoLogger.Instance, UpdateManager.UpdateDataAvailable));

            WatchHandler = watchHandler;

            //create the view model to which the main window will bind
            //the DynamoModel is created therein
            DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(
                viewModelType, new object[] { this, commandFilePath });

            // custom node loader
            string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);

            SearchViewModel = new SearchViewModel();

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            DynamoViewModel.Model.CurrentWorkspace.X = 0;
            DynamoViewModel.Model.CurrentWorkspace.Y = 0;

            DisposeLogic.IsShuttingDown = false;
            EngineController = new EngineController(this, false);
            //This is necessary to avoid a race condition by causing a thread join
            //inside the vm exec
            //TODO(Luke): Push this into a resync call with the engine controller
            ResetEngine();

            DynamoLogger.Instance.Log(String.Format(
                "Dynamo -- Build {0}",
                Assembly.GetExecutingAssembly().GetName().Version));

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadNodeModels();

            //run tests
            if (FScheme.RunTests(DynamoLogger.Instance.Log))
            {
                DynamoLogger.Instance.Log("All Tests Passed. Core library loaded OK.");
            }

            InfoBubbleViewModel = new InfoBubbleViewModel();

            AddPythonBindings();

            MigrationManager.Instance.MigrationTargets.Add(typeof(WorkspaceMigrations));
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(string context, IUpdateManager updateManager, ILogger logger,
            IWatchHandler watchHandler, IPreferences preferences)
        {
            IsCrashing = false;

            DynamoLogger = logger;

            dynSettings.Controller = this;

            Context = context;

            //Start heartbeat reporting
            InstrumentationLogger.Start();

            PreferenceSettings = preferences;
            ((PreferenceSettings) PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged;

            BaseUnit.LengthUnit = PreferenceSettings.LengthUnit;
            BaseUnit.AreaUnit = PreferenceSettings.AreaUnit;
            BaseUnit.VolumeUnit = PreferenceSettings.VolumeUnit;
            BaseUnit.NumberFormat = PreferenceSettings.NumberFormat;

            UpdateManager = updateManager;
            UpdateManager.UpdateDownloaded += updateManager_UpdateDownloaded;
            UpdateManager.ShutdownRequested += updateManager_ShutdownRequested;
            UpdateManager.CheckForProductUpdate(new UpdateRequest(new Uri(Configurations.UpdateDownloadLocation),dynSettings.Controller.DynamoLogger, UpdateManager.UpdateDataAvailable));

            WatchHandler = watchHandler;

            //create the model
            DynamoModel = new DynamoModel ();
            DynamoModel.AddHomeWorkspace();
            DynamoModel.CurrentWorkspace = DynamoModel.HomeSpace;
            DynamoModel.CurrentWorkspace.X = 0;
            DynamoModel.CurrentWorkspace.Y = 0;

            // custom node loader
            string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);
            
            SearchViewModel = new SearchViewModel();

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            DisposeLogic.IsShuttingDown = false;

            //This is necessary to avoid a race condition by causing a thread join
            //inside the vm exec
            //TODO(Luke): Push this into a resync call with the engine controller
            ResetEngine();

            dynSettings.Controller.DynamoLogger.Log(String.Format(
                "Dynamo -- Build {0}",
                Assembly.GetExecutingAssembly().GetName().Version));

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadNodeModels();
            
            InfoBubbleViewModel = new InfoBubbleViewModel();

            MigrationManager.Instance.MigrationTargets.Add(typeof(WorkspaceMigrations));

            evaluationWorker.DoWork += RunThread;
        }
Ejemplo n.º 15
0
        private void UpdateStyle(InfoBubbleViewModel.Style style, Direction connectingDirection)
        {
            InfoBubbleStyle = style;
            ConnectingDirection = connectingDirection;
            limitedDirection = Direction.None;

            switch (style)
            {
                case Style.LibraryItemPreview:
                    SetStyle_LibraryItemPreview();
                    break;
                case Style.NodeTooltip:
                    SetStyle_NodeTooltip(connectingDirection);
                    break;
                case Style.Error:
                    SetStyle_Error();
                    break;
                case Style.Preview:
                    SetStyle_Preview();
                    break;
                case Style.PreviewCondensed:
                    SetStyle_PreviewCondensed();
                    break;
                case Style.None:
                    throw new ArgumentException("InfoWindow didn't have a style (456B24E0F400)");
            }
        }
Ejemplo n.º 16
0
        public NodeViewModel(NodeModel logic)
        {
            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;

            dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += Model_PropertyChanged;
            dynSettings.Controller.DebugSettings.PropertyChanged += DebugSettings_PropertyChanged;

            ErrorBubble = new InfoBubbleViewModel();

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            if (IsDebugBuild)
            {
                dynSettings.Controller.EngineController.AstBuilt += EngineController_AstBuilt;
            }
        }
Ejemplo n.º 17
0
 public void Collapse()
 {
     InfoBubbleViewModel infoBubble = new InfoBubbleViewModel(this.ViewModel);
     infoBubble.OnRequestAction(new InfoBubbleEventArgs(InfoBubbleEventArgs.Request.Hide));
     //Assert.AreEqual(0, infoBubble.Opacity);
 }