Esempio n. 1
0
        /*************************************/
        /**** Public Methods              ****/
        /*************************************/

        public virtual void SetItem(object item, bool sendNotification = true, bool updateOriginal = true)
        {
            if (item == null)
            {
                return;
            }

            if (updateOriginal)
            {
                m_OriginalItem = item;
            }
            SelectedItem = FromGeneric(item as dynamic);

            List <ParamInfo> oldInputs  = InputParams.ToList();
            List <ParamInfo> oldOutputs = OutputParams.ToList();

            SetComponentDetails();

            SetInputs();
            SetOutputs();

            SetInputSelectionMenu();
            SetOutputSelectionMenu();

            CompileMethod();
            CompileInputGetters();
            CompileOutputSetters();

            if (sendNotification)
            {
                MarkAsModified(new CallerUpdate
                {
                    Cause           = CallerUpdateCause.ItemSelected,
                    ComponentUpdate = new ComponentUpdate {
                        Name = Name, Description = Description
                    },
                    InputUpdates  = InputParams.Changes(oldInputs).Where(x => x.Param.IsSelected).ToList(),
                    OutputUpdates = OutputParams.Changes(oldOutputs).Where(x => x.Param.IsSelected).ToList()
                });
            }
        }
Esempio n. 2
0
        /*************************************/
        /**** Public Methods              ****/
        /*************************************/

        public bool CollectOutputTypes(List <object> objects = null)
        {
            if (objects == null)
            {
                objects = m_DataAccessor.GetAllData(0);
            }

            // Do not update if the list of input is empty or if user has manually selected outputs
            if (objects.Count == 0)
            {
                return(false);
            }

            // Save old outputs
            List <ParamInfo> oldOutputs = OutputParams.ToList();

            // Collect the new output params
            OutputParams = Engine.UI.Query.OutputParams(objects);

            // Compile the setters
            CompileOutputSetters();

            // Create the output menu
            SetOutputSelectionMenu();

            // Mark as modified if output have changed
            List <IParamUpdate> changes = OutputParams.Changes(oldOutputs).Where(x => x.Param.IsSelected).ToList();

            if (changes.Count > 0)
            {
                MarkAsModified(new CallerUpdate {
                    Cause = CallerUpdateCause.ItemSelected, OutputUpdates = changes
                });
            }

            return(true);
        }