Esempio n. 1
0
        public static void EditScript(EditorController controller, ref IEditableScripts scripts, string attribute, string element, bool isReadOnly, Action dirtyAction)
        {
            ScriptEditorPopOut popOut = new ScriptEditorPopOut();

            popOut.ctlScriptEditor.HidePopOutButton();
            popOut.ctlScriptEditor.Helper.DoInitialise(controller, null);
            popOut.ctlScriptEditor.Populate(scripts);
            System.EventHandler <DataModifiedEventArgs> dirtyEventHandler = (object sender, DataModifiedEventArgs e) => dirtyAction.Invoke();
            popOut.ctlScriptEditor.Helper.Dirty += dirtyEventHandler;

            popOut.ShowDialog();
            scripts = popOut.ctlScriptEditor.Scripts;
            popOut.ctlScriptEditor.Save();
            popOut.ctlScriptEditor.Populate((IEditableScripts)null);
            popOut.ctlScriptEditor.Helper.DoUninitialise();
            popOut.ctlScriptEditor.Helper.Dirty -= dirtyEventHandler;
        }
Esempio n. 2
0
        public static void EditScript(EditorController controller, ref IEditableScripts scripts, string attribute, string element, bool isReadOnly, Action dirtyAction)
        {
            ScriptEditorPopOut popOut = new ScriptEditorPopOut();

            popOut.ctlScriptEditor.HidePopOutButton();
            popOut.ctlScriptEditor.Helper.DoInitialise(controller, null);
            popOut.ctlScriptEditor.Populate(scripts);
            System.EventHandler<DataModifiedEventArgs> dirtyEventHandler = (object sender, DataModifiedEventArgs e) => dirtyAction.Invoke();
            popOut.ctlScriptEditor.Helper.Dirty += dirtyEventHandler;

            popOut.ShowDialog();
            scripts = popOut.ctlScriptEditor.Scripts;
            popOut.ctlScriptEditor.Save();
            popOut.ctlScriptEditor.Populate((IEditableScripts)null);
            popOut.ctlScriptEditor.Helper.DoUninitialise();
            popOut.ctlScriptEditor.Helper.Dirty -= dirtyEventHandler;
        }