public void Invoke_NullMemberName_ThrowsArgumentNullException() { var list = new SubDesignerActionList(); var item = new DesignerActionMethodItem(list, null, "displayName", "category", "description"); Assert.Throws <ArgumentNullException>("name", () => item.Invoke()); }
public void Invoke_MemberWithParameters_ThrowsTargetParameterCountException() { var list = new SubDesignerActionList(); var item = new DesignerActionMethodItem(list, nameof(SubDesignerActionList.MethodWithParameters), "displayName", "category", "description"); Assert.Throws <TargetParameterCountException>(() => item.Invoke()); }
public override DesignerActionItemCollection GetSortedActionItems() { this.AddPropertyItem(new DesignerActionPropertyItem("Border", "Border", "500", "Adds/Removes Border from Panel.")); this.AddPropertyItem(new DesignerActionPropertyItem("Collapsible", "Collapsible", "500", "Enable the Panel to be collapsible.")); this.AddPropertyItem(new DesignerActionPropertyItem("Collapsed", "Collapsed on Page Load", "500", "Set the Panel to be collapsed when the Page first loads.")); this.AddPropertyItem(new DesignerActionPropertyItem("Frame", "Frame", "500", "Render with custom rounded borders.")); this.AddPropertyItem(new DesignerActionPropertyItem("Title", "Title", "500", "Change the Title of the Panel")); this.AddPropertyItem(new DesignerActionPropertyItem("Width", "Width", "500", "Change the Width of the control")); this.AddPropertyItem(new DesignerActionPropertyItem("Height", "Height", "500", "Change the Height of the control")); this.AddPropertyItem(new DesignerActionPropertyItem("Icon", "Icon", "500", "Set an icon to use in the Title bar")); this.AddPropertyItem(new DesignerActionPropertyItem("BodyStyle", "BodyStyle", "500", "Custom CSS styles to be applied to the body element")); DesignerActionMethodItem add = new DesignerActionMethodItem(this, "AddPadding", "Add Body Padding", "500", "Add 6px of padding to the Body"); DesignerActionMethodItem remove = new DesignerActionMethodItem(this, "RemovePadding", "Remove Body Padding", "500", "Remove the 6px of padding from the Body"); if (!this.paddingAdded && !((PanelBase)this.Control).BodyStyle.Contains(this.padding)) { this.AddMethodItem(add); this.RemoveMethodItem(remove); } else { this.AddMethodItem(remove); this.RemoveMethodItem(add); } return(base.GetSortedActionItems()); }
public void Invoke_NoSuchMemberName_ThrowsInvalidOperationException(string memberName) { var list = new SubDesignerActionList(); var item = new DesignerActionMethodItem(list, memberName, "displayName", "category", "description"); Assert.Throws <InvalidOperationException>(() => item.Invoke()); }
public void DesignerActionMethodItem_RelatedComponent_getter_setter() { DesignerActionMethodItem underTest = CreateDesignerActionMethodItem("memberName", "displayName"); Button button = new Button(); underTest.RelatedComponent = button; Assert.Equal(button, underTest.RelatedComponent); }
public void DesignerActionMethodItem_Constructor3() { DesignerActionMethodItem underTest = CreateDesignerActionMethodItem("memberName", "displayName"); Assert.NotNull(underTest); Assert.Equal("memberName", underTest.MemberName); Assert.Equal("displayName", underTest.DisplayName); Assert.Null(underTest.Category); Assert.Null(underTest.Description); }
protected override void FillActionItemCollection(DesignerActionItemCollection actionItems) { DesignerActionItem actionItem = new DesignerActionMethodItem(this, "OnRetrieveFields", "Retrieve fields...", string.Empty, "Create field headers for all available items", true); actionItem.AllowAssociate = true; actionItems.Add(actionItem); AddHeadersPropertyItem(actionItems); }
public void RemoveMethodItem(DesignerActionMethodItem item) { foreach (DesignerActionMethodItem method in this.Methods) { if (item.MemberName == method.MemberName && item.Category == method.Category) { this.Methods.Remove(method); return; } } }
public void Constructor() { DesignerActionMethodItem item = new DesignerActionMethodItem(new DesignerActionList(new Component()), "myMember", "myDisplay"); Assert.AreEqual("myMember", item.MemberName, "#1"); Assert.AreEqual("myDisplay", item.DisplayName, "#2"); Assert.IsNull(item.Category, "#3"); Assert.IsNull(item.Description, "#4"); Assert.IsFalse(item.IncludeAsDesignerVerb, "#5"); }
public void AddMethodItem(DesignerActionMethodItem item) { foreach (DesignerActionMethodItem method in this.Methods) { if (item.MemberName == method.MemberName && item.Category == method.Category) { return; } } this.Methods.Add(item); }
public void DesignerActionMethodItem_Constructor(string memberName, string displayName, string category, string description, bool includeAsDesignerVerb) { DesignerActionMethodItem underTest = CreateDesignerActionMethodItem(memberName, displayName, category, description, includeAsDesignerVerb); Assert.NotNull(underTest); Assert.Equal(memberName, underTest.MemberName); Assert.Equal(displayName, underTest.DisplayName); Assert.Equal(category, underTest.Category); Assert.Equal(description, underTest.Description); Assert.Equal(includeAsDesignerVerb, underTest.IncludeAsDesignerVerb); }
/// <summary>已重载。</summary> /// <returns></returns> public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); //if (_parent.CanConfigure) { DesignerActionMethodItem item = new DesignerActionMethodItem(this, "SetPagerTemplate", "设置分页模版", null, "给目标GridView设置一个默认分页模版", true); item.AllowAssociate = true; items.Add(item); } return(items); }
public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); DesignerActionMethodItem addItem = new DesignerActionMethodItem(this, "OnAddTabPanel", "Add Tab Panel", true); DesignerActionMethodItem removeItem = new DesignerActionMethodItem(this, "OnRemoveTabPanel", "Remove Tab Panel", true); items.Add(addItem); items.Add(removeItem); return(items); }
public void Invoke_ValidMemberName_ReturnsExpected(string memberName) { var list = new SubDesignerActionList(); var item = new DesignerActionMethodItem(list, memberName, "displayName", "category", "description"); item.Invoke(); Assert.Equal(memberName, list.CalledMethod); // Call again to test caching behaviour. list.CalledMethod = null; item.Invoke(); Assert.Equal(memberName, list.CalledMethod); }
public void DesignerActionMethodItem_RelatedComponent_Set_GetReturnsExpected(IComponent value) { var item = new DesignerActionMethodItem(null, "memberName", "displayName", "category", "description") { RelatedComponent = value }; Assert.Same(value, item.RelatedComponent); // Set same. item.RelatedComponent = value; Assert.Same(value, item.RelatedComponent); }
public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); DesignerActionMethodItem addItem = new DesignerActionMethodItem(this, "OnAddTabPanel", "Add Tab Panel", true); DesignerActionMethodItem removeItem = new DesignerActionMethodItem(this, "OnRemoveTabPanel", "Remove Tab Panel", true); DesignerActionPropertyItem hideContentOverflowItem = new DesignerActionPropertyItem("HideOverflowContent", "Hide overflow content at design-time"); items.Add(addItem); items.Add(removeItem); items.Add(hideContentOverflowItem); return(items); }
DesignerActionItem IActionGetItem.GetItem(DesignerActionList actions, System.Reflection.MemberInfo mbr) { var ret = new DesignerActionMethodItem(actions, mbr.Name, DisplayName, Category, Description, IncludeAsDesignerVerb) { AllowAssociate = AllowAssociate }; if (!string.IsNullOrEmpty(Condition)) { ret.Properties.Add("Condition", Condition); } ret.Properties.Add("Order", DisplayOrder); return(ret); }
public void DesignerActionMethodItem_Ctor_DesignerActionList_String_String_String_Bool(DesignerActionList actionList, string memberName, string displayName, string category, bool includeAsDesignerVerb, string expectedDisplayName) { var item = new DesignerActionMethodItem(actionList, memberName, displayName, category, includeAsDesignerVerb); Assert.Equal(memberName, item.MemberName); Assert.Equal(expectedDisplayName, item.DisplayName); Assert.Equal(category, item.Category); Assert.Null(item.Description); Assert.Equal(includeAsDesignerVerb, item.IncludeAsDesignerVerb); Assert.False(item.AllowAssociate); Assert.Empty(item.Properties); Assert.Same(item.Properties, item.Properties); Assert.IsType <HybridDictionary>(item.Properties); Assert.True(item.ShowInSourceView); Assert.Null(item.RelatedComponent); }
public override DesignerActionItemCollection GetSortedActionItems() { this.AddHeaderItem(new DesignerActionHeaderItem("Actions", "600")); DesignerActionMethodItem add = new DesignerActionMethodItem(this, "AddPanel", "Add Panel", "600"); DesignerActionMethodItem remove = new DesignerActionMethodItem(this, "RemovePanel", "Remove panel", "600", "Remove active panel"); Accordion layout = (Accordion)this.Control; this.AddMethodItem(add); if (layout.ExpandedPanelIndex > -1) { this.AddMethodItem(remove); } else { this.RemoveMethodItem(remove); } return(base.GetSortedActionItems()); }
public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection items = new DesignerActionItemCollection(); if (this._parent.CanConfigure) { DesignerActionMethodItem item = new DesignerActionMethodItem(this, "Configure", System.Design.SR.GetString("DataSourceDesigner_ConfigureDataSourceVerb"), System.Design.SR.GetString("DataSourceDesigner_DataActionGroup"), System.Design.SR.GetString("DataSourceDesigner_ConfigureDataSourceVerbDesc"), true) { AllowAssociate = true }; items.Add(item); } if (this._parent.CanRefreshSchema) { DesignerActionMethodItem item2 = new DesignerActionMethodItem(this, "RefreshSchema", System.Design.SR.GetString("DataSourceDesigner_RefreshSchemaVerb"), System.Design.SR.GetString("DataSourceDesigner_DataActionGroup"), System.Design.SR.GetString("DataSourceDesigner_RefreshSchemaVerbDesc"), false) { AllowAssociate = true }; items.Add(item2); } return(items); }
public override DesignerActionItemCollection GetSortedActionItems() { DesignerActionItemCollection actions = new DesignerActionItemCollection(); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this._designer.Component); PropertyDescriptor actionableProperty; actionableProperty = properties["LeftItems"]; if (actionableProperty != null && actionableProperty.IsBrowsable) { DesignerActionMethodItem editLeftItemsAction = new DesignerActionMethodItem(this, "EditLeftItems", Resources.DualList_EditLeftItems, "LeftData", Resources.DualList_EditLeftItemsEffectDescription); actions.Add(editLeftItemsAction); } actionableProperty = properties["RightItems"]; if (actionableProperty != null && actionableProperty.IsBrowsable) { actions.Add(new DesignerActionMethodItem(this, "EditRightItems", Resources.DualList_EditRightItems, "RightData", Resources.DualList_EditRightItemsEffectDescription)); } DesignerActionHeaderItem behaviorHeader = new DesignerActionHeaderItem("Behavior", "Behavior"); actions.Add(behaviorHeader); actionableProperty = properties["EnableMoveAll"]; if ((actionableProperty != null) && actionableProperty.IsBrowsable) { actions.Add(new DesignerActionPropertyItem("EnableMoveAll", Resources.DualList_ToggleEnableMoveAll, "Behavior", Resources.DualList_ToggleEnableMoveAllDescription)); } actionableProperty = properties["EnableMoveUpDown"]; if ((actionableProperty != null) && actionableProperty.IsBrowsable) { actions.Add(new DesignerActionPropertyItem("EnableMoveUpDown", Resources.DualList_ToggleEnableMoveUpDown, "Behavior", Resources.DualList_ToggleEnableMoveUpDownDescription)); } return(actions); }
public override DesignerActionItemCollection GetSortedActionItems() { this.AddHeaderItem(new DesignerActionHeaderItem("Actions", "600")); DesignerActionMethodItem addPanel = new DesignerActionMethodItem(this, "AddPanel", "Add Panel", "600"); DesignerActionMethodItem addTabPanel = new DesignerActionMethodItem(this, "AddTabPanel", "Add TabPanel", "600"); //DesignerActionMethodItem clear = new DesignerActionMethodItem(this, "Clear", "Clear layout", "600", "Remove control from layout"); if (((FitLayout)this.Control).Items.Count > 0) { //this.AddMethodItem(clear); this.RemoveMethodItem(addPanel); this.RemoveMethodItem(addTabPanel); } else { this.AddMethodItem(addPanel); this.AddMethodItem(addTabPanel); //this.RemoveMethodItem(clear); } return(base.GetSortedActionItems()); }
public override DesignerActionItemCollection GetSortedActionItems() { this.AddHeaderItem(new DesignerActionHeaderItem("Positioning", "600")); this.AddHeaderItem(new DesignerActionHeaderItem("Actions", "700")); this.AddPropertyItem(new DesignerActionPropertyItem("Title", "Title", "500", "Change the Title of the Window")); this.AddPropertyItem(new DesignerActionPropertyItem("Width", "Width", "500", "Change the Width of the control")); this.AddPropertyItem(new DesignerActionPropertyItem("Height", "Height", "500", "Change the Height of the control")); this.AddPropertyItem(new DesignerActionPropertyItem("Icon", "Icon", "500", "Set an icon to use in the Title bar")); this.AddPropertyItem(new DesignerActionPropertyItem("BodyStyle", "BodyStyle", "500", "Custom CSS styles to be applied to the body element")); DesignerActionMethodItem add = new DesignerActionMethodItem(this, "AddPadding", "Add Body Padding", "500", "Add 6px of padding to the Body"); DesignerActionMethodItem remove = new DesignerActionMethodItem(this, "RemovePadding", "Remove Body Padding", "500", "Remove the 6px of padding from the Body"); if (!this.paddingAdded && !((PanelBase)this.Control).BodyStyle.Contains(this.padding)) { this.AddMethodItem(add); this.RemoveMethodItem(remove); } else { this.AddMethodItem(remove); this.RemoveMethodItem(add); } this.AddPropertyItem(new DesignerActionPropertyItem("ShowOnLoad", "Show on Page Load", "600", "Automatically show the window on Page Load")); this.AddPropertyItem(new DesignerActionPropertyItem("CenterOnLoad", "Center on Page Load", "600", "Centers this window in the viewport on Page Load")); DesignerActionPropertyItem pageX = new DesignerActionPropertyItem("PageX", "PageX", "600", "The position in pixels from the left of the view port (browser window)"); DesignerActionPropertyItem pageY = new DesignerActionPropertyItem("PageY", "PageY", "600", "The position in pixels from the addToStart of the view port (browser window)"); if (this.CenterOnLoad) { this.RemovePropertyItem(pageX); this.RemovePropertyItem(pageY); } else { this.AddPropertyItem(pageX); this.AddPropertyItem(pageY); } this.AddPropertyItem(new DesignerActionPropertyItem("Collapsible", "Collapsible", "700", "Allow the user to collapse the window")); this.AddPropertyItem(new DesignerActionPropertyItem("Closable", "Closable", "700", "Allow the user to close the window")); DesignerActionPropertyItem closeAction = new DesignerActionPropertyItem("CloseAction", "Close Action", "700", "'Close' to destroy the Window, 'Hide' to simply hide the window"); DesignerActionPropertyItem maximizable = new DesignerActionPropertyItem("Maximizable", "Maximizable", "700", "Allow the user to maximize the window"); DesignerActionPropertyItem modal = new DesignerActionPropertyItem("Modal", "Modal", "700", "Make the window modal and mask everything behind it when displayed"); this.RemovePropertyItem(closeAction); this.RemovePropertyItem(maximizable); this.RemovePropertyItem(modal); if (this.Closable) { this.AddPropertyItem(closeAction); this.AddPropertyItem(maximizable); this.AddPropertyItem(modal); } else { this.RemovePropertyItem(closeAction); this.AddPropertyItem(maximizable); this.AddPropertyItem(modal); } return(base.GetSortedActionItems()); }
public void Invoke_NullActionList_ThrowsInvalidOperationException() { var item = new DesignerActionMethodItem(null, "memberName", "displayName", "category", "description"); Assert.Throws <InvalidOperationException>(() => item.Invoke()); }
public void DesignerActionList_GetSortedActionItems_CustomClass_ReturnsExpected() { var list = new SubDesignerActionList(); DesignerActionItemCollection items = list.GetSortedActionItems(); Assert.Equal(8, items.Count); DesignerActionMethodItem item1 = Assert.IsType <DesignerActionMethodItem>(items[0]); Assert.Equal("AnnotatedMethod", item1.MemberName); Assert.Equal("DisplayName", item1.DisplayName); Assert.Equal("Description", item1.Description); Assert.Equal("Category", item1.Category); DesignerActionPropertyItem item2 = Assert.IsType <DesignerActionPropertyItem>(items[1]); Assert.Equal("AnnotatedProperty", item2.MemberName); Assert.Equal("DisplayName", item2.DisplayName); Assert.Equal("Description", item2.Description); Assert.Equal("Category", item2.Category); DesignerActionMethodItem item3 = Assert.IsType <DesignerActionMethodItem>(items[2]); Assert.Equal("EmptyAnnotatedMethod", item3.MemberName); Assert.Equal("EmptyAnnotatedMethod", item3.DisplayName); Assert.Empty(item3.Description); Assert.Empty(item3.Category); DesignerActionPropertyItem item4 = Assert.IsType <DesignerActionPropertyItem>(items[3]); Assert.Equal("EmptyAnnotatedProperty", item4.MemberName); Assert.Equal("EmptyAnnotatedProperty", item4.DisplayName); Assert.Empty(item4.Description); Assert.Empty(item4.Category); DesignerActionMethodItem item5 = Assert.IsType <DesignerActionMethodItem>(items[4]); Assert.Equal("NullAnnotatedMethod", item5.MemberName); Assert.Equal("NullAnnotatedMethod", item5.DisplayName); Assert.Null(item5.Description); Assert.Null(item5.Category); DesignerActionPropertyItem item6 = Assert.IsType <DesignerActionPropertyItem>(items[5]); Assert.Equal("NullAnnotatedProperty", item6.MemberName); Assert.Equal("NullAnnotatedProperty", item6.DisplayName); Assert.Null(item6.Description); Assert.Null(item6.Category); DesignerActionMethodItem item7 = Assert.IsType <DesignerActionMethodItem>(items[6]); Assert.Equal("PublicMethod", item7.MemberName); Assert.Equal("PublicMethod", item7.DisplayName); Assert.Empty(item7.Description); Assert.Empty(item7.Category); DesignerActionPropertyItem item8 = Assert.IsType <DesignerActionPropertyItem>(items[7]); Assert.Equal("PublicProperty", item8.MemberName); Assert.Equal("PublicProperty", item8.DisplayName); Assert.Empty(item8.Description); Assert.Empty(item8.Category); }