/// <summary>
        /// Method that is called when Dynamo has finished loading and is ready to be used.
        /// </summary>
        /// <param name="rp">
        /// Parameters that provide references to Dynamo commands, settings and events.
        /// This object is supplied by Dynamo itself.
        /// </param>
        public void Ready(ReadyParams rp)
        {
            MessageBox.Show("Extension is ready!");

            // we can register our own events that will be triggered when specific things happen in Dynamo
            // a reference to the ReadyParams is needed to do this, so we pass it on
        }
Esempio n. 2
0
        public ViewportWindowViewModel(ViewLoadedParams p, string defaultPackagePath)
        {
            // Save a reference to our loaded parameters which
            // is required in order to access the workspaces
            readyParams = p;

            // TODO: This API will be obsoleted in future Dynamo releases
            // Turn off Dynamo background preview if it's enabled
            (p.BackgroundPreviewViewModel as Dynamo.Wpf.ViewModels.Watch3D.HelixWatch3DViewModel).Active = false;

            // Save a reference to the default packages directory
            PackagePath = defaultPackagePath;

            // Subscribe to NodeAdded and NodeRemoved events
            p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodeAdded;
            p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodeRemoved;

            // TODO: this could be dangerous if called in custom node ws
            HomeWorkspaceModel currentWS = readyParams.CurrentWorkspaceModel as HomeWorkspaceModel;

            // TODO: opening/changing WS needs more attention
            // Register all nodes that currently exist in the WS
            foreach (NodeModel node in currentWS.Nodes)
            {
                node.RenderPackagesUpdated += CurrentWorkspaceModel_UpdateViewportGeometry;
                node.PropertyChanged       += CurrentWorkspaceModel_nodePropertyChanged;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Action to be invoked when the Dynamo has started up and is ready
        /// for user interaction.
        /// </summary>
        /// <param name="sp"></param>
        public void Ready(ReadyParams sp)
        {
            // Searches for DSIronPython engine binary in same folder with extension itself
            var      targetDir          = Path.GetDirectoryName(Assembly.GetAssembly(typeof(IronPythonExtension)).Location);
            var      libraryLoader      = sp.StartupParams.LibraryLoader;
            Assembly pythonEvaluatorLib = null;

            try
            {
                pythonEvaluatorLib = Assembly.LoadFrom(Path.Combine(targetDir, PythonEvaluatorAssembly + ".dll"));
            }
            catch (Exception ex)
            {
                // Most likely the IronPython engine is excluded in this case
                // but logging the exception message in case for diagnose
                OnMessageLogged(LogMessage.Info(ex.Message));
                return;
            }
            // Import IronPython Engine into VM, so Python node using IronPython engine could evaluate correctly
            if (pythonEvaluatorLib != null)
            {
                libraryLoader.LoadNodeLibrary(pythonEvaluatorLib);
                PythonEngineSelector.Instance.ScanPythonEngines();
            }
        }
 /// <summary>
 /// The constructor of our view model.
 /// </summary>
 /// <param name="p">ReadyParams: Application-level handles provided to an extension when Dynamo has started and is ready for interaction</param>
 /// <param name="vm">The Dynamo view model: We'll need this for most of what we do below</param>
 /// <param name="dw">The Dynamo window: We'll need this for auto-layout to work properly</param>
 public UnfancifyViewModel(ReadyParams p, DynamoViewModel vm, Window dw)
 {
     // Hold references to the constructor arguments to be used later
     readyParams = p;
     viewModel   = vm;
     dynWindow   = dw;
 }
Esempio n. 5
0
 private void ExtensionReadyCallback(ReadyParams ready)
 {
     executive = ready.CommandExecutive;
     Assert.IsTrue(ready.WorkspaceModels.Any());
     Assert.IsNotNull(ready.CurrentWorkspaceModel);
     ready.NotificationRecieved += (Logging.NotificationMessage obj) => message = obj;
 }
 public GroupNavigationViewModel(ReadyParams p)
 {
     readyParams = p as ViewLoadedParams;
     p.CurrentWorkspaceChanged += CurrentWorkspaceModel_WorkspaceChanged;
     p.CurrentWorkspaceChanged += ReadyParams_CurrentWorkspaceChanged;
     AddEventHandlers(p.CurrentWorkspaceModel);
 }
        // Construction & disposal

        public CapturefineryWindowViewModel(ReadyParams p, DynamoViewModel dynamoVM)
        {
            _readyParams     = p;
            _dynamoViewModel = dynamoVM;
            _file            = p.CurrentWorkspaceModel.FileName;
            _images          = new List <Bitmap>();
        }
        // Construction & disposal

        public WarningsWindowViewModel(ReadyParams p, DynamoViewModel dynamoVM)
        {
            _readyParams     = p;
            _dynamoViewModel = dynamoVM;

            _readyParams.CurrentWorkspaceChanged +=
                ReadyParams_CurrentWorkspaceChanged;
            AddEventHandlers(_readyParams.CurrentWorkspaceModel);
        }
Esempio n. 9
0
 /// <summary>
 /// The constructor of our view model.
 /// </summary>
 /// <param name="p">ReadyParams: Application-level handles provided to an extension when Dynamo has started and is ready for interaction</param>
 /// <param name="vm">The Dynamo view model: We'll need this for most of what we do below</param>
 /// <param name="dw">The Dynamo window: We'll need this for auto-layout to work properly</param>
 public UnfancifyViewModel(ReadyParams p, DynamoViewModel vm, Window dw)
 {
     // Hold references to the constructor arguments to be used later
     readyParams = p;
     viewModel   = vm;
     dynWindow   = dw;
     // The Unfancify Current Graph button is bound to this command
     UnfancifyCurrentGraph = new DelegateCommand(OnUnfancifyCurrentClicked);
 }
Esempio n. 10
0
        /// <summary>
        /// Registers custom events to be triggered when something happens in Dynamo.
        /// </summary>
        /// <param name="dynamoReadyParams">Reference to the Dynamo extension ready parameters.</param>
        public static void RegisterEventHandlers(ReadyParams dynamoReadyParams)
        {
            dynamoReadyParams.CurrentWorkspaceChanged += OnCurrentWorkspaceChanged;

            // keep a reference to the parameters supplied at startup
            // so we can un-register our event handlers later

            DynamoReadyParams = dynamoReadyParams;
        }
Esempio n. 11
0
 public ErrorNodesViewModel(ReadyParams p)
 {
     readyParams = p as ViewLoadedParams;
     p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceChanged           += CurrentWorkspaceModel_WorkspaceChanged;
     p.CurrentWorkspaceChanged           += ReadyParams_CurrentWorkspaceChanged;
     AddEventHandlers(p.CurrentWorkspaceModel);
 }
Esempio n. 12
0
        public void Ready(ReadyParams sp)
        {
            ReadyParams = sp;
            sp.CurrentWorkspaceChanged += OnCurrentWorkspaceChanged;

            (sp.CurrentWorkspaceModel as WorkspaceModel).CollectingCustomNodePackageDependencies += GetCustomNodePackageFromID;
            (sp.CurrentWorkspaceModel as WorkspaceModel).CollectingNodePackageDependencies       += GetNodePackageFromAssemblyName;
            currentWorkspace = (sp.CurrentWorkspaceModel as WorkspaceModel);
        }
 public PlayerInputsViewModel(ReadyParams p, DynamoViewModel vm)
 {
     readyParams = p;
     viewModel   = vm;
     p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged;
     ResetAll           = new DelegateCommand(OnResetAllClicked);
     ResetSelected      = new DelegateCommand(OnResetSelectedClicked);
     SetSelectedAsInput = new DelegateCommand(OnSetSelectedAsInputClicked);
 }
Esempio n. 14
0
        public RechargeWindowViewModel(ReadyParams p)
        {
            // Save a reference to our loaded parameters which
            // is required in order to access the workspaces
            readyParams = p;

            // Subscribe to NodeAdded and NodeRemoved events
            p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodesChanged;
            p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged;
        }
Esempio n. 15
0
        // Construction & disposal

        public CapturefineryWindowViewModel(ReadyParams p, DynamoViewModel dynamoVM)
        {
            _readyParams      = p;
            _dynamoViewModel  = dynamoVM;
            _file             = p.CurrentWorkspaceModel.FileName;
            _captureErrors    = true;
            _createAnimations = true;
            _loadImages       = false;
            _escapePressed    = false;
        }
        public void UnFreezeAll(dtSampleWindowViewModel se)
        {
            ReadyParams rp  = se.ReadyParamType;
            var         vlp = rp as ViewLoadedParams;
            var         wm  = rp.CurrentWorkspaceModel;

            foreach (NodeModel node in wm.Nodes)
            {
                node.IsFrozen = false;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Method that is called when Dynamo has finished loading and is ready to be used.
        /// </summary>
        /// <param name="rp">
        /// Parameters that provide references to Dynamo commands, settings and events.
        /// This object is supplied by Dynamo itself.
        /// </param>
        public void Ready(ReadyParams rp)
        {
            string message = "By pressing OK you agreeing to Tracker 🔍 data collection.";
            string title   = "Tracker 🔍 Terms of Usage Agreement";

            MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Exclamation);

            // we can register our own events that will be triggered when specific things happen in Dynamo
            // a reference to the ReadyParams is needed to do this, so we pass it on
            TrackerEvents.RegisterEventHandlers(rp);
        }
 public StatsViewModel(ReadyParams p)
 {
     readyParams = p as ViewLoadedParams;
     readyParams.CurrentWorkspaceModel.NodeAdded        += OnNodeCountChange;
     readyParams.CurrentWorkspaceModel.NodeRemoved      += OnNodeCountChange;
     readyParams.CurrentWorkspaceModel.ConnectorAdded   += OnWireCountChange;
     readyParams.CurrentWorkspaceModel.ConnectorDeleted += OnWireCountChange;
     readyParams.CurrentWorkspaceModel.NodeAdded        += OnNodesUpdate;
     readyParams.CurrentWorkspaceModel.NodeRemoved      += OnNodesUpdate;
     readyParams.CurrentWorkspaceChanged += OnWorkspaceChange;
 }
Esempio n. 19
0
 public FindUngroupedViewModel(ReadyParams p, DynamoViewModel vm)
 {
     readyParams = p;
     viewModel   = vm;
     p.CurrentWorkspaceModel.NodeAdded        += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceModel.NodeRemoved      += CurrentWorkspaceModel_NodesChanged;
     viewModel.CurrentSpace.NoteAdded         += CurrentWorkspaceModel_NotesChanged;
     viewModel.CurrentSpace.NoteRemoved       += CurrentWorkspaceModel_NotesChanged;
     viewModel.CurrentSpace.AnnotationAdded   += CurrentWorkspaceModel_AnnotationChanged;
     viewModel.CurrentSpace.AnnotationRemoved += CurrentWorkspaceModel_AnnotationChanged;
     FixUngrouped = new DelegateCommand(OnFixUngroupedClicked);
 }
Esempio n. 20
0
        public SampleWindowViewModel(ReadyParams p)
        {
            readyParams = p;
            p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodesChanged;
            p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged;

            // JL: fetching the DynamoModel from the params...
            var vlp  = p as ViewLoadedParams;
            var view = vlp.DynamoWindow.DataContext as Dynamo.ViewModels.DynamoViewModel;

            this.model = view.Model;
        }
 public SearchInWorkspaceViewModel(ReadyParams p, DynamoViewModel vm, KeyValueConfigurationCollection ms)
 {
     readyParams           = p;
     viewModel             = vm;
     searchInNicknames     = ms.GetLoadedSettingAsBoolean("SearchInNodeNicknames");
     searchInOriginalNames = ms.GetLoadedSettingAsBoolean("SearchInOriginalNodeNames");
     searchInCategories    = ms.GetLoadedSettingAsBoolean("SearchInNodeCategories");
     searchInDescriptions  = ms.GetLoadedSettingAsBoolean("SearchInNodeDescriptions");
     searchInTags          = ms.GetLoadedSettingAsBoolean("SearchInNodeTags");
     searchInNotes         = ms.GetLoadedSettingAsBoolean("SearchInTextNotes");
     searchInAnnotations   = ms.GetLoadedSettingAsBoolean("SearchInGroupTitles");
 }
 public IsolateInPreviewViewModel(ReadyParams p, DynamoViewModel vm, Window dw)
 {
     readyParams = p;
     viewModel   = vm;
     dynWindow   = dw;
     p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodesChanged;
     ResetAll        = new DelegateCommand(OnResetAllClicked);
     AddSelected     = new DelegateCommand(OnAddSelectedClicked);
     RemoveSelected  = new DelegateCommand(OnRemoveSelectedClicked);
     IsolateSelected = new DelegateCommand(OnIsolateSelectedClicked);
 }
Esempio n. 23
0
        private void ButtonClick_UnFreezeAll(object sender, RoutedEventArgs e)
        {
            FrameworkElement      fe = sender as FrameworkElement;
            ToggleFreezeViewModel se = fe.DataContext as ToggleFreezeViewModel;
            ReadyParams           rp = se.ReadyParamType;
            var vlp = rp as ViewLoadedParams;
            var wm  = rp.CurrentWorkspaceModel;

            foreach (NodeModel node in wm.Nodes)
            {
                node.IsFrozen = false;
            }
        }
Esempio n. 24
0
        public NodeTrackerViewModel(ReadyParams p)
        {
            readyParams = p;

            //subscribing to dynamo events
            readyParams.CurrentWorkspaceModel.NodeAdded        += CurrentWorkspaceModel_NodeAdded;
            readyParams.CurrentWorkspaceModel.NodeRemoved      += CurrentWorkspaceModel_NodeRemoved;
            readyParams.CurrentWorkspaceModel.ConnectorAdded   += CurrentWorkspaceModel_ConnectorAdded;
            readyParams.CurrentWorkspaceModel.ConnectorDeleted += CurrentWorkspaceModel_ConnectorDeleted;

            //making sure the binding is updated when elements are added and removed
            Actions.CollectionChanged += Actions_CollectionChanged;
        }
 public CountsViewModel(ReadyParams p)
 {
     readyParams = p as ViewLoadedParams;
     p.CurrentWorkspaceModel.NodeAdded        += CurrentWorkspaceModel_NodeCount;
     p.CurrentWorkspaceModel.NodeRemoved      += CurrentWorkspaceModel_NodeCount;
     p.CurrentWorkspaceModel.ConnectorAdded   += CurrentWorkspaceModel_WireCount;
     p.CurrentWorkspaceModel.ConnectorDeleted += CurrentWorkspaceModel_WireCount;
     p.CurrentWorkspaceModel.NodeAdded        += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceModel.NodeRemoved      += CurrentWorkspaceModel_NodesChanged;
     p.CurrentWorkspaceChanged += CurrentWorkspaceModel_WorkspaceChanged;
     p.CurrentWorkspaceChanged += ReadyParams_CurrentWorkspaceChanged;
     AddEventHandlers(p.CurrentWorkspaceModel);
 }
Esempio n. 26
0
        public QuasarFreeze(ReadyParams r)
        {
            readyParams = r;
            var nodes = r.CurrentWorkspaceModel.CurrentSelection;

            foreach (NodeModel node in nodes)
            {
                if (node.IsSelected && !node.IsFrozen)
                {
                    node.IsFrozen = true;
                }
            }
        }
        public void FreezeSelected(dtSampleWindowViewModel se)
        {
            ReadyParams rp  = se.ReadyParamType;
            var         vlp = rp as ViewLoadedParams;
            var         wm  = rp.CurrentWorkspaceModel;

            foreach (NodeModel node in wm.Nodes)
            {
                if (node.IsSelected)
                {
                    node.IsFrozen = true;
                }
            }
        }
        public InputsViewModel(ReadyParams p)
        {
            this.ResetStats();

            this.readyParams = p as ViewLoadedParams;
            Recompute();

            this.readyParams.CurrentWorkspaceModel.NodeAdded        += OnNodeCountChange;
            this.readyParams.CurrentWorkspaceModel.NodeRemoved      += OnNodeCountChange;
            this.readyParams.CurrentWorkspaceModel.ConnectorAdded   += OnWireCountChange;
            this.readyParams.CurrentWorkspaceModel.ConnectorDeleted += OnWireCountChange;
            this.readyParams.CurrentWorkspaceChanged += OnWorkspaceChange;
            this.readyParams.CurrentWorkspaceCleared += OnWorkspaceChange;
        }
 public UnfancifyViewModel(ReadyParams p, DynamoViewModel vm, KeyValueConfigurationCollection ms, Window dw)
 {
     readyParams            = p;
     viewModel              = vm;
     dynWindow              = dw;
     ungroupAll             = ms.GetLoadedSettingAsBoolean("UnfancifyUngroupAll");
     deleteTextNotes        = ms.GetLoadedSettingAsBoolean("UnfancifyDeleteTextNotes");
     deleteWatchNodes       = ms.GetLoadedSettingAsBoolean("UnfancifyDeleteWatchNodes");
     disableGeometryPreview = ms.GetLoadedSettingAsBoolean("UnfancifyDisableGeometryPreview");
     disablePreviewBubbles  = ms.GetLoadedSettingAsBoolean("UnfancifyDisablePreviewBubbles");
     ignoreGroupPrefixes    = ms["UnfancifyIgnoreGroupPrefixes"].Value.Replace(";", Environment.NewLine);
     ignoreTextNotePrefixes = ms["UnfancifyIgnoreTextNotePrefixes"].Value.Replace(";", Environment.NewLine);
     UnfancifyCurrentGraph  = new DelegateCommand(OnUnfancifyCurrentClicked);
 }
        public ViewportWindowViewModel(ReadyParams p)
        {
            // Save a reference to our loaded parameters which
            // is required in order to access the workspaces
            readyParams = p;

            // Subscribe to NodeAdded and NodeRemoved events
            p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodeAdded;
            p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodeRemoved;

            // TODO this could be dangerous if called in custom node ws
            HomeWorkspaceModel currentWS = readyParams.CurrentWorkspaceModel as HomeWorkspaceModel;
            //currentWS.RefreshCompleted += CurrentWorkspaceModel_NodesChanged;
        }