예제 #1
0
파일: SetItem.cs 프로젝트: BHoM/BHoM_UI
        /*************************************/
        /**** 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()
                });
            }
        }