private void AIEditor_Shown(object sender, EventArgs e) { if (AIScriptHolder.DicAIScripts.Count == 0) { AIScriptHolder.DicAIScripts = AIScriptHolder.LoadAllScripts(); } aiViewer.Init(SelectScript); }
public AIEditor() { InitializeComponent(); #region cbDrawScripts //Init the DisplayUnselectedLayers button (as it can't be done with the tool box) cbShowExecutionOrder = new CheckBox(); cbShowExecutionOrder.Text = "Show Execution Order"; cbShowExecutionOrder.AutoSize = false; //Link a CheckedChanged event to a method. cbShowExecutionOrder.Checked = true; cbShowExecutionOrder.CheckedChanged += new EventHandler(tsmShowExecutionOrder_Click); //Make it 10 pixel after the last mnuToolBar item. cbShowExecutionOrder.Padding = new Padding(10, 0, 0, 0); ToolStripControlHost s = new ToolStripControlHost(cbShowExecutionOrder); s.AutoSize = false; s.Width = 180; mnuToolBar.Items.Add(s); #endregion foreach (KeyValuePair <string, List <AIScript> > ActiveScripts in AIScriptHolder.GetAllScriptsByCategory()) { ListBox NewScriptListBox = new ListBox(); aiViewer.tsmDeleteScript.Click += tsmDeleteScript_Click; NewScriptListBox.Dock = DockStyle.Fill; NewScriptListBox.FormattingEnabled = true; NewScriptListBox.Location = new Point(0, 0); NewScriptListBox.Name = "lst" + ActiveScripts.Key; NewScriptListBox.Size = new Size(248, 243); NewScriptListBox.TabIndex = 4; NewScriptListBox.DoubleClick += new EventHandler(lstChoices_DoubleClick); NewScriptListBox.Items.AddRange(ActiveScripts.Value.ToArray()); TabPage NewScriptTab = new TabPage(); NewScriptTab.Controls.Add(NewScriptListBox); NewScriptTab.Location = new Point(4, 22); NewScriptTab.Name = "tab" + ActiveScripts.Key; NewScriptTab.Size = new Size(248, 243); NewScriptTab.TabIndex = 4; NewScriptTab.Text = ActiveScripts.Key; NewScriptTab.UseVisualStyleBackColor = true; tabControl1.Controls.Add(NewScriptTab); } }