void UpdateEditor(ISupportControl supportControl) { if (supportControl == null) { return; } bool isChanged = false; var memberType = GetMemberType() ?? typeof(object); bool editObjectChanged = (_parameter != null) && (_parameter.Type != memberType); if (_propertyEditor.CurrentObject != null) { if ((_parameter == null) || (editObjectChanged) || supportControl.Control == null) { var application = _getApplicationAction.Invoke(); isChanged = true; _parameter = new MyParameter(memberType.Name, memberType) { Visible = true }; var paramList = new ParameterList { _parameter }; ParametersObject parametersObject = ParametersObject.CreateBoundObject(paramList); DetailView detailView = parametersObject.CreateDetailView(application.CreateObjectSpace(), application, true); detailView.ViewEditMode = GetViewEditMode(); _detailViewItems = ((PropertyEditor)detailView.Items[0]); _detailViewItems.CreateControl(); _detailViewItems.ControlValueChanged += detailViewItems_ControlValueChanged; } _parameter.CurrentValue = _propertyEditor.PropertyValue; } if ((isChanged || (supportControl.Control == null)) && (_detailViewItems != null)) { _detailViewItems.Refresh(); supportControl.Control = _findControl.Invoke(_detailViewItems); } }
void UpdateEditor(ISupportControl supportControl) { if (supportControl == null) return; bool isChanged = false; var memberType = GetMemberType() ?? typeof(object); bool editObjectChanged = (_parameter != null) && (_parameter.Type != memberType); if (_propertyEditor.CurrentObject != null) { if ((_parameter == null) || (editObjectChanged) || supportControl.Control == null) { var application = _getApplicationAction.Invoke(); isChanged = true; _parameter = new MyParameter(memberType.Name, memberType); var paramList = new ParameterList { _parameter }; ParametersObject parametersObject = ParametersObject.CreateBoundObject(paramList); DetailView detailView = parametersObject.CreateDetailView(application.CreateObjectSpace(), application, true); detailView.ViewEditMode = GetViewEditMode(); _detailViewItems = ((PropertyEditor)detailView.Items[0]); _detailViewItems.CreateControl(); _detailViewItems.ControlValueChanged += detailViewItems_ControlValueChanged; } _parameter.CurrentValue = _propertyEditor.PropertyValue; } if ((isChanged || (supportControl.Control == null)) && (_detailViewItems != null)) { _detailViewItems.Refresh(); supportControl.Control = _findControl.Invoke(_detailViewItems); } }