public void Initialize(IMapPluginArgs args) { _mapArgs = args; btnHydroModelerPlugin = new ToolStripButton(); // Add UI features btnHydroModelerPlugin.DisplayStyle = ToolStripItemDisplayStyle.Text; //btnSamplePlugin.Image = Resources.MySampleIcon1.ToBitmap(); btnHydroModelerPlugin.Name = "HydroModeler 2.0"; btnHydroModelerPlugin.ToolTipText = "Launch HydroModeler 2.0"; btnHydroModelerPlugin.Click += new EventHandler(btnSamplePlugin_Click); if (_mapArgs.ToolStripContainer != null) { // Add the 'Sample Plugin' button _mapArgs.MainToolStrip.Items.Add(btnHydroModelerPlugin); // Add the 'Added by plugin' tab control foreach (Control control in _mapArgs.ToolStripContainer.ContentPanel.Controls) { if (control is TabControl) { _mainTabControl = control as TabControl; _tabPage = new TabPage("HydroModeler 2.0"); _mainTabControl.TabPages.Add(_tabPage); break; } } } //add some items to the newly created tab control if (_tabPage != null) { //TreeView treeView = new TreeView(); //treeView.Location = new System.Drawing.Point(0, 0); //treeView.Size = new System.Drawing.Size(_tabPage.Width / 3, _tabPage.Height); //treeView.Nodes.Add("Model Components"); //_tabPage.Controls.Add(treeView); MainTab mainTab = new MainTab(_mapArgs); mainTab.Dock = DockStyle.Fill; mainTab.HorizontalScroll.Visible = false; mainTab.VerticalScroll.Visible = false; mainTab.Location = new System.Drawing.Point(_tabPage.Width / 3, 0); mainTab.Size = new System.Drawing.Size(_tabPage.Width * 2 / 3, _tabPage.Height); //lbl.Text = "This tab was added by the HydroModeler Plugin."; //lbl.Location = new System.Drawing.Point(_tabPage.Width / 2, _tabPage.Height / 2); _tabPage.Controls.Add(mainTab); } }
/// <summary> /// The initialization is where this plugin can cache the necessary information about the MapWindow /// project. This includes, for instance, the Map or Legend that is associated with the GeoPlugin /// Manager. This can be useful for trapping events or accessing member values like the MapFrame /// or figuring out what layers are currently in the map, or even getting to the dataset for /// each layer. /// </summary> /// <param name="args">The IGeoPluginArgs replaces the g_MapWin concept and has the necessary application info </param> public void Initialize(IMapPluginArgs args) { _host = args; // When this plugin is activated, a shape editor toolstrip appears with the shape editor functions. // Create a new list of toolstrips that can be provided to the host application _myToolStrip = new ShapeEditorToolStrip(); _myToolStrip.Map = _host.Map; if (_host.ToolStripContainer != null) { _host.ToolStripContainer.TopToolStripPanel.Controls.Add(_myToolStrip); } }
/// <summary> /// Initialize the mapWindow 6 plugin /// </summary> /// <param name="args">The plugin arguments to access the main application</param> public void Initialize(IMapPluginArgs args) { //set the reference to the MapWindow application _mapArgs = args; string tabPageName = "HydroR"; _mainTabControl = FindMainTabControl(); //add some items to the newly created tab control if (_mainTabControl != null) { _hydroRTabPage = new TabPage(tabPageName); _mainTabControl.TabPages.Add(_hydroRTabPage); //add the cRCommandView control to the main tab page _hydroRControl = new cRCommandView(); _hydroRTabPage.Controls.Add(_hydroRControl); _hydroRControl.Dock = DockStyle.Fill; _mainTabControl.SelectedIndexChanged += new EventHandler(mainTabControl_SelectedIndexChanged); } }