Beispiel #1
0
 private void select_CheckedChanged(object sender, EventArgs e)
 {
     if (select.Checked)
     {
         SelectedTool = ToolboxItem.Select;
         orbit.Checked = false;
         OnSelectedToolChanged();
     }
 }
 /// <summary>
 /// Adds the layout control.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="data">The data.</param>
 protected virtual void AddLayoutControl(ConfigElementList<ToolboxItem> parent, GridControlData data)
 {
     var control = parent.FirstOrDefault<ToolboxItem>(t => t.Name == data.Name);
     if (control == null)
     {
         control = new ToolboxItem(parent);
         control.ControlType = typeof(GridControl).AssemblyQualifiedName;
         control.Name = data.Name;
         control.Title = data.Title;
         control.LayoutTemplate = data.LayoutTemplatePath;
         control.CssClass = data.CssClass;
         parent.Add(control);
     }
 }
 public void AddToolboxItem(ToolboxItem toolboxItem)
 {
     AddItemToToolbox(toolboxItem, null, null);
 }
 public void RemoveToolboxItem(ToolboxItem toolboxItem, string category)
 {
     System.Console.WriteLine("RemoveToolboxItem");
     toolboxItems.Remove(toolboxItem);
     FireToolboxItemRemoved(toolboxItem, null, null);
 }
 public void AddLinkedToolboxItem(ToolboxItem toolboxItem, IDesignerHost host)
 {
     AddItemToToolbox(toolboxItem, null, host);
 }
 protected void CreateTool(ToolboxItem tool, Rectangle bounds)
 {
     CreateToolCore(tool, bounds.X, bounds.Y, bounds.Width, bounds.Width, true, true);
 }
        public void Install(Telerik.Sitefinity.Abstractions.SiteInitializer initializer, Version upgradeFrom)
        {
            var config = initializer.Context.GetConfig<ToolboxesConfig>();
            var pageControls = config.Toolboxes["PageControls"];

            var section = pageControls.Sections
                .Where<ToolboxSection>(e => e.Name == "Login")
                .FirstOrDefault();

            if (!section.Tools.Any<ToolboxItem>(e => e.Name == "OAuthLogin"))
            {
                var blogsList = new ToolboxItem(section.Tools)
                {
                    Name = "OAuthLogin",
                    Title = "OAuthLogin",
                    Description = "OAuthLogin",
                    ControlType = typeof(OAuthLoginForm).AssemblyQualifiedName
                };
                section.Tools.Add(blogsList);
            }



            var virtualPathConfig = initializer.Context.GetConfig<VirtualPathSettingsConfig>();
            if (!virtualPathConfig.VirtualPaths.Elements.Any(vp => vp.VirtualPath == "~/oauth/*"))
            {
                var moduleVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)
                {
                    VirtualPath = "~/oauth/*",
                    ResolverName = "EmbeddedResourceResolver",
                    ResourceLocation = "OauthExternalAuthentication"
                };
                virtualPathConfig.VirtualPaths.Add(moduleVirtualPathConfig);
            }


        }
Beispiel #8
0
 protected virtual bool CanCreateComponentFromTool(ToolboxItem tool)
 {
     // TODO
     return(false);
 }
Beispiel #9
0
 // This method can perform behavior when the specified tool has been invoked.
 // Invocation of a ToolboxItem typically creates a component or components,
 // and adds any created components to the associated component.
 void IToolboxUser.ToolPicked(ToolboxItem tool)
 {
 }
 public void RemoveToolboxItem(ToolboxItem toolboxItem)
 {
     throw new NotImplementedException();
 }
 public object SerializeToolboxItem(ToolboxItem toolboxItem)
 {
     DataObject dataObject = new DataObject();
     dataObject.SetData(typeof(ToolboxItem), toolboxItem);
     return dataObject;
 }
 public void AddLinkedToolboxItem(ToolboxItem toolboxItem, IDesignerHost host)
 {
     throw new NotImplementedException();
 }
 public void RemoveToolboxItem(ToolboxItem toolboxItem, string category)
 {
     throw new NotImplementedException();
 }
Beispiel #14
0
        public void ForItem_ItemIsSelect(ToolboxItem item)
        {
            this.IsSelect = false;
            int count = this.items.Count;

            for (int i = 0; i < count; i++) {
                if (this.items[i] != item)
                    this.items[i].IsSelect = false;
            }

            Toolbox t = this.Parent as Toolbox;
            if (t != null) {
                t.ForItem_ItemIsSelect(this);
            }
        }
 // Methods
 public void UpdateFilter(ToolboxItem item)
 {
 }
 // Constructors
 public ToolboxItemContainer(ToolboxItem item)
 {
 }
Beispiel #17
0
        public void AddTab(string tabName, Type[] types)
        {            
            if (Tabs == null) Tabs = new ToolboxTabCollection();
           
            ToolboxTab toolboxTab = new ToolboxTab();
            toolboxTab.Name = tabName;

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            for (int i = 0; i < types.Length; i++)
            {
                ToolboxItem toolboxItem = new ToolboxItem();

                toolboxItem.Type = types[i];
                toolboxItem.Name = types[i].Name;
                toolboxItems.Add(toolboxItem);
            }
            toolboxItems.SortByName();

            toolboxTab.ToolboxItems = toolboxItems;
            
            Tabs.Add(toolboxTab);

            ToolboxUIManagerVS toolboxUIManagerVS = new ToolboxUIManagerVS(this);
            toolboxUIManagerVS.FillToolbox();

            AddEventHandlers();
            //PrintToolbox();
        }
 public void SetSelectedToolboxItem(ToolboxItem toolboxItem)
 {
     throw new NotImplementedException();
 }
 protected virtual bool GetToolSupported(ToolboxItem tool)
 {
     return(true);
 }
        private ToolboxItem CreateItemForActivityType(Type activityType)
        {
            ToolboxItem result = null;
            ToolboxItemAttribute toolboxAttribute = null;
            foreach (Attribute attribute in activityType.GetCustomAttributes(typeof(ToolboxItemAttribute), true))
            {
                if (attribute is ToolboxItemAttribute)
                {
                    toolboxAttribute = (ToolboxItemAttribute)attribute;
                    break;
                }
            }

            if (toolboxAttribute != null)
            {
                if (toolboxAttribute.ToolboxItemType != null)
                {
                    ConstructorInfo constructor = toolboxAttribute.ToolboxItemType.GetConstructor(new Type[] { typeof(Type) });
                    if (constructor != null)
                    {
                        result = constructor.Invoke(new Object[] { activityType }) as ToolboxItem;
                    }
                }
            }
            else
            {
                result = new ToolboxItem(activityType);
            }
            return result;
        }
 bool IToolboxUser.GetToolSupported(ToolboxItem tool) => true;
 // Methods
 public bool Contains(ToolboxItem value)
 {
 }
        protected void CreateTool(ToolboxItem tool)
        {
            Point location = (Point)GetValue(this, "DefaultControlLocation");

            CreateToolCore(tool, location.X, location.Y, 0, 0, true, false);
        }
 public void CopyTo(ToolboxItem[] array, int index)
 {
 }
        /// <summary>
        /// Adds or renames the grid control.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="data">The data.</param>
        /// <param name="oldFileName">Old name of the file.</param>
        /// <exception cref="System.ArgumentNullException">data</exception>
        protected virtual void AddOrRenameGridControl(ConfigElementList<ToolboxItem> parent, GridControlData data, string oldFileName = "")
        {
            if (data == null)
                throw new ArgumentNullException("data");

            string toolboxItemName;
            if (oldFileName.IsNullOrEmpty())
            {
                toolboxItemName = data.Name;
            }
            else
            {
                var oldFileNameWithoutExtension = this.GetFileNameWithoutExtension(oldFileName);
                toolboxItemName = oldFileNameWithoutExtension;
            }

            var control = parent.FirstOrDefault<ToolboxItem>(t => t.Name == toolboxItemName);

            if (control == null)
            {
                control = new ToolboxItem(parent);
                control.ControlType = typeof(GridControl).AssemblyQualifiedName;
                control.CssClass = data.CssClass;
                parent.Add(control);
            }

            control.Name = data.Name;
            control.Title = data.Title;
            control.LayoutTemplate = data.LayoutTemplatePath;
        }
 public int IndexOf(ToolboxItem value)
 {
 }
 public void RemoveToolboxItem(ToolboxItem toolboxItem)
 {
     this.toolboxItems.Remove(toolboxItem);
     FireToolboxItemRemoved(toolboxItem, null, null);
 }
 public ToolboxItemCollection(ToolboxItem[] value)
 {
 }
 public object SerializeToolboxItem(ToolboxItem toolboxItem)
 {
     System.Console.WriteLine("nnnn");
     throw new NotImplementedException();
 }
        public override ItemToolboxNode GetNode(Type t, ToolboxItemAttribute tba,
                                                string attributeCategory, string fullPath, ClrVersion referencedRuntime)
        {
            if (referencedRuntime != ClrVersion.Net_1_1 &&
                referencedRuntime != ClrVersion.Net_2_0)
            {
                return(null);
            }

            bool reflectedRuntime1;

            if (typeof(System.Web.UI.Control).IsAssignableFrom(t))
            {
                reflectedRuntime1 = false;
            }
            else if (CanRuntime1 && SWUControl1.IsAssignableFrom(t))
            {
                reflectedRuntime1 = true;
            }
            else
            {
                return(null);
            }

            Type toolboxItemType = (tba.ToolboxItemType == null) ? typeof(ToolboxItem) : tba.ToolboxItemType;

            //FIXME: fix WebControlToolboxItem so that this isn't necessary
            //right now it's totally broken in mono
            if (typeof(System.Web.UI.Design.WebControlToolboxItem).IsAssignableFrom(toolboxItemType))
            {
                toolboxItemType = typeof(ToolboxItem);
            }

            //Create the ToolboxItem. The ToolboxItemToolboxNode will destroy it, but need to
            //be able to extract data from it first.
            ToolboxItem         item = (ToolboxItem)Activator.CreateInstance(toolboxItemType, new object[] { t });
            WebFormsToolboxNode node = new WebFormsToolboxNode(item);

            //get the default markup for the tag
            string webText = reflectedRuntime1? GetWebText1(t) : GetWebText(t);

            if (!string.IsNullOrEmpty(webText))
            {
                node.Text = webText;
            }

            if (!string.IsNullOrEmpty(attributeCategory))
            {
                node.Category = attributeCategory;
            }
            else if (reflectedRuntime1)
            {
                node.Category = GuessCategory1(t);
            }
            else
            {
                node.Category = GuessCategory(t);
            }

            if (!string.IsNullOrEmpty(fullPath))
            {
                node.Type.AssemblyLocation = fullPath;
            }

            //prevent system.web 1.1 from being shown for 2.0 runtime
            if (CanRuntime1 && webAssem1.FullName == t.Assembly.FullName)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Prevent));
            }

            //set filters fom supported runtimes
            if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_1_1)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_1_1", ToolboxItemFilterType.Require));
            }
            else if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_2_0)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Require));
            }

            return(node);
        }
 public void AddLinkedToolboxItem(ToolboxItem toolboxItem, string category, IDesignerHost host)
 {
     AddItemToToolbox(toolboxItem, category, host);
 }
Beispiel #32
0
 public void CreateComponentFromTool(ToolboxItem tool)
 {
     throw null;
 }
        void AddComponentsToList(Assembly assembly, string loadPath)
        {
            if (assembly != null)
            {
                Hashtable images = new Hashtable();
                ImageList il     = new ImageList();
                // try to load res icon
                string[] imgNames = assembly.GetManifestResourceNames();

                foreach (string im in imgNames)
                {
                    try {
                        Bitmap b = new Bitmap(Image.FromStream(assembly.GetManifestResourceStream(im)));
                        b.MakeTransparent();
                        images[im] = il.Images.Count;
                        il.Images.Add(b);
                    } catch {}
                }
                try {
                    componentListView.SmallImageList = il;
                    foreach (Type t in assembly.GetExportedTypes())
                    {
                        if (!t.IsAbstract)
                        {
                            if (t.IsDefined(typeof(ToolboxItemFilterAttribute), true) || t.IsDefined(typeof(ToolboxItemAttribute), true) || typeof(System.ComponentModel.IComponent).IsAssignableFrom(t))
                            {
                                object[] attributes  = t.GetCustomAttributes(false);
                                object[] filterAttrs = t.GetCustomAttributes(typeof(DesignTimeVisibleAttribute), true);
                                foreach (DesignTimeVisibleAttribute visibleAttr in filterAttrs)
                                {
                                    if (!visibleAttr.Visible)
                                    {
                                        goto skip;
                                    }
                                }

                                if (images[t.FullName + ".bmp"] == null)
                                {
                                    if (t.IsDefined(typeof(ToolboxBitmapAttribute), false))
                                    {
                                        foreach (object attr in attributes)
                                        {
                                            if (attr is ToolboxBitmapAttribute)
                                            {
                                                ToolboxBitmapAttribute toolboxBitmapAttribute = (ToolboxBitmapAttribute)attr;
                                                images[t.FullName + ".bmp"] = il.Images.Count;
                                                Bitmap b = new Bitmap(toolboxBitmapAttribute.GetImage(t));
                                                b.MakeTransparent();
                                                il.Images.Add(b);
                                                break;
                                            }
                                        }
                                    }
                                }

                                ListViewItem newItem = new ListViewItem(t.Name);
                                newItem.SubItems.Add(t.Namespace);
                                newItem.SubItems.Add(assembly.ToString());
                                newItem.SubItems.Add(assembly.Location);
                                newItem.SubItems.Add(t.Namespace);
                                if (images[t.FullName + ".bmp"] != null)
                                {
                                    newItem.ImageIndex = (int)images[t.FullName + ".bmp"];
                                }
                                newItem.Checked = true;
                                ToolComponent toolComponent = new ToolComponent(t.FullName, new ComponentAssembly(assembly.FullName, loadPath), true);
                                newItem.Tag = toolComponent;
                                componentListView.Items.Add(newItem);
                                ToolboxItem item = new ToolboxItem(t);
                                skip :;
                            }
                        }
                    }
                } catch (Exception e) {
                    ClearComponentsList(e.Message);
                }
            }
        }
        public void Install(Telerik.Sitefinity.Abstractions.SiteInitializer initializer, Version upgradeFrom)
        {
            var config = initializer.Context.GetConfig<ToolboxesConfig>();
            var pageControls = config.Toolboxes["PageControls"];

            var section = pageControls.Sections
                .Where<ToolboxSection>(e => e.Name == "Login")
                .FirstOrDefault();

            // recaptcha control
            string controlName = typeof(RecaptchaStsLoginFormPanel).Name;

            if (!section.Tools.Any<ToolboxItem>(e => e.Name == controlName))
            {
                var recaptchaPanel = new ToolboxItem(section.Tools)
                {
                    Name = controlName,
                    Title = controlName,
                    Description = controlName,
                    ControlType = typeof(RecaptchaStsLoginFormPanel).AssemblyQualifiedName
                };
                section.Tools.Add(recaptchaPanel);
            }

            // default control
            string controlNameDefault = typeof(StsLoginFormPanel).Name;

            if (!section.Tools.Any<ToolboxItem>(e => e.Name == controlNameDefault))
            {
                var recaptchaPanelDefault = new ToolboxItem(section.Tools)
                {
                    Name = controlNameDefault,
                    Title = controlNameDefault,
                    Description = controlNameDefault,
                    ControlType = typeof(StsLoginFormPanel).AssemblyQualifiedName
                };
                section.Tools.Add(recaptchaPanelDefault);
            }

            var virtualPathConfig = initializer.Context.GetConfig<VirtualPathSettingsConfig>();
            if (!virtualPathConfig.VirtualPaths.Elements.Any(vp => vp.VirtualPath == "~/recaptchaLogin/*"))
            {
                var moduleVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)
                {
                    VirtualPath = "~/recaptchaLogin/*",
                    ResolverName = "EmbeddedResourceResolver",
                    ResourceLocation = "RecaptchaBackendLogin"
                };
                virtualPathConfig.VirtualPaths.Add(moduleVirtualPathConfig);
            }
        }
Beispiel #35
0
 protected virtual bool CanCreateComponentFromTool(ToolboxItem tool)
 {
     throw null;
 }
Beispiel #36
0
        /// <summary>
        /// Installs module's toolbox configuration.
        /// </summary>
        /// <param name="initializer">The initializer.</param>
        protected override void InstallConfiguration(SiteInitializer initializer)
        {
            // get section from toolbox
            var config = initializer.Context.GetConfig<ToolboxesConfig>();
            var pageControls = config.Toolboxes["PageControls"];
            var section = pageControls
                .Sections
                .Where<ToolboxSection>(e => e.Name == ToolboxesConfig.ContentToolboxSectionName)
                .FirstOrDefault();

            // create it if it doesn't exist
            if (section == null)
            {
                section = new ToolboxSection(pageControls.Sections)
                {
                    Name = ToolboxesConfig.ContentToolboxSectionName,
                    Title = "ContentToolboxSectionTitle",
                    Description = "ContentToolboxSectionDescription",
                    ResourceClassId = typeof(PageResources).Name
                };
                pageControls.Sections.Add(section);
            }

            // add Projects view if it doesn't exist
            if (!section.Tools.Any<ToolboxItem>(e => e.Name == "ProjectsView"))
            {
                var tool = new ToolboxItem(section.Tools)
                {
                    Name = "ProjectsView",
                    Title = "Projects View",
                    Description = "Public control from the Projects module",
                    ModuleName = ProjectsModule.ModuleName,
                    CssClass = "sfProjectsViewIcn",
                    ControlType = typeof(ProjectsView).AssemblyQualifiedName
                };
                section.Tools.Add(tool);
            }
        }
 // Indicates whether the specified tool is supported by the designer.
 // If it is not the tool is disabled in the toolbox.
 //
 // Used for subclasses, e.g the FormDocumentDesigner won't accept a Form?
 //
 bool IToolboxUser.GetToolSupported(ToolboxItem tool)
 {
     return(this.GetToolSupported(tool));
 }
Beispiel #38
0
        private static void RegisterToolboxItem(ToolboxSection section, string name, string title, string controllerType, string cssClass, ref bool needsSaveSection)
        {
            if (!section.Tools.Any<ToolboxItem>(t => t.Name == name))
            {
                var toolboxItem = new ToolboxItem(section.Tools)
                {
                    Name = name,
                    Title = title,
                    Description = string.Empty,
                    ControlType = typeof(MvcControllerProxy).FullName,
                    ControllerType = controllerType,
                    CssClass = cssClass,
                    Parameters = new NameValueCollection()
                    {
                        { "ControllerName", controllerType }
                    }
                };

                section.Tools.Add(toolboxItem);
                needsSaveSection = true;
            }
        }
 // Handles the behavior that occurs when a user double-clicks a toolbox item.
 //
 void IToolboxUser.ToolPicked(ToolboxItem tool)
 {
     this.ToolPicked(tool);
 }
 protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
 {
     return(null);
 }
Beispiel #41
0
 public void CreateComponentFromTool(ToolboxItem tool)
 {
     // TODO
 }
 public ToolboxItemViewModel(ToolboxItem model)
 {
     _model = model;
 }
 public bool GetToolSupported(ToolboxItem tool) => tool.TypeName != typeof(AeroWizard.WizardControl).FullName && Control?.SelectedPage != null;
 public void AddToolboxItem(ToolboxItem toolboxItem, string category)
 {
     AddItemToToolbox(toolboxItem, category, null);
 }
Beispiel #45
0
        //</Snippet2>

        //<Snippet3>
        public void LinkToolboxComponentsCreatingEvent(ToolboxItem item)
        {
            item.ComponentsCreating += new ToolboxComponentsCreatingEventHandler(this.OnComponentsCreating);
        }
 void AddItemToToolbox(ToolboxItem toolboxItem, string category, IDesignerHost host)
 {
     toolboxItems.Add(toolboxItem);
     System.Console.WriteLine("{0}", toolboxItems.Count);
     FireToolboxItemAdded(toolboxItem, category, host);
 }
 protected void CreateTool(ToolboxItem tool, Point location)
 {
     CreateToolCore(tool, location.X, location.Y, 0, 0, true, false);
 }
        public ToolboxItem DeserializeToolboxItem(object serializedObject, IDesignerHost host)
        {
            ToolboxItem item = (ToolboxItem)((System.Windows.Forms.IDataObject)serializedObject).GetData(typeof(ToolboxItem));

            return(item);
        }
 protected void CreateTool(ToolboxItem tool)
 {
     CreateToolCore(tool, DefaultControlLocation.X, DefaultControlLocation.Y, 0, 0, true, false);
 }
 public ToolboxItemCollection GetToolboxItems()
 {
     ToolboxItem[] items = new ToolboxItem[toolboxItems.Count];
     toolboxItems.CopyTo(items);
     return(new ToolboxItemCollection(items));
 }
 public ToolboxEventArgs(ToolboxItem item, string category, IDesignerHost host)
 {
     this.item     = item;
     this.category = category;
     this.host     = host;
 }
        private static void RegisterToolboxItem(Telerik.Sitefinity.DynamicModules.Builder.Model.DynamicModule dynamicModule, DynamicModuleType moduleType)
        {
            MvcWidgetInstaller.UnregisterToolboxItem(moduleType.GetFullTypeName());
            var configurationManager = ConfigManager.GetManager();
            var toolboxesConfig = configurationManager.GetSection<ToolboxesConfig>();

            var section = MvcWidgetInstaller.GetModuleToolboxSection(dynamicModule, toolboxesConfig);
            if (section == null)
                return;

            var toolboxItem = new ToolboxItem(section.Tools)
            {
                Name = moduleType.GetFullTypeName() + "_MVC",
                Title = PluralsResolver.Instance.ToPlural(moduleType.DisplayName),
                Description = string.Empty,
                ModuleName = dynamicModule.Name,
                ControlType = typeof(MvcWidgetProxy).AssemblyQualifiedName,
                ControllerType = typeof(DynamicContentController).FullName,
                CssClass = "sfNewsViewIcn sfMvcIcn",
                Parameters = new NameValueCollection()
                    {
                        { "WidgetName", moduleType.TypeName },
                        { "ControllerName", typeof(DynamicContentController).FullName }
                    }
            };

            section.Tools.Add(toolboxItem);

            configurationManager.SaveSection(toolboxesConfig);
        }