Example #1
0
		public static void ReloadSideTabs(bool doInsert)
		{
			CreateToolboxService();
			
			sideBar.Tabs.Clear();
			foreach (Category category in componentLibraryLoader.Categories) {
				if (category.IsEnabled) {
					try {
						SideTabDesigner newTab = new SideTabDesigner(sideBar, category, toolboxService);
						newTab.ItemRemoved += SideTabItemRemoved;
						newTab.ItemsExchanged += SideTabItemsExchanged;
						sideBar.Tabs.Add(newTab);
					} catch (Exception e) {
						ICSharpCode.Core.LoggingService.Warn("Can't add tab : " + e);
					}
				}
			}
			if (customTab != null) {
				customTab.Dispose();
			}
			//roman//
            /*customTab = new CustomComponentsSideTab(sideBar, ResourceService.GetString("ICSharpCode.SharpDevelop.FormDesigner.ToolboxProvider.CustomComponents"), toolboxService);
            customTab.ItemRemoved += SideTabItemRemoved;
            customTab.ItemsExchanged += SideTabItemsExchanged;
            sideBar.Tabs.Add(customTab);
            sideBar.ActiveTab = customTab;
             */
            /*if (VisualPascalABC.ProjectFactory.Instance.CurrentProject != null)
            foreach (IReferenceInfo ri in VisualPascalABC.ProjectFactory.Instance.CurrentProject.References)
            {
                AddComponentsFromAssembly(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(PascalABCCompiler.Compiler.get_assembly_path(ri.FullAssemblyName, false)));
            }*/
			// Clear selected toolbox item after reloading the tabs.
            try
            {
                sideBar.ActiveTab = sideBar.Tabs[0]; //roman//
                toolboxService.SetSelectedToolboxItem(null);
            }
            catch
            {
            }
		}
		public static void ReloadSideTabs(bool doInsert)
		{
			CreateToolboxService();
			
			sideBar.Tabs.Clear();
			foreach (Category category in componentLibraryLoader.Categories) {
				if (category.IsEnabled) {
					try {
						SideTabDesigner newTab = new SideTabDesigner(sideBar, category, toolboxService);
						newTab.ItemRemoved += SideTabItemRemoved;
						newTab.ItemsExchanged += SideTabItemsExchanged;
						sideBar.Tabs.Add(newTab);
					} catch (Exception e) {
						SD.Log.Warn("Can't add tab : " + e);
					}
				}
			}
			if (customTab != null) {
				customTab.Dispose();
			}
			customTab = new CustomComponentsSideTab(sideBar, ResourceService.GetString("ICSharpCode.SharpDevelop.FormDesigner.ToolboxProvider.CustomComponents"), toolboxService);
			customTab.ItemRemoved += SideTabItemRemoved;
			customTab.ItemsExchanged += SideTabItemsExchanged;
			sideBar.Tabs.Add(customTab);
			sideBar.ActiveTab = customTab;
			
			// Clear selected toolbox item after reloading the tabs.
			toolboxService.SetSelectedToolboxItem(null);
		}
Example #3
0
 public static void AddComponentsFromAssembly(Assembly assembly)
 {
     if (assembly == typeof(System.Windows.Forms.Form).Assembly || assembly == typeof(int).Assembly)
         return;
     var types = assembly.GetTypes();
     var control_types = new List<Type>();
     Type controlType = typeof(System.Windows.Forms.Control);
     foreach (Type type in types)
         if (type.IsSubclassOf(controlType))
             control_types.Add(type);
     if (control_types.Count > 0)
     {
         string assemblyName = assembly.FullName;
         int ind = assemblyName.IndexOf(',');
         if (ind != -1)
             assemblyName = assemblyName.Substring(0, ind).Trim();
         Category cat = new Category(assemblyName);
         ComponentAssembly cas = new ComponentAssembly(assembly.FullName);
         foreach (Type type in control_types)
         {
             cat.ToolComponents.Add(new ToolComponent(type.FullName, cas, true));
         }
         var dynamicTab = new SideTabDesigner(sideBar, cat, toolboxService);
         dynamicTab.ItemRemoved += SideTabItemRemoved;
         dynamicTab.ItemsExchanged += SideTabItemsExchanged;
         sideBar.Tabs.Add(dynamicTab);
     }
 }