Esempio n. 1
0
        private void SetupUI()
        {
            if (Initialized)
            {
                return;
            }

            var customExitSubMenu = CustomUI.Settings.SettingsUI.CreateSubMenu("Custom Exit");

            var enablePlugin = customExitSubMenu.AddBool("Enable", "Enable or not the plugin");

            enablePlugin.GetValue += delegate { return(PluginConfig.EnablePlugin); };
            enablePlugin.SetValue += delegate(bool value) { PluginConfig.EnablePlugin = value; PluginConfig.SaveConfig(); };
            var askWhenQuitting = customExitSubMenu.AddBool("Confirm on quit", "Show the dialog when quitting");

            askWhenQuitting.GetValue += delegate { return(PluginConfig.AskWhenQuitting); };
            askWhenQuitting.SetValue += delegate(bool value) { PluginConfig.AskWhenQuitting = value; PluginConfig.SaveConfig(); };
            var askWhenRestarting = customExitSubMenu.AddBool("Confirm on restart", "Show the dialog when restarting");

            askWhenRestarting.GetValue += delegate { return(PluginConfig.AskWhenRestarting); };
            askWhenRestarting.SetValue += delegate(bool value) { PluginConfig.AskWhenRestarting = value; PluginConfig.SaveConfig(); };
            var quitTextContent = customExitSubMenu.AddString("Quit text content", "Text written on the dialog opened when quitting (RichText compatible)");

            quitTextContent.GetValue += delegate { return(PluginConfig.QuitTextContent); };
            quitTextContent.SetValue += delegate(string value) { PluginConfig.QuitTextContent = value; PluginConfig.SaveConfig(); };
            var restartTextContent = customExitSubMenu.AddString("Restart text content", "Text written on the dialog opened when restarting (RichText compatible)");

            restartTextContent.GetValue += delegate { return(PluginConfig.RestartTextContent); };
            restartTextContent.SetValue += delegate(string value) { PluginConfig.RestartTextContent = value; PluginConfig.SaveConfig(); };

            Initialized = true;
        }