1using System;2using System.Drawing;3using System.Collections;4using System.ComponentModel;5using System.Windows.Forms;6using System.Data;7using IntelliDispatch;8using PluginInterface;910namespace IntelliDispatch11{12/// <summary>13/// Summary description for Form1.14/// </summary>15public class frmMain : Form16{17private System.Windows.Forms.MainMenu mainMenu;18private System.Windows.Forms.MenuItem menuItem1;19private System.Windows.Forms.MenuItem menuItem2;20private SplitContainer splitContainer1;21private ToolStrip toolStrip1;22private IContainer components;23private MenuItem menuItem3;24private MenuItem menuItem4;2526public frmMain()27{28//29// Required for Windows Form Designer support30//31InitializeComponent();323334}35363738394041/// <summary>42/// Clean up any resources being used.43/// </summary>44protected override void Dispose( bool disposing )45{46if( disposing )47{48if (components != null)49{50components.Dispose();51}52}53base.Dispose( disposing );54}5556#region Windows Form Designer generated code57/// <summary>58/// Required method for Designer support - do not modify59/// the contents of this method with the code editor.60/// </summary>61private void InitializeComponent()62{63this.components = new System.ComponentModel.Container();64System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));65this.mainMenu = new System.Windows.Forms.MainMenu(this.components);66this.menuItem1 = new System.Windows.Forms.MenuItem();67this.menuItem2 = new System.Windows.Forms.MenuItem();68this.menuItem3 = new System.Windows.Forms.MenuItem();69this.menuItem4 = new System.Windows.Forms.MenuItem();70this.splitContainer1 = new System.Windows.Forms.SplitContainer();71this.toolStrip1 = new System.Windows.Forms.ToolStrip();72((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();73this.splitContainer1.Panel1.SuspendLayout();74this.splitContainer1.SuspendLayout();75this.SuspendLayout();76//77// mainMenu78//79this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {80this.menuItem1,81this.menuItem3});82//83// menuItem184//85this.menuItem1.Index = 0;86this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {87this.menuItem2});88this.menuItem1.Text = "&File";89//90// menuItem291//92this.menuItem2.Index = 0;93this.menuItem2.Text = "&Exit";94this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);95//96// menuItem397//98this.menuItem3.Index = 1;99this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {100this.menuItem4});101this.menuItem3.Text = "Help";102//103// menuItem4104//105this.menuItem4.Index = 0;106this.menuItem4.Text = "About IntelliDispatch";107this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);108//109// splitContainer1110//111this.splitContainer1.AllowDrop = true;112this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;113this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;114this.splitContainer1.IsSplitterFixed = true;115this.splitContainer1.Location = new System.Drawing.Point(0, 10);116this.splitContainer1.Margin = new System.Windows.Forms.Padding(0);117this.splitContainer1.Name = "splitContainer1";118//119// splitContainer1.Panel1120//121this.splitContainer1.Panel1.Controls.Add(this.toolStrip1);122this.splitContainer1.Panel1MinSize = 60;123//124// splitContainer1.Panel2125//126this.splitContainer1.Panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("splitContainer1.Panel2.BackgroundImage")));127this.splitContainer1.Panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;128this.splitContainer1.Size = new System.Drawing.Size(776, 596);129this.splitContainer1.SplitterDistance = 75;130this.splitContainer1.SplitterWidth = 1;131this.splitContainer1.TabIndex = 0;132//133// toolStrip1134//135this.toolStrip1.BackColor = System.Drawing.Color.Transparent;136this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Fill;137this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;138this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow;139this.toolStrip1.Location = new System.Drawing.Point(0, 0);140this.toolStrip1.Name = "toolStrip1";141this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;142this.toolStrip1.Size = new System.Drawing.Size(75, 596);143this.toolStrip1.TabIndex = 0;144this.toolStrip1.Text = "Menu";145this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked);146//147// frmMain148//149this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);150this.ClientSize = new System.Drawing.Size(776, 606);151this.Controls.Add(this.splitContainer1);152this.Menu = this.mainMenu;153this.MinimumSize = new System.Drawing.Size(575, 400);154this.Name = "frmMain";155this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0);156this.Text = "IntelliDispatch";157this.WindowState = System.Windows.Forms.FormWindowState.Maximized;158this.Closing += new System.ComponentModel.CancelEventHandler(this.frmMain_Closing);159this.Load += new System.EventHandler(this.frmMain_Load);160this.splitContainer1.Panel1.ResumeLayout(false);161this.splitContainer1.Panel1.PerformLayout();162((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();163this.splitContainer1.ResumeLayout(false);164this.ResumeLayout(false);165166}167#endregion168169170private void frmMain_Load(object sender, System.EventArgs e)171{172173Cursor.Current = Cursors.WaitCursor;174//LoaderForm.TopLevel = true;175//LoaderForm.Show();176177Loader objLoader = new Loader();178if (objLoader.ShowDialog() == DialogResult.OK)179{180LoadPlugins();181}182else183{184185}186187//Global.Plugins.FindPlugins(Application.StartupPath + @"\Plugins");188189}190191192private void LoadPlugins()193{194195toolStrip1.ImageScalingSize = new System.Drawing.Size(40, 40);196197//Add each plugin to the treeview198199//toolStrip1.Items.Clear();200201foreach (Types.AvailablePlugin pluginOn in Global.Plugins.AvailablePlugins)202{203//TreeNode newNode = new TreeNode(pluginOn.Instance.Name);204//this.tvwPlugins.Nodes.Add(newNode);205//newNode = null;206207ToolStripMenuItem NewMenuItem = new ToolStripMenuItem(pluginOn.Instance.Name.Replace(" ", "\n"), null, null, pluginOn.Instance.Name);208NewMenuItem.Image = Image.FromFile(@"images\" + pluginOn.Instance.Name + ".png");209NewMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;210toolStrip1.Items.Add(NewMenuItem);211212213}214Cursor.Current = Cursors.Default;215216}217218219private void menuItem2_Click(object sender, System.EventArgs e)220{221this.Close(); //User clicked File > Exit222}223224private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)225{226//Lets call the close for all the plugins before we truly exit!227Global.Plugins.ClosePlugins();228}229230private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)231{232Cursor.Current = Cursors.WaitCursor;233234//Make sure there's a selected Plugin235if (e.ClickedItem.Name != null)236{237foreach (ToolStripMenuItem item in toolStrip1.Items)238{239item.BackColor = SystemColors.Control;240}241242e.ClickedItem.BackColor = Color.LightGreen;243244//Get the selected Plugin245Types.AvailablePlugin selectedPlugin = Global.Plugins.AvailablePlugins.Find(e.ClickedItem.Name.ToString());246this.Text = "IntelliDispatch - " + e.ClickedItem.Name.ToString();247248if (selectedPlugin != null)249{250this.splitContainer1.Panel2.Controls.Clear();251252selectedPlugin.Instance.MainInterface.Dock = DockStyle.Fill;253254this.splitContainer1.Panel2.Controls.Add(selectedPlugin.Instance.MainInterface);255256}257258}259Cursor.Current = Cursors.Default;260}261262private void menuItem4_Click(object sender, EventArgs e)263{264var About = new About();265About.ShowDialog();266}267268269}270}