Beispiel #1
0
		/// <summary>
		/// Unload our plugin
		/// </summary>
		public override void Unload() 
		{
			if(m_MenuItem!=null)
			{
				foreach (MenuItem menuItem in m_Application.MainMenu.MenuItems)
				{
					if (menuItem.Text.Replace("&", "") == "Edit")
					{
						menuItem.MenuItems.Remove( m_MenuItem );
						break;
					}
				}
				m_MenuItem.Dispose();
				m_MenuItem = null;
			}

			if(m_ToolbarItem != null)
			{
				ParentApplication.WorldWindow.MenuBar.RemoveToolsMenuButton(m_ToolbarItem);
				m_ToolbarItem.Dispose();
				m_ToolbarItem = null;
			}

			if(m_Form != null)
			{
				m_Form.Dispose();
				m_Form = null;
			}
		}
Beispiel #2
0
		/// <summary>
		/// Plugin entry point 
		/// </summary>
		public override void Load() 
		{
			if(ParentApplication.WorldWindow.CurrentWorld != null && ParentApplication.WorldWindow.CurrentWorld.Name.IndexOf("Earth") >= 0)
			{
				m_MenuItem = new MenuItem("Place Finder");
				m_MenuItem.Click += new EventHandler(menuItemClicked);
				foreach (MenuItem menuItem in m_Application.MainMenu.MenuItems)
				{
					if (menuItem.Text.Replace("&", "") == "Edit")
					{
						menuItem.MenuItems.Add( m_MenuItem );
						break;
					}
				}
			
				m_Form = new PlaceFinder(ParentApplication.WorldWindow);
				m_Form.Closing += new CancelEventHandler(m_Form_Closing);
				m_Form.Owner = ParentApplication;
			
				m_ToolbarItem = new WorldWind.WindowsControlMenuButton(
					"PlaceFinder",
					Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\Data\\Icons\\Interface\\search.png",
					m_Form);
			
				ParentApplication.WorldWindow.MenuBar.AddToolsMenuButton(m_ToolbarItem);
			}
		}