AGS.Plugin.Lua.LuaForAGSEditorComponent.IEditorComponent C# (CSharp) Метод

IEditorComponent() публичный Метод

public IEditorComponent ( string controlID ) : void
controlID string
Результат void
        void IEditorComponent.CommandClick(string controlID)
        {
            if (controlID.StartsWith(DELETESCRIPT_PREFIX))
            {
                string path = controlID.Substring(DELETESCRIPT_PREFIX.Length);
                LuaScriptFileInfo script;
                if (!scripts.TryGetValue(path, out script))
                {
                    MessageBox.Show("Cannot find " + path + "!");
                }
                else
                {
                    if (MessageBox.Show("'" + script.file.Name + "' will be deleted permanently.",
                        "Are you sure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
                    {
                        LuaScriptEditPane pane;
                        if (editPanes.TryGetValue(path, out pane))
                        {
                            editor.GUIController.RemovePaneIfExists(pane.contentDocument);
                        }
                        script.Delete();
                        // Cannot delete the node individually, so reload the whole lot
                        //fileInfo.parent.RefreshIcons();
                        //RefreshProjectTree();
                    }
                }
                return;
            }
            if (controlID.StartsWith(INCLUDESCRIPT_PREFIX))
            {
                string key = controlID.Substring(INCLUDESCRIPT_PREFIX.Length);
                LuaScriptFileInfo script = scripts[key];
                script.IncludeAtRunTime = !script.IncludeAtRunTime;
                return;
            }
            if (controlID.StartsWith(RENAMESCRIPT_PREFIX))
            {
                string key = controlID.Substring(RENAMESCRIPT_PREFIX.Length);
                LuaScriptFileInfo selectedScript;
                if (!scripts.TryGetValue(key, out selectedScript))
                {
                    MessageBox.Show("Cannot find " + key + "!");
                }
                else
                {
                    new CreateOrRenameDialog(this, selectedScript).ShowDialog();
                }
                return;
            }
            if (controlID.StartsWith(DELETEFOLDER_PREFIX))
            {
                string path = controlID.Substring(DELETEFOLDER_PREFIX.Length);
                LuaScriptFolderInfo folder;
                if (!scriptFolders.TryGetValue(path, out folder))
                {
                    MessageBox.Show("Cannot find " + path + "!");
                }
                else
                {
                    if (MessageBox.Show("'" + folder.dir.Name + "', and all files and subfolders contained within it, will be deleted permanently.",
                        "Are you sure?", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
                    {
                        folder.Delete();
                    }
                }
                return;
            }
            if (controlID.StartsWith(RENAMEFOLDER_PREFIX))
            {
                string key = controlID.Substring(RENAMEFOLDER_PREFIX.Length);
                LuaScriptFolderInfo folder;
                if (!scriptFolders.TryGetValue(key, out folder))
                {
                    MessageBox.Show("Cannot find " + key + "!");
                }
                else
                {
                    new CreateOrRenameDialog(this, folder).ShowDialog();
                }
                return;
            }
            if (controlID.StartsWith(CTSCRIPT_MOVEDOWN_PREFIX))
            {
                int index = int.Parse(controlID.Substring(CTSCRIPT_MOVEDOWN_PREFIX.Length));
                LuaScriptFileInfo this_script = compileTimeScripts[index];
                LuaScriptFileInfo swap_with = compileTimeScripts[index+1];
                compileTimeScripts[index + 1] = this_script;
                compileTimeScripts[index] = swap_with;
                RefreshCompileTimeScripts();
                editor.GUIController.ProjectTree.SelectNode(this, COMPILETIMEENTRY_PREFIX + (index + 1));
                return;
            }
            if (controlID.StartsWith(CTSCRIPT_MOVEUP_PREFIX))
            {
                int index = int.Parse(controlID.Substring(CTSCRIPT_MOVEUP_PREFIX.Length));
                LuaScriptFileInfo this_script = compileTimeScripts[index];
                LuaScriptFileInfo swap_with = compileTimeScripts[index - 1];
                compileTimeScripts[index - 1] = this_script;
                compileTimeScripts[index] = swap_with;
                RefreshCompileTimeScripts();
                editor.GUIController.ProjectTree.SelectNode(this, COMPILETIMEENTRY_PREFIX + (index - 1));
                return;
            }
            if (controlID.StartsWith(CTSCRIPT_REMOVE_PREFIX))
            {
                if (DialogResult.Yes != MessageBox.Show("Are you sure you want to Remove this Action?",
                    "Are you sure?",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Exclamation))
                {
                    return;
                }
                int index = int.Parse(controlID.Substring(CTSCRIPT_REMOVE_PREFIX.Length));
                compileTimeScripts.RemoveAt(index);
                RefreshCompileTimeScripts();
                if (index < compileTimeScripts.Count)
                {
                    editor.GUIController.ProjectTree.SelectNode(this, COMPILETIMEENTRY_PREFIX + index);
                }
                return;
            }
            if (controlID.StartsWith(COMPILETIME_PREFIX))
            {
                LuaScriptFileInfo script = scripts[controlID.Substring(COMPILETIME_PREFIX.Length)];
                if (compileTimeScripts.Contains(script))
                {
                    if (DialogResult.Yes != MessageBox.Show(
                        "This script is already run at compile time at least once. "
                        + "Are you sure want to run it multiple times?",
                        "Script Already Runs At Compile-Time",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                    {
                        return;
                    }
                }
                string new_entry_id = COMPILETIMEENTRY_PREFIX + compileTimeScripts.Count;
                compileTimeScripts.Add(script);
                editor.GUIController.ProjectTree.StartFromNode(this, COMPILE_TIME_SCRIPTS);
                editor.GUIController.ProjectTree.AddTreeLeaf(this, new_entry_id, compileTimeScripts.Count + ". Run: " + script.ScriptPath, SCRIPT_ICON, false);
                editor.GUIController.ProjectTree.SelectNode(this, new_entry_id);
                return;
            }
            if (controlID.StartsWith(SCRIPTS_ROOT))
            {
                if (!controlID.EndsWith("/"))
                {
                    string key = controlID;
                    LuaScriptFileInfo script;
                    if (!scripts.TryGetValue(key, out script))
                    {
                        MessageBox.Show("Cannot find " + key + "!");
                    }
                    else
                    {
                        script.Open();
                    }
                }
                else
                {
                    // Double click on folder = do nothing
                }
                return;
            }
            if (controlID.StartsWith(NEWSCRIPT_PREFIX))
            {
                string path = controlID.Substring(NEWSCRIPT_PREFIX.Length);
                LuaScriptFolderInfo folder;
                if (!scriptFolders.TryGetValue(path, out folder))
                {
                    MessageBox.Show("Cannot find " + path + "!");
                }
                else
                {
                    new CreateOrRenameDialog(this, folder, false).ShowDialog();
                }
                return;
            }
            if (controlID.StartsWith(COMPILETIMEENTRY_PREFIX))
            {
                int index = int.Parse(controlID.Substring(COMPILETIMEENTRY_PREFIX.Length));
                LuaScriptFileInfo script = compileTimeScripts[index];
                editor.GUIController.ProjectTree.SelectNode(this, script.key);
                return;
            }
            if (controlID.StartsWith(NEWFOLDER_PREFIX))
            {
                string path = controlID.Substring(NEWFOLDER_PREFIX.Length);
                LuaScriptFolderInfo folder;
                if (!scriptFolders.TryGetValue(path, out folder))
                {
                    MessageBox.Show("Cannot find " + path + "!");
                }
                else
                {
                    new CreateOrRenameDialog(this, folder, true).ShowDialog();
                }
                return;
            }
            if (controlID.StartsWith(VISUAL_ROOT))
            {
                string[] split = controlID.Split(new string[] { "::" }, StringSplitOptions.None);
                VisualLuaValue val;
                if (split.Length == 2)
                {
                    if (!visualValues.TryGetValue(split[0], out val))
                    {
                        MessageBox.Show("Cannot find Visual Value " + split[0]);
                        return;
                    }
                    val.OnCommand(split[1]);
                }
                else
                {
                    if (!visualValues.TryGetValue(controlID, out val))
                    {
                        MessageBox.Show("Cannot find Visual Value " + controlID);
                        return;
                    }
                    val.OnCommand(null);
                }
            }
            switch (controlID)
            {
                case LUA_CONVERT_MENUOPTION:
                    editor.GUIController.AddOrShowPane(codeConvertContentDoc);
                    break;
                case CONTROL_ID_ENABLE:
                    IsPluginEnabled = !IsPluginEnabled;
                    if (IsPluginEnabled)
                    {
                        if (!ShownEnableMessage)
                        {
                            ShownEnableMessage = true;
                            MessageBox.Show("Remember to also activate the Lua Run-Time Component in the \"Plugins\" section.",
                                "Run-Time Component Reminder", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        rootScriptFolder = new LuaScriptFolderInfo(this, null, new DirectoryInfo(lscriptsdir));
                        RefreshProjectTree();
                    }
                    else
                    {
                        if (!ShownDisableMessage)
                        {
                            ShownDisableMessage = true;
                            MessageBox.Show("Remember to also deactivate the Lua Run-Time Component in the \"Plugins\" section.",
                                "Run-Time Component Reminder", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        scripts.Clear();
                        compileTimeScripts.Clear();
                        ClearScriptFolders();
                    }
                    break;
                default:
                    //_editor.GUIController.ShowMessage(controlID, MessageBoxIconType.Information);
                    break;
            }
        }

Same methods

LuaForAGSEditorComponent::IEditorComponent ( string controlID ) : IList
LuaForAGSEditorComponent::IEditorComponent ( ) : void
LuaForAGSEditorComponent::IEditorComponent ( XmlNode node ) : void
LuaForAGSEditorComponent::IEditorComponent ( XmlTextWriter writer ) : void
LuaForAGSEditorComponent::IEditorComponent ( string propertyName, object oldValue ) : void