Ejemplo n.º 1
0
        public bool UserActivatedPlugin = false; //used to check if this plug-in should react on GUI

        #region Implementation of IPlugin

        /// <summary>
        /// This event is called when a plugin is loaded or turned on in the MapWindow.
        /// </summary>
        /// <param name="MapWin">The interface to use to access the MapWindow.</param>
        /// <param name="ParentHandle">The window handle of the MapWindow form.  This handle is useful for
        /// making the MapWindow the owner of plugin forms.</param>
        public void Initialize(MapWindow.Interfaces.IMapWin MapWin, int ParentHandle)
        {
            try
            {
                _mapWin       = MapWin;
                _parentHandle = ParentHandle; //Needed to not let the forms fall behind MapWindow
                //Resources:
                var cResources = new clsResources();

                MapWindow.Interfaces.Toolbar t = MapWin.Toolbar;

                t.AddToolbar(_toolbarName);
                MapWindow.Interfaces.ToolbarButton b = t.AddButton(_btnNameLoadData, _toolbarName, "", "");
                b.BeginsGroup = true;
                b.Tooltip     = _toolTipLoadData;
                b.Category    = _toolbarName;
                System.Drawing.Icon oIcon = cResources.GetEmbeddedIcon("TemplatePluginVS2008.ico");
                b.Picture = new System.Drawing.Icon(oIcon, new System.Drawing.Size(16, 16));

                //Clean up:
                t = null;
                b = null;
            }
            catch (Exception ex)
            {
                _mapWin.ShowErrorDialog(ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This event is called when a plugin is loaded or turned on in the MapWindow.
        /// </summary>
        /// <param name="MapWin">The interface to use to access the MapWindow.</param>
        /// <param name="ParentHandle">The window handle of the MapWindow form.  This handle is useful for
        /// making the MapWindow the owner of plugin forms.</param>
        public void Initialize(MapWindow.Interfaces.IMapWin MapWin, int ParentHandle)
        {
            try
            {
                _mapWin = MapWin;

                MapWindow.Interfaces.Toolbar t = MapWin.Toolbar;
                //Resources:
                clsResources cResources = new clsResources();

                t.AddToolbar(_toolbarName);
                MapWindow.Interfaces.ToolbarButton b = t.AddButton(_btnNameShp2Grid, _toolbarName, "", "");
                b.BeginsGroup = true;
                b.Tooltip     = _toolTipShp2Grid;
                b.Category    = _toolbarName;

                System.Drawing.Icon oIcon = cResources.GetEmbeddedIcon("shp2grid6.ico");
                b.Picture = new System.Drawing.Icon(oIcon, new System.Drawing.Size(16, 16));

                //Clean up:
                t = null;
                b = null;
            }
            catch (Exception ex)
            {
                _mapWin.ShowErrorDialog(ex);
            }
        }
Ejemplo n.º 3
0
        public void Initialize(MapWindow.Interfaces.IMapWin MapWin, int ParentHandle)
        {
            try
            {
                m_MapWin       = MapWin;
                m_ParentHandle = ParentHandle;

                m_shpFilePropfrm = new mwIdentifier.Forms.frmShapeFileProp(this);
                m_GridPropfrm    = new mwIdentifier.Forms.frmGridProp(this);
                m_WMSPropfrm     = new mwIdentifier.Forms.frmWMSProp(this);

                System.Drawing.Icon icon;
                System.Drawing.Icon icon2;
                icon  = m_shpFilePropfrm.Icon;
                icon2 = new System.Drawing.Icon(this.GetType(), "IdentByShape.ico");
                MapWindow.Interfaces.ToolbarButton button;

                //Add the tool bar
                if (m_ToolbarName.Length > 0)
                {
                    m_MapWin.Toolbar.AddToolbar(m_ToolbarName);
                }

                //add buttons and the tool tip
                // button = m_MapWin.Toolbar.AddButton("Identifier", m_ToolbarName, null, null);
                button = m_MapWin.Toolbar.AddButton("ddIdentifier", m_ToolbarName, true);
                if (button == null)
                {
                    throw new Exception("Failed to add Identifier Button (" + m_MapWin.LastError + ")");
                }
                button.Tooltip     = "Identifier";
                button.Text        = "";
                m_IdentBtn         = button;
                m_IdentBtn.Picture = icon;

                button = m_MapWin.Toolbar.AddButton("Identify", m_ToolbarName, "ddIdentifier", "");
                if (button == null)
                {
                    throw new Exception("Failed to add Identifier Button (" + m_MapWin.LastError + ")");
                }
                button.Text         = "Identifier";
                m_IdentBtn2         = button;
                m_IdentBtn2.Picture = icon;

                button = m_MapWin.Toolbar.AddButton("Identify by Shape(s)", m_ToolbarName, "ddIdentifier", "");
                if (button == null)
                {
                    throw new Exception("Failed to add Identifier Button (" + m_MapWin.LastError + ")");
                }
                button.Text            = "Identify by Shape(s)";
                m_IdentByShape         = button;
                m_IdentByShape.Picture = icon2;
            }
            catch (System.Exception ex)
            {
                ShowErrorBox("Initialize()", ex.Message);
            }
        }
Ejemplo n.º 4
0
        public void AddButtonTest1()
        {
            Toolbar target = new Toolbar();                     // TODO: Initialize to an appropriate value
            string  Name   = string.Empty;                      // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.ToolbarButton expected = null; // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.ToolbarButton actual;
            actual = target.AddButton(Name);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void SubItemTest1()
        {
            ToolStripButton Button = null;                                         // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.ToolbarButton target = new ToolbarButton(Button); // TODO: Initialize to an appropriate value
            int Index = 0;                                                         // TODO: Initialize to an appropriate value

            MapWindow.Interfaces.ToolbarButton expected = null;                    // TODO: Initialize to an appropriate value
            MapWindow.Interfaces.ToolbarButton actual;
            actual = target.SubItem(Index);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }