示例#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);
            }
        }
示例#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);
            }
        }