using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using IntelliDispatch; using PluginInterface; namespace IntelliDispatch { /// /// Summary description for Form1. /// public class frmMain : Form { private System.Windows.Forms.MainMenu mainMenu; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private SplitContainer splitContainer1; private ToolStrip toolStrip1; private IContainer components; private MenuItem menuItem3; private MenuItem menuItem4; public frmMain() { // // Required for Windows Form Designer support // InitializeComponent(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); this.mainMenu = new System.Windows.Forms.MainMenu(this.components); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // mainMenu // this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem3}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2}); this.menuItem1.Text = "&File"; // // menuItem2 // this.menuItem2.Index = 0; this.menuItem2.Text = "&Exit"; this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); // // menuItem3 // this.menuItem3.Index = 1; this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem4}); this.menuItem3.Text = "Help"; // // menuItem4 // this.menuItem4.Index = 0; this.menuItem4.Text = "About IntelliDispatch"; this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click); // // splitContainer1 // this.splitContainer1.AllowDrop = true; this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer1.IsSplitterFixed = true; this.splitContainer1.Location = new System.Drawing.Point(0, 10); this.splitContainer1.Margin = new System.Windows.Forms.Padding(0); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.toolStrip1); this.splitContainer1.Panel1MinSize = 60; // // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("splitContainer1.Panel2.BackgroundImage"))); this.splitContainer1.Panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.splitContainer1.Size = new System.Drawing.Size(776, 596); this.splitContainer1.SplitterDistance = 75; this.splitContainer1.SplitterWidth = 1; this.splitContainer1.TabIndex = 0; // // toolStrip1 // this.toolStrip1.BackColor = System.Drawing.Color.Transparent; this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow; this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; this.toolStrip1.Size = new System.Drawing.Size(75, 596); this.toolStrip1.TabIndex = 0; this.toolStrip1.Text = "Menu"; this.toolStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.toolStrip1_ItemClicked); // // frmMain // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(776, 606); this.Controls.Add(this.splitContainer1); this.Menu = this.mainMenu; this.MinimumSize = new System.Drawing.Size(575, 400); this.Name = "frmMain"; this.Padding = new System.Windows.Forms.Padding(0, 10, 0, 0); this.Text = "IntelliDispatch"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Closing += new System.ComponentModel.CancelEventHandler(this.frmMain_Closing); this.Load += new System.EventHandler(this.frmMain_Load); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void frmMain_Load(object sender, System.EventArgs e) { Cursor.Current = Cursors.WaitCursor; //LoaderForm.TopLevel = true; //LoaderForm.Show(); Loader objLoader = new Loader(); if (objLoader.ShowDialog() == DialogResult.OK) { LoadPlugins(); } else { } //Global.Plugins.FindPlugins(Application.StartupPath + @"\Plugins"); } private void LoadPlugins() { toolStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); //Add each plugin to the treeview //toolStrip1.Items.Clear(); foreach (Types.AvailablePlugin pluginOn in Global.Plugins.AvailablePlugins) { //TreeNode newNode = new TreeNode(pluginOn.Instance.Name); //this.tvwPlugins.Nodes.Add(newNode); //newNode = null; ToolStripMenuItem NewMenuItem = new ToolStripMenuItem(pluginOn.Instance.Name.Replace(" ", "\n"), null, null, pluginOn.Instance.Name); NewMenuItem.Image = Image.FromFile(@"images\" + pluginOn.Instance.Name + ".png"); NewMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; toolStrip1.Items.Add(NewMenuItem); } Cursor.Current = Cursors.Default; } private void menuItem2_Click(object sender, System.EventArgs e) { this.Close(); //User clicked File > Exit } private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //Lets call the close for all the plugins before we truly exit! Global.Plugins.ClosePlugins(); } private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { Cursor.Current = Cursors.WaitCursor; //Make sure there's a selected Plugin if (e.ClickedItem.Name != null) { foreach (ToolStripMenuItem item in toolStrip1.Items) { item.BackColor = SystemColors.Control; } e.ClickedItem.BackColor = Color.LightGreen; //Get the selected Plugin Types.AvailablePlugin selectedPlugin = Global.Plugins.AvailablePlugins.Find(e.ClickedItem.Name.ToString()); this.Text = "IntelliDispatch - " + e.ClickedItem.Name.ToString(); if (selectedPlugin != null) { this.splitContainer1.Panel2.Controls.Clear(); selectedPlugin.Instance.MainInterface.Dock = DockStyle.Fill; this.splitContainer1.Panel2.Controls.Add(selectedPlugin.Instance.MainInterface); } } Cursor.Current = Cursors.Default; } private void menuItem4_Click(object sender, EventArgs e) { var About = new About(); About.ShowDialog(); } } }