示例#1
0
 private void scriptOptionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ScriptManager.LoadedScript == null)
     {
         if (MessageBox.Show("No script is currently loaded. Please load a script to edit its options.", "No Script Loaded", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK)
         {
             Forms.Scripts.Show();
         }
     }
     else
     {
         try
         {
             object compiled = ScriptManager.Compile(File.ReadAllText(ScriptManager.LoadedScript));
             ScriptManager.LoadScriptConfig(compiled);
             if (Bot.Config.Options.Count > 0 || Bot.Config.MultipleOptions.Count > 0)
             {
                 using GenericOptionsForm gof = new GenericOptionsForm()
                       {
                           Container = Bot.Config
                       };
                 gof.ShowDialog();
             }
             else
             {
                 MessageBox.Show("The loaded script has no options to configure.", "No Options", MessageBoxButtons.OK);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Script cannot be configured as it has compilation errors:\r\n" + ex);
         }
     }
 }
示例#2
0
 private void applicationOptionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using GenericOptionsForm gof = new GenericOptionsForm()
           {
               Container = AppRuntime.Options
           };
     gof.ShowDialog();
 }
示例#3
0
 /// <summary>
 /// Opens the script option window and waits for the user to save the options.
 /// </summary>
 public void Configure()
 {
     SetDefaults();
     Load();
     using (GenericOptionsForm gof = new GenericOptionsForm()
     {
         Container = this
     })
         gof.ShowDialog();
 }