public UpdateParameterData UpdateParameterAction()
        {
            if (m_localizer.CanLocalize(Id <LocalizedStringType> .ConvertFrom(m_parameter.TypeId)))
            {
                var localized = m_parameter.Corrupted ? null : m_localizer.Localize(Id <LocalizedStringType> .FromGuid(m_parameter.TypeId.Guid), m_parameter.Value);
                if (m_textBox.Text != localized)
                {
                    if (m_parameter.Corrupted)
                    {
                        Id <LocalizedText> id = Id <LocalizedText> .New();

                        var parameterAction = m_parameter.SetValueAction(id);
                        var localizerAction = m_localizer.SetLocalizationAction(Id <LocalizedStringType> .ConvertFrom(m_parameter.TypeId), id, m_textBox.Text);
                        return(new SimpleUndoPair
                        {
                            //m_parameter.Corrupted implies m_parameter.SetValueAction(_)!=null
                            Undo = () => { parameterAction.Value.Undo(); localizerAction.Undo(); },
                            Redo = () => { parameterAction.Value.Redo(); localizerAction.Redo(); }
                        });
                    }
                    else
                    {
                        return(m_localizer.SetLocalizationAction(Id <LocalizedStringType> .ConvertFrom(m_parameter.TypeId), m_parameter.Value, m_textBox.Text));
                    }
                }
            }

            return(new UpdateParameterData());
        }
 public void Setup(ParameterEditorSetupData data)
 {
     m_parameter = data.Parameter as ILocalizedStringParameter;
     m_localizer = data.Localizer;
     if (!m_parameter.Corrupted)
     {
         m_textBox.Text = m_localizer.Localize(Id <LocalizedStringType> .FromGuid(m_parameter.TypeId.Guid), m_parameter.Value);
     }
     else
     {
         m_textBox.Text = m_localizer.Localize(null, null);
     }
     if (!m_localizer.CanLocalize(Id <LocalizedStringType> .ConvertFrom(m_parameter.TypeId)))
     {
         m_textBox.InputForm = MyTextBox.InputFormEnum.None;
     }
     m_autoCompleteSuggestions = data.AutoCompleteSuggestions;
 }