Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the SampleLayer class
        /// </summary>
        /// <param name="pluginToken">plugin token</param>
        /// <param name="layerTitle">Title to display on layer</param>
        /// <param name="plugin">Title for layer shown in panel on left hand side</param>
        public CreateLayer(PluginToken pluginToken, string layerTitle, TweetHeatPlugin plugin)
            : base(pluginToken)
        {
            // Give the layer a title, is shown above the panel area on the left hand side
            this.Title = layerTitle;
            this.parent = plugin;

            // Handle icon generation requests for the layer (above the panel) and 'map manager'
            this.IconGenerator = new Func<LayerIconContext, UIElement>(this.RenderIcon);

            // Add a new sample panel control
            this.Panel = new SamplePanel();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the MapEntitiesLayer class
        /// </summary>
        /// <param name="pluginToken">plugin requirement</param>
        /// <param name="layerTitle">Title shown on layer</param>
        /// <param name="parentPushpinFactoryContract">PushpinFactoryContract from plugin</param>
        public MapEntitiesLayer(PluginToken pluginToken, string layerTitle, TweetHeatPlugin plugin)
            : base(pluginToken)
        {
            // Give the layer a title, is shown above the panel area
            this.Title = layerTitle;
            this.parent = plugin;

            // Handle icon generation requests for the layer(above the panel) and Legend(now 'Map Manager')
            this.IconGenerator = new Func<LayerIconContext, UIElement>(this.RenderIcon);

            // Add the panel
            this.MainPanel = new SamplePanel();
            this.Panel = this.MainPanel;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Toes the string.
        /// </summary>
        /// <remarks>Format specified: P - plugin token A - absolutepath with session id F - file name</remarks>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        public string ToString(string format)
        {
            StringBuilder retVal = new StringBuilder();

            foreach (char patternChar in format.ToCharArray())
            {
                switch (patternChar)
                {
                case 'P':
                    retVal.Append(PluginToken.ToString());
                    break;

                case 'A':
                    List <byte> token = new List <byte>();
                    token.AddRange(BitConverter.GetBytes(SessionIdDelimiter));
                    //If SessionId is empty then no save him
                    if (SessionId != Guid.Empty)
                    {
                        token.AddRange(SessionId.ToByteArray());
                    }
                    token.AddRange(BitConverter.GetBytes(SessionIdDelimiter));
                    //absolute path
                    token.AddRange(AbsolutePath.GetByteArray());
                    retVal.Append(CryptToken(token.ToArray()));
                    break;

                case 'F':
                    retVal.Append(FileNameReplaceInvalidChars(AbsolutePath.FileName));
                    break;

                default:
                    retVal.Append(patternChar);
                    break;
                }
            }

            return(retVal.ToString());
        }
 /// <summary>
 /// Deactivates the current token, removing the plugin from the active plugins list.
 /// This isn't quite the same as unloading the plugin.
 /// </summary>
 /// <param name="token"></param>
 public void DeactivateToken(PluginToken token)
 {
     if (_activeTokens.ContainsKey(token))
     {
         IExtension ext = _activeTokens[token];
         ext.Deactivate();
         IMapPlugin pg = ext as IMapPlugin;
         if (pg != null)
         {
             _geoPlugins.Remove(pg);
         }
     }
 }
        /// <summary>
        /// Activates the specified token
        /// </summary>
        /// <param name="token">The token to activate</param>
        public void ActivateToken(PluginToken token)
        {
            IExtension ext;
            if (_activeTokens == null) _activeTokens = new Dictionary<PluginToken, IExtension>();
            if (_activeTokens.ContainsKey(token))
            {
                ext = _activeTokens[token];
            }
            else
            {
                ext = token.CreateInstance<IExtension>();
                if (ext == null) return;
                _activeTokens.Add(token, ext);
            }


            IMapPlugin gp = ext as IMapPlugin;
            if (gp != null)
            {
                IMapPluginArgs args = new GeoPluginArgs(_map, _legend, _mainMenu, _toolStrip, _progressHandler, _geoPlugins, _toolStripContainer, _panelManager);
                gp.Initialize(args);
                _geoPlugins.Add(gp);
            }

            ext.Activate();     
          
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Deactivates the current token, removing the plugin from the active plugins list.
 /// This isn't quite the same as unloading the plugin.
 /// </summary>
 /// <param name="token"></param>
 public void DeactivateToken(PluginToken token)
 {
     token.Enabled = false;
     IMapPlugin gp = _tokenPlugins[token];
     gp.Deactivate();
     // Remove from the "loaded plugins" list
     _geoPlugins.Remove(_tokenPlugins[token]);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Activates the specified token
 /// </summary>
 /// <param name="token">The token to activate</param>
 public void ActivateToken(PluginToken token)
 {
     IMapPlugin gp = null;
     if (_tokenPlugins.ContainsKey(token))
     {
         gp = _tokenPlugins[token];
     }
     else
     {
         gp = token.CreateInstance<IMapPlugin>();
         IMapPluginArgs args = new GeoPluginArgs(_map, _legend, _mainMenu, _toolStrip, _progressHandler, _geoPlugins, _toolStripContainer, _panelManager);
         gp.Initialize(args);
         _tokenPlugins.Add(token, gp);
     }
     
     _geoPlugins.Add(gp);
     gp.Activate();
     
 }