Ejemplo n.º 1
0
        void m_scripts_Updated(object sender, EditableScriptsUpdatedEventArgs e)
        {
            m_helper.RaiseDirtyEvent(m_scripts.DisplayString());

            if (e.UpdatedScriptEventArgs != null)
            {
                // For nested script updates (e.g. an "if"'s "then" script), there's no need to repopulate the parent script control,
                // as the child script control will have already updated itself to reflect the change.
                if (e.UpdatedScriptEventArgs.IsNestedScriptUpdate)
                {
                    return;
                }

                if (e.UpdatedScriptEventArgs.IsParameterUpdate)
                {
                    // might be an update for a nested script, so check it's "ours" first, and if so, update the control
                    if (m_scriptParameterControlMap.ContainsKey(e.UpdatedScript))
                    {
                        // An entire script refresh would be overkill - we just need to update the specified parameter
                        IElementEditorControl control = GetScriptParameterControl(e.UpdatedScript, e.UpdatedScriptEventArgs.Index.ToString(CultureInfo.InvariantCulture));
                        if (e.UpdatedScript.Type == ScriptType.Normal)
                        {
                            control.Populate(m_controller.GetScriptEditorData(e.UpdatedScript));
                        }
                        else
                        {
                            ((IfEditor)control).Populate((EditableIfScript)e.UpdatedScript);
                        }
                    }
                    return;
                }

                if (e.UpdatedScriptEventArgs.IsNamedParameterUpdate)
                {
                    // might be an update for a nested script, so check it's "ours" first, and if so, update the control
                    if (m_scriptParameterControlMap.ContainsKey(e.UpdatedScript))
                    {
                        // currently, named parameter updates are only used for "else if" expressions. The entire "if" is
                        // registered for attribute "0".
                        IElementEditorControl control = GetScriptParameterControl(e.UpdatedScript, "0");
                        ((IfEditor)control).Populate((EditableIfScript)e.UpdatedScript);
                    }
                    return;
                }

                if (e.UpdatedScript.Type == ScriptType.If)
                {
                    // "If" scripts have their own events which the editor controls handle themselves to update
                    // appropriately, so there is nothing further to do in response to the Updated event.
                    return;
                }
            }

            RefreshScriptsList();
        }
Ejemplo n.º 2
0
 void SimpleEditor_Dirty(object sender, DataModifiedEventArgs e)
 {
     if (m_simpleEditor is DropDownControl)
     {
         m_helper.SetDirty(e.NewValue.ToString());
         // Don't want to save as that will cause repopulation, which is annoying if we're typing something in to a freetext dropdown
     }
     if (m_simpleEditor is NumberControl || m_simpleEditor is NumberDoubleControl)
     {
         m_helper.SetDirty(e.NewValue.ToString());
         Save();
     }
     else
     {
         m_helper.RaiseDirtyEvent(e.NewValue);
     }
 }
Ejemplo n.º 3
0
 private void textBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     m_helper.RaiseDirtyEvent(textBox.Text);
 }
 void ctlDictionaryString_Dirty(object sender, DataModifiedEventArgs args)
 {
     m_helper.RaiseDirtyEvent(args.NewValue);
 }