private void CloseForm()
        {
            if (multipleItems)
            {
                ArrayList items = new ArrayList();
                FindSelectedNodes(treeView.Nodes, items);

                SelectedNameValueItems = new NameValueItem[items.Count];
                for (int i = 0; i < items.Count; i++)
                {
                    SelectedNameValueItems[i] = (NameValueItem)items[i];
                }
            }
            else
            {
                if (treeView.SelectedNode != null)
                {
                    if (treeView.SelectedNode.Tag != null)
                    {
                        SelectedNameValueItem    = (NameValueItem)treeView.SelectedNode.Tag;
                        selectedValue.Text       = SelectedNameValueItem.Value;
                        selectedName.Text        = SelectedNameValueItem.Name;
                        selectedDescription.Text = SelectedNameValueItem.Description;
                        selectedGroup.Text       = SelectedNameValueItem.Group;
                    }
                    else
                    {
                        selectedValue.Text       = "";
                        selectedName.Text        = "";
                        selectedDescription.Text = "";
                        selectedGroup.Text       = "";
                    }
                }
            }
        }
        public override NameValueItem[] GetNameValueItems(XmlNode node, XmlDocument resdoc, ProjectItem item)
        {
            try
            {
                List <NameValueItem> nvitems = new List <NameValueItem>();
                foreach (XmlNode lobInstance in GetChildsOfType(GetFirstChildOfType(node.ParentNode.ParentNode, "LobSystemInstances"), "LobSystemInstance"))
                {
                    //we have the Entity in our hand
                    string entityName        = node.Attributes["Name"].Value;
                    string entityValue       = node.Attributes["Name"].Value;
                    string entityGroup       = lobInstance.Attributes["Name"].Value; //LobSystemInstance
                    string entityDescription = node.Attributes["Namespace"].Value;   //LobSystemInstance

                    NameValueItem nvitem = new NameValueItem();
                    nvitem.ItemType    = "BCSEntity";
                    nvitem.Name        = entityName;
                    nvitem.Value       = entityValue;
                    nvitem.Group       = entityGroup;
                    nvitem.Description = entityDescription;

                    nvitems.Add(nvitem);
                }

                return(nvitems.ToArray());
            }
            catch
            {
            }
            return(new NameValueItem[0]);
        }
        public override NameValueItem[] GetNameValueItems(XmlNode node, XmlDocument resdoc, ProjectItem item)
        {
            try
            {
                List<NameValueItem> nvitems = new List<NameValueItem>();
                foreach (XmlNode lobInstance in GetChildsOfType(GetFirstChildOfType(node.ParentNode.ParentNode, "LobSystemInstances"), "LobSystemInstance"))
                {
                    //we have the Entity in our hand
                    string entityName = node.Attributes["Name"].Value;
                    string entityValue = node.Attributes["Name"].Value;
                    string entityGroup = lobInstance.Attributes["Name"].Value; //LobSystemInstance
                    string entityDescription = node.Attributes["Namespace"].Value; //LobSystemInstance

                    NameValueItem nvitem = new NameValueItem();
                    nvitem.ItemType = "BCSEntity";
                    nvitem.Name = entityName;
                    nvitem.Value = entityValue;
                    nvitem.Group = entityGroup;
                    nvitem.Description = entityDescription;

                    nvitems.Add(nvitem);
                }

                return nvitems.ToArray();
            }
            catch
            {

            }
            return new NameValueItem[0];
        }
 private void AddItem(string Name, string Value, string Description, List<NameValueItem> list)
 {
     NameValueItem item = new NameValueItem();
       item.ItemType = "CustomAction";
       item.Name = Name;
       item.Description = Description;
       item.Value = Value;
       list.Add(item);
 }
        public override Dictionary<string, object> GetInitialArguments()
        {
            Dictionary<string, object> arguments = new Dictionary<string, object>();

            List<NameValueItem> lists = new List<NameValueItem>();

            NameValueItem list1 = new NameValueItem();
            list1.Name = "Calendar";
            list1.Value = "Calendar";
            lists.Add(list1);

            NameValueItem ct1 = new NameValueItem();
            ct1.Name = "Event";
            ct1.Value = "Event";
            list1.Childs.Add(ct1);

            NameValueItem field1 = new NameValueItem();
            field1.Name = "Title";
            field1.Value = "Title";
            ct1.Childs.Add(field1);
            NameValueItem field2 = new NameValueItem();
            field2.Name = "Location";
            field2.Value = "Location";
            ct1.Childs.Add(field2);
            NameValueItem field3 = new NameValueItem();
            field3.Name = "Description";
            field3.Value = "Description";
            ct1.Childs.Add(field3);

            NameValueItem list2 = new NameValueItem();
            list2.Name = "Tasks";
            list2.Value = "Tasks";
            lists.Add(list2);

            NameValueItem ct1a = new NameValueItem();
            ct1a.Name = "Event";
            ct1a.Value = "Event";
            list2.Childs.Add(ct1a);

            NameValueItem field1a = new NameValueItem();
            field1a.Name = "Title";
            field1a.Value = "Title";
            ct1a.Childs.Add(field1a);
            NameValueItem field2a = new NameValueItem();
            field2a.Name = "Status";
            field2a.Value = "Status";
            ct1a.Childs.Add(field2a);
            NameValueItem field3a = new NameValueItem();
            field3a.Name = "Body";
            field3a.Value = "Body";
            ct1a.Childs.Add(field3a);

            arguments.Add("LINQIncludedLists", lists);

            return arguments;
        }
예제 #6
0
        public virtual NameValueItem[] GetNameValueItems(XmlNode node, XmlDocument resDocument, ProjectItem item)
        {
            NameValueItem nvitem = GetNameValueItem(node, resDocument, item);

            if (nvitem != null)
            {
                return(new NameValueItem[] { nvitem });
            }
            return(new NameValueItem[0]);
        }
예제 #7
0
        private void AddItem(string Name, string Value, string Description, List <NameValueItem> list)
        {
            NameValueItem item = new NameValueItem();

            item.ItemType    = "CustomAction";
            item.Name        = Name;
            item.Description = Description;
            item.Value       = Value;
            list.Add(item);
        }
        void dropDown_Leave(object sender, EventArgs e)
        {
            if (dropDown.SelectedItem is NameValueItem)
            {
                if (this.ExpectedType == "NameValueItem")
                {
                    UpdateValue(dropDown.SelectedItem as NameValueItem);
                }
                else
                {
                    UpdateValue((dropDown.SelectedItem as NameValueItem).Value);
                }
                return;
            }

            string currentTextValue = dropDown.Text;

            if (currentTextValue == "")
            {
                UpdateValue(null);
            }

            //text could be
            //convert the value to namevalueitem
            if (this.ExpectedType == "NameValueItem")
            {
                //is the current value in format "0x01 (Item)", then we extract the name and value part
                if (currentTextValue.Contains("("))
                {
                    try
                    {
                        string        value   = currentTextValue.Substring(0, currentTextValue.IndexOf("(") - 1);
                        string        name    = currentTextValue.Substring(currentTextValue.IndexOf("(") + 1, currentTextValue.LastIndexOf(")") - currentTextValue.IndexOf("(") - 1);
                        NameValueItem newitem = new NameValueItem("", name, value);
                        UpdateValue(newitem);
                        return;
                    }
                    catch (Exception)
                    {
                        NameValueItem newitem = new NameValueItem("", dropDown.Text, dropDown.Text);
                        UpdateValue(newitem);
                        return;
                    }
                }

                NameValueItem newTextitem = new NameValueItem("", dropDown.Text, dropDown.Text);
                UpdateValue(newTextitem);
                return;
            }
            else
            {
                UpdateValue(dropDown.Text);
                return;
            }
        }
        void textbox_Leave(object sender, EventArgs e)
        {
            string currentTextValue = textbox.Text;

            if (currentTextValue == "")
            {
                UpdateValue(null);
            }

            //text could be
            //convert the value to namevalueitem
            if (this.ExpectedType == "NameValueItem")
            {
                //is the current value in format "0x01 (Item)", then we extract the name and value part
                if (currentTextValue.Contains("("))
                {
                    try
                    {
                        string        value   = currentTextValue.Substring(0, currentTextValue.IndexOf("(") - 1);
                        string        name    = currentTextValue.Substring(currentTextValue.IndexOf("(") + 1, currentTextValue.LastIndexOf(")") - currentTextValue.IndexOf("(") - 1);
                        NameValueItem newitem = new NameValueItem("", name, value);

                        //has the user changed the existing value
                        if (this.Value is NameValueItem)
                        {
                            NameValueItem existingItem = this.Value as NameValueItem;
                            if (existingItem.Value == newitem.Value)
                            {
                                //value has not changed,
                                //do not update,
                                return;
                            }
                        }

                        UpdateValue(newitem);
                        return;
                    }
                    catch (Exception)
                    {
                        NameValueItem newitem = new NameValueItem("", textbox.Text, textbox.Text);
                        UpdateValue(newitem);
                        return;
                    }
                }

                NameValueItem newTextitem = new NameValueItem("", textbox.Text, textbox.Text);
                UpdateValue(newTextitem);
                return;
            }
            else
            {
                UpdateValue(textbox.Text);
                return;
            }
        }
        private void AddItem(XmlNode node,List<NameValueItem> list)
        {
            string name = node.Attributes["Name"].Value;
              string title = Helpers.GetResourceValue(node.Attributes["DisplayName"].Value);
              string description = Helpers.GetResourceValue(node.Attributes["Description"].Value);

              NameValueItem item = new NameValueItem();
              item.ItemType = "ListTemplate";
              item.Name = title;
              item.Description = description;
              item.Value = node.Attributes["Type"].Value;
              list.Add(item);
        }
예제 #11
0
        public override NameValueItem GetNameValueItem(XmlNode node, XmlDocument resdoc, ProjectItem item)
        {
            NameValueItem res = base.GetNameValueItem(node, resdoc, item);

            if (res != null)
            {
                //set the featureid of the listtemplate in field group (important for list instances
                //find the parent feature of item (in the item the listtemplate is defined
                string featureId = Helpers2.GetFeatureIdOfProjectItem(item);
                res.Group = featureId;
            }
            return(res);
        }
 private bool NodeExists(NameValueItem nvitem)
 {
     foreach (TreeNode node in treeView.Nodes)
     {
         if (node.Tag != null)
         {
             if ((((NameValueItem)node.Tag).Name == nvitem.Name) && (((NameValueItem)node.Tag).Value == nvitem.Value))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        private void AddItem(XmlNode node, List <NameValueItem> list)
        {
            string name        = node.Attributes["Name"].Value;
            string title       = Helpers.GetResourceValue(node.Attributes["DisplayName"].Value);
            string description = Helpers.GetResourceValue(node.Attributes["Description"].Value);

            NameValueItem item = new NameValueItem();

            item.ItemType    = "ListTemplate";
            item.Name        = title;
            item.Description = description;
            item.Value       = node.Attributes["Type"].Value;
            list.Add(item);
        }
        void listview_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            bool isValid = false;

            if (listview.CheckBoxes)
            {
                return;
            }
            else
            {
                if (listview.SelectedItems.Count > 0)
                {
                    if (this.ValueEditor.ValueType == typeof(NameValueItem[]))
                    {
                        NameValueItem[] items = new NameValueItem[listview.SelectedItems.Count];
                        for (int i = 0; i < listview.SelectedItems.Count; i++)
                        {
                            isValid  = true;
                            items[i] = listview.SelectedItems[i].Tag as NameValueItem;
                        }
                        this.InternalSetValue(items);
                        return;
                    }
                    else
                    {
                        object x = listview.SelectedItems[0].Tag;
                        if (x is NameValueItem)
                        {
                            NameValueItem nvi = x as NameValueItem;
                            if (this.ValueEditor.ValueType == typeof(NameValueItem))
                            {
                                this.InternalSetValue(nvi);
                                return;
                            }
                            else
                            {
                                this.InternalSetValue(nvi.Value);
                                return;
                            }
                        }
                        this.InternalSetValue(x.ToString());
                        return;
                    }
                }
            }
            if (!isValid)
            {
                this.InternalSetValue(null);
            }
        }
    public override NameValueItem GetNameValueItem(XmlNode node, XmlDocument resdoc, ProjectItem item)
    {
      try
      {
        string title = node.Attributes["Title"].Value;

        string ConfigID = node.Attributes["ID"].Value;
        string ConfigName = node.ParentNode.Attributes["Name"].Value;
        string value = ConfigName + "#" + ConfigID;

        NameValueItem nvitem = new NameValueItem();
        nvitem.ItemType = node.Name;
        nvitem.Name = title;
        nvitem.Value = value;
        return nvitem;
      }
      catch (Exception)
      {
      }
      return null;
    }
예제 #16
0
        public override NameValueItem GetNameValueItem(XmlNode node, XmlDocument resdoc, ProjectItem item)
        {
            try
            {
                string title = node.Attributes["Title"].Value;

                string ConfigID   = node.Attributes["ID"].Value;
                string ConfigName = node.ParentNode.Attributes["Name"].Value;
                string value      = ConfigName + "#" + ConfigID;

                NameValueItem nvitem = new NameValueItem();
                nvitem.ItemType = node.Name;
                nvitem.Name     = title;
                nvitem.Value    = value;
                return(nvitem);
            }
            catch (Exception)
            {
            }
            return(null);
        }
        private void LoadData()
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                if (this.ConverterInstance != null)
                {
                    if (!dataLoaded)
                    {
                        dropDown.Items.Clear();

                        //selected items??
                        dataLoaded = true;
                        RuntimeServiceProvider serviceProvider = new RuntimeServiceProvider(this);
                        foreach (object o in this.ConverterInstance.GetStandardValues(serviceProvider))
                        {
                            NameValueItem nvi = null;

                            if (o is NameValueItem)
                            {
                                nvi = o as NameValueItem;
                            }
                            else
                            {
                                nvi       = new NameValueItem();
                                nvi.Name  = o.ToString();
                                nvi.Value = o.ToString();
                            }
                            int pos = dropDown.Items.Add(nvi);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            this.Cursor = Cursors.Default;
        }
 private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (treeView.SelectedNode != null)
     {
         if (treeView.SelectedNode.Tag != null)
         {
             NameValueItem item = (NameValueItem)treeView.SelectedNode.Tag;
             selectedValue.Text       = item.Value;
             selectedName.Text        = item.Name;
             selectedDescription.Text = item.Description;
             selectedGroup.Text       = item.Group;
         }
         else
         {
             selectedValue.Text       = "";
             selectedName.Text        = "";
             selectedDescription.Text = "";
             selectedGroup.Text       = "";
         }
     }
     ValidateButtons();
 }
        void dropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            object x = dropDown.SelectedItem;

            if (x is NameValueItem)
            {
                NameValueItem nvi = x as NameValueItem;
                if (this.ValueEditor.ValueType == typeof(NameValueItem))
                {
                    this.InternalSetValue(nvi);
                    return;
                }
                else
                {
                    this.InternalSetValue(nvi.Value);
                    return;
                }
            }
            this.InternalSetValue(x.ToString());
            return;

            throw new NotImplementedException();
        }
        protected override void UpdateValue(object newValue)
        {
            /*
            List<string> selectedStrings = new List<string>();
            if (newValue != null)
            {
                if (newValue.GetType() == typeof(string))
                {
                    if (newValue != "")
                    {
                        string strValue = newValue.ToString();
                        if (strValue.Contains(";"))
                        {
                            char[] sep = new char[] { ';' };
                            foreach (string strSep in strValue.Split(sep))
                            {
                                if (strSep != "")
                                {
                                    selectedStrings.Add(strSep);
                                }
                            }
                        }
                        else
                        {
                            //nur 1 element drin
                            selectedStrings.Add(strValue);
                        }
                    }
                }
            }
             * */

            if (!dataLoaded)
            {
                //add dummy item with the value
                dropDown.Items.Clear();
                if (newValue != null)
                {
                    if (newValue.GetType() == typeof(string))
                    {
                        if (newValue.ToString() != "")
                        {
                            NameValueItem nvi = new NameValueItem();
                            nvi.Name = newValue.ToString();
                            nvi.Value = newValue.ToString();
                            dropDown.Items.Add(nvi);
                            dropDown.SelectedIndex = 0;
                        }
                    }
                    else if (newValue.GetType() == typeof(NameValueItem))
                    {
                        dropDown.Items.Add(newValue);
                        dropDown.SelectedIndex = 0;
                    }
                }
            }
            else
            {
            }
            base.SetValue(newValue);
        }
								public void RunTestCase_RibbonGroupForList()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"RibbonForContentType";
						arguments.Add("RibbonActionName", argObject);					
					
						argObject = @"ContentType Button";
						arguments.Add("RibbonActionTitle", argObject);					
					
						argObject = @"ContentType";
						arguments.Add("CustomActionRegistrationType", argObject);					
					
						argObject = @"0x0101";
						arguments.Add("CustomActionRegistrationId", argObject);					
					
						argObject = @"CommandUI.Ribbon";
						arguments.Add("CustomActionLocation", argObject);					
					
						argObject = new NameValueItem("Ribbon.DocLibListForm.Edit.Actions","Ribbon.DocLibListForm.Edit.Actions","Ribbon.DocLibListForm.Edit.Actions");
						arguments.Add("RibbonCommandUIDefinitionLocation", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
											AddExpectedDeployResult("In dialog 'Edit Properties' for content type 'document' is in tab 'Action' a new Ribbon Button 'ContentType Button' http://demo2010a/Shared%20Documents/Forms/AllItems.aspx");
										}
      private void CloseForm()
      {
            if (multipleItems)
            {
                ArrayList items = new ArrayList();
                FindSelectedNodes(treeView.Nodes, items);

                SelectedNameValueItems = new NameValueItem[items.Count];
                for (int i = 0; i < items.Count; i++)
                {
                    SelectedNameValueItems[i] = (NameValueItem)items[i];
                }
            }
            else
            {
                if (treeView.SelectedNode != null)
                {
                  if (treeView.SelectedNode.Tag != null)
                  {
                    SelectedNameValueItem = (NameValueItem)treeView.SelectedNode.Tag;
                    selectedValue.Text = SelectedNameValueItem.Value;
                    selectedName.Text = SelectedNameValueItem.Name;
                    selectedDescription.Text = SelectedNameValueItem.Description;
                    selectedGroup.Text = SelectedNameValueItem.Group;
                  }
                  else
                  {
                    selectedValue.Text = "";
                    selectedName.Text = "";
                    selectedDescription.Text = "";
                    selectedGroup.Text = "";
                  }
                }
            }
        }
        void dropDown_Leave(object sender, EventArgs e)
        {
            if (dropDown.SelectedItem is NameValueItem)
            {
                if (this.ExpectedType == "NameValueItem")
                {
                    UpdateValue(dropDown.SelectedItem as NameValueItem);
                }
                else
                {
                    UpdateValue((dropDown.SelectedItem as NameValueItem).Value);
                }
                return;
            }

            string currentTextValue = dropDown.Text;

            if (currentTextValue == "")
            {
                UpdateValue(null);
            }

            //text could be
            //convert the value to namevalueitem
            if (this.ExpectedType == "NameValueItem")
            {
                //is the current value in format "0x01 (Item)", then we extract the name and value part
                if (currentTextValue.Contains("("))
                {
                    try
                    {
                        string value = currentTextValue.Substring(0, currentTextValue.IndexOf("(") - 1);
                        string name = currentTextValue.Substring(currentTextValue.IndexOf("(") + 1, currentTextValue.LastIndexOf(")") - currentTextValue.IndexOf("(") - 1);
                        NameValueItem newitem = new NameValueItem("", name, value);
                        UpdateValue(newitem);
                        return;
                    }
                    catch (Exception)
                    {
                        NameValueItem newitem = new NameValueItem("", dropDown.Text, dropDown.Text);
                        UpdateValue(newitem);
                        return;
                    }
                }

                NameValueItem newTextitem = new NameValueItem("", dropDown.Text, dropDown.Text);
                UpdateValue(newTextitem);
                return;
            }
            else
            {
                UpdateValue(dropDown.Text);
                return;
            }
        }
							public void RunTestCase_ContentTypeBindingAnnouncements()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"Lists/Announcements";
						arguments.Add("ContentTypeBindingListUrl", argObject);					
					
						argObject = new NameValueItem("Doc","0x0101","0x0101");
						arguments.Add("ContentTypeBindingContentType", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
									}
        private void GenerateTree()
        {
            treeView.Nodes.Clear();

            //if in all items the groups are empty then grouping should be disabled
            CheckGrouped();

            if (selection is NameValueItem)
            {
                InitiallySelectedNameValueItem = (NameValueItem)selection;
            }
            else if (selection is NameValueItem[])
            {
                multipleItems = true;
                InitiallySelectedNameValueItems = (NameValueItem[])selection;
            }

            if (multipleItems)
            {
                treeView.CheckBoxes = true;
            }

            if (nvitems != null)
            {
                if (groupItems)
                {
                    //first grouping
                    foreach (NameValueItem nvitem in nvitems)
                    {
                        string key = nvitem.Group;
                        if ((key == null) || (key == ""))
                        {
                          key = "[nogroup]";
                        }
                        TreeNode groupnode = null;
                        if (!treeView.Nodes.ContainsKey(key))
                        {
                            //create new group
                            groupnode = new TreeNode();
                            groupnode.Text = key;
                            groupnode.Name = key;
                            //if(key.Equals(SPSFConstants.ThisSolutionNodeText, StringComparison.InvariantCultureIgnoreCase)){
                            //    groupnode.NodeFont = new Font(treeView.Font, FontStyle.Bold);
                            //}
                            treeView.Nodes.Add(groupnode);
                        }
                        else
                        {
                            groupnode = treeView.Nodes[key];
                        }
                        if (groupnode != null &&
                            !string.IsNullOrEmpty(nvitem.Name) &&
                            (!nvitem.Name.StartsWith("$Resources:",StringComparison.InvariantCultureIgnoreCase) ||
                             key.Equals(SPSFConstants.ThisSolutionNodeText, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            TreeNode tnode = new TreeNode();
                            tnode.Text = nvitem.Name;
                            tnode.Tag = nvitem;
                            tnode.ToolTipText = nvitem.Description;
                            groupnode.Nodes.Add(tnode);

                            if (InitiallySelectedNameValueItem != null)
                            {
                                if (nvitem.Value == InitiallySelectedNameValueItem.Value)
                                {
                                    groupnode.Expand();
                                }
                            }
                            if (InitiallySelectedNameValueItems != null)
                            {
                                foreach (NameValueItem nvi in InitiallySelectedNameValueItems)
                                {
                                    if (nvi.Value == nvitem.Value)
                                    {
                                        tnode.Checked = true;
                                        groupnode.Expand();
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (NameValueItem nvitem in nvitems)
                    {
                        //gibt es das item schon auf 1. ebene?
                      if (!NodeExists(nvitem) &&
                          !string.IsNullOrEmpty(nvitem.Name) )
                          /*&&
                          (!nvitem.Name.StartsWith("$Resources:",StringComparison.InvariantCultureIgnoreCase) ||
                             key.Equals(SPSFConstants.ThisSolutionNodeText, StringComparison.InvariantCultureIgnoreCase)))*/
                      {
                        TreeNode tnode = new TreeNode();
                        tnode.Text = nvitem.Name;
                        tnode.Tag = nvitem;
                        tnode.ToolTipText = nvitem.Description;
                        treeView.Nodes.Add(tnode);
                      }
                    }
                }
            }
            treeView.Sort();
            ValidateButtons();
        }
								public void RunTestCase_Hide()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"HideLibraryCreateView";
						arguments.Add("RibbonActionName", argObject);					
					
						argObject = new NameValueItem("Ribbon.Library.CustomViews.CreateView","Ribbon.Library.CustomViews.CreateView","Ribbon.Library.CustomViews.CreateView");
						arguments.Add("RibbonCommandUIDefinitionLocation", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
											AddExpectedDeployResult("In tab 'Library' button 'CreateView' is not visible in document library page http://demo2010a/Shared%20Documents/Forms/AllItems.aspx");
										}
								public void RunTestCase_RibbonControlWithButton()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"RibbonControlWithButton";
						arguments.Add("RibbonActionName", argObject);					
					
						argObject = @"Ribbon Button";
						arguments.Add("RibbonActionTitle", argObject);					
					
						argObject = @"Button";
						arguments.Add("RibbonControlType", argObject);					
					
						argObject = new NameValueItem("Ribbon.Library.Actions","Ribbon.Library.Actions","Ribbon.Library.Actions");
						arguments.Add("RibbonCommandUIDefinitionLocation", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
											AddExpectedDeployResult("Document library page contains custom ribbon button in group actions http://demo2010a/Shared%20Documents/Forms/AllItems.aspx");
										}
								public void RunTestCase_RibbonGroupForList()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"RibbonGroupForDocLib";
						arguments.Add("RibbonActionName", argObject);					
					
						argObject = @"Ribbon Group";
						arguments.Add("RibbonActionTitle", argObject);					
					
						argObject = @"List";
						arguments.Add("CustomActionRegistrationType", argObject);					
					
						argObject = @"101";
						arguments.Add("CustomActionRegistrationId", argObject);					
					
						argObject = new NameValueItem("Ribbon.Library","Ribbon.Library","Ribbon.Library");
						arguments.Add("RibbonCommandUIDefinitionLocation", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
											AddExpectedDeployResult("In tab 'Library' new Ribbon Group 'Ribbon Group' with 2 buttons is available in document library page http://demo2010a/Shared%20Documents/Forms/AllItems.aspx");
										}
 internal static void AddNameValueItem(string Name, string Value, string Description, List<NameValueItem> list)
 {
     NameValueItem item = new NameValueItem();
     item.ItemType = "Feature";
     item.Name = Name;
     item.Description = Description;
     item.Value = Value;
     list.Add(item);
 }
예제 #30
0
        public virtual NameValueItem GetNameValueItem(XmlNode node, XmlDocument resDocument, ProjectItem item)
        {
            try
            {
                string title       = "";
                string value       = "";
                string group       = "";
                string description = "";

                if (_name == "")
                {
                    //keine attribute angegeben, wir können nur den innerText nehmen
                    title = node.InnerText;
                    value = node.InnerText;
                }
                else
                {
                    title = GetNodeAttribute(node, _name);
                    value = GetNodeAttribute(node, _value);


                    if (fixedGroupName != "")
                    {
                        group = fixedGroupName;
                    }
                    else if (_group != "")
                    {
                        group = GetNodeAttribute(node, _group);
                    }


                    if (_description != "")
                    {
                        description = GetNodeAttribute(node, _description);
                    }
                }

                //wenn resourcen drin sind
                if (title.StartsWith("$Resources:"))
                {
                    title = GetResourceValue(title);
                }
                if (description.StartsWith("$Resources:"))
                {
                    description = GetResourceValue(description);
                }
                if (group.StartsWith("$Resources:"))
                {
                    group = GetResourceValue(group);
                }

                NameValueItem nvitem = new NameValueItem();
                nvitem.ItemType    = node.Name;
                nvitem.Name        = title;
                nvitem.Value       = value;
                nvitem.Group       = group;
                nvitem.Description = description;

                return(nvitem);
            }
            catch (Exception)
            {
            }
            return(null);
        }
        protected override void UpdateValue(object newValue)
        {
            /*
             * List<string> selectedStrings = new List<string>();
             * if (newValue != null)
             * {
             *  if (newValue.GetType() == typeof(string))
             *  {
             *      if (newValue != "")
             *      {
             *          string strValue = newValue.ToString();
             *          if (strValue.Contains(";"))
             *          {
             *              char[] sep = new char[] { ';' };
             *              foreach (string strSep in strValue.Split(sep))
             *              {
             *                  if (strSep != "")
             *                  {
             *                      selectedStrings.Add(strSep);
             *                  }
             *              }
             *          }
             *          else
             *          {
             *              //nur 1 element drin
             *              selectedStrings.Add(strValue);
             *          }
             *      }
             *  }
             * }
             * */

            if (!dataLoaded)
            {
                //add dummy item with the value
                dropDown.Items.Clear();
                if (newValue != null)
                {
                    if (newValue.GetType() == typeof(string))
                    {
                        if (newValue.ToString() != "")
                        {
                            NameValueItem nvi = new NameValueItem();
                            nvi.Name  = newValue.ToString();
                            nvi.Value = newValue.ToString();
                            dropDown.Items.Add(nvi);
                            dropDown.SelectedIndex = 0;
                        }
                    }
                    else if (newValue.GetType() == typeof(NameValueItem))
                    {
                        dropDown.Items.Add(newValue);
                        dropDown.SelectedIndex = 0;
                    }
                }
            }
            else
            {
            }
            base.SetValue(newValue);
        }
        private void LoadData()
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                if (this.ConverterInstance != null)
                {
                    if (!dataLoaded)
                    {
                        dropDown.Items.Clear();

                        //selected items??
                        dataLoaded = true;
                        RuntimeServiceProvider serviceProvider = new RuntimeServiceProvider(this);
                        foreach (object o in this.ConverterInstance.GetStandardValues(serviceProvider))
                        {
                            NameValueItem nvi = null;

                            if (o is NameValueItem)
                            {
                                nvi = o as NameValueItem;
                            }
                            else
                            {
                                nvi = new NameValueItem();
                                nvi.Name = o.ToString();
                                nvi.Value = o.ToString();

                            }
                            int pos = dropDown.Items.Add(nvi);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            this.Cursor = Cursors.Default;
        }
        protected override void UpdateValue(object newValue)
        {
            if (this.ConverterInstance != null)
            {
                if (!dataLoaded)
                {
                    //selected items??
                    List<string> selectedStrings = new List<string>();
                    if (newValue != null)
                    {
                        if (newValue.GetType() == typeof(string))
                        {
                            if (!string.IsNullOrEmpty(newValue.ToString()))
                            {
                                string strValue = newValue.ToString();
                                if (strValue.Contains(";"))
                                {
                                    char[] sep = new char[] { ';' };
                                    foreach (string strSep in strValue.Split(sep))
                                    {
                                        if (strSep != "")
                                        {
                                            selectedStrings.Add(strSep);
                                        }
                                    }
                                }
                                else
                                {
                                    //nur 1 element drin
                                    selectedStrings.Add(strValue);
                                }
                            }
                        }
                    }

                    dataLoaded = true;
                    RuntimeServiceProvider serviceProvider = new RuntimeServiceProvider(this);
                    foreach (object o in this.ConverterInstance.GetStandardValues(serviceProvider))
                    {
                        if (o is NameValueItem)
                        {
                            NameValueItem nvi = o as NameValueItem;
                            ListViewItem lvi = new ListViewItem(nvi.Name);
                            lvi.Tag = nvi;
                            lvi.ImageKey = nvi.ItemType;
                            listview.Items.Add(lvi);

                            ListViewItem.ListViewSubItem slvi = new ListViewItem.ListViewSubItem();
                            slvi.Text = nvi.Description;
                            lvi.SubItems.Add(slvi);

                            if (ConverterInstance != null)
                            {
                                if (!ConverterInstance.IsValid(serviceProvider, nvi))
                                {
                                    lvi.ForeColor = Color.Gray;
                                }

                                //select a default value, if only one selection is allowed
                                if ((selectedStrings.Count == 0) && !withCheckboxes)
                                {
                                    if (listview.SelectedItems.Count == 0)
                                    {
                                        //ITypeDescriptorContext context = serviceProvider.GetService(typeof(ITypeDescriptorContext)) as ITypeDescriptorContext;

                                        if (ConverterInstance.IsValid(serviceProvider, nvi))
                                        {
                                            lvi.Selected = true;
                                        }
                                    }
                                }
                            }

                            if (selectedStrings.Contains(nvi.ToString()))
                            {
                                if (withCheckboxes)
                                {
                                    lvi.Checked = true;
                                }
                                else
                                {
                                    lvi.Selected = true;
                                }
                            }
                        }
                        else
                        {
                            NameValueItem nvi = new NameValueItem();
                            nvi.Name = o.ToString();
                            nvi.Value = o.ToString();

                            ListViewItem lvi = new ListViewItem(o.ToString());
                            lvi.Tag = nvi;
                            lvi.ImageKey = o.ToString();
                            listview.Items.Add(lvi);

                            if (selectedStrings.Contains(nvi.ToString()))
                            {
                                if (withCheckboxes)
                                {
                                    lvi.Checked = true;
                                }
                                else
                                {
                                    lvi.Selected = true;
                                }
                            }
                        }
                    }

                    //if only one item is available, go to the next wizard page, if there is only 1 visible control on the wizard page
                    if (listview.Items.Count == 1)
                    {
                        int controlcount = 0;
                        foreach (Control control in this.WizardPage.Controls)
                        {
                            if (control.Visible)
                            {
                                if (control.GetType() == typeof(Panel))
                                {
                                    //ignore the button panel
                                }
                                else
                                {
                                    controlcount++;
                                }
                            }
                        }
                        if (controlcount == 1)
                        {
                            //I'm the only one control on the wizard page 
                            if (this.WizardPage.Wizard.NextPage != null)
                            {
                                this.WizardPage.Wizard.OnNext();

                                //this.WizardPage.Wizard.GotoPage(this.WizardPage.Wizard.NextPageFromPage(this.WizardPage));
                            }
                        }
                    }
                }
            }

            base.SetValue(newValue);
        }
        protected override void UpdateValue(object newValue)
        {
            if (this.ConverterInstance != null)
            {
                if (!dataLoaded)
                {
                    //selected items??
                    List <string> selectedStrings = new List <string>();
                    if (newValue != null)
                    {
                        if (newValue.GetType() == typeof(string))
                        {
                            if (!string.IsNullOrEmpty(newValue.ToString()))
                            {
                                string strValue = newValue.ToString();
                                if (strValue.Contains(";"))
                                {
                                    char[] sep = new char[] { ';' };
                                    foreach (string strSep in strValue.Split(sep))
                                    {
                                        if (strSep != "")
                                        {
                                            selectedStrings.Add(strSep);
                                        }
                                    }
                                }
                                else
                                {
                                    //nur 1 element drin
                                    selectedStrings.Add(strValue);
                                }
                            }
                        }
                    }

                    dataLoaded = true;
                    RuntimeServiceProvider serviceProvider = new RuntimeServiceProvider(this);
                    foreach (object o in this.ConverterInstance.GetStandardValues(serviceProvider))
                    {
                        if (o is NameValueItem)
                        {
                            NameValueItem nvi = o as NameValueItem;
                            ListViewItem  lvi = new ListViewItem(nvi.Name);
                            lvi.Tag      = nvi;
                            lvi.ImageKey = nvi.ItemType;
                            listview.Items.Add(lvi);

                            ListViewItem.ListViewSubItem slvi = new ListViewItem.ListViewSubItem();
                            slvi.Text = nvi.Description;
                            lvi.SubItems.Add(slvi);

                            if (ConverterInstance != null)
                            {
                                if (!ConverterInstance.IsValid(serviceProvider, nvi))
                                {
                                    lvi.ForeColor = Color.Gray;
                                }

                                //select a default value, if only one selection is allowed
                                if ((selectedStrings.Count == 0) && !withCheckboxes)
                                {
                                    if (listview.SelectedItems.Count == 0)
                                    {
                                        //ITypeDescriptorContext context = serviceProvider.GetService(typeof(ITypeDescriptorContext)) as ITypeDescriptorContext;

                                        if (ConverterInstance.IsValid(serviceProvider, nvi))
                                        {
                                            lvi.Selected = true;
                                        }
                                    }
                                }
                            }

                            if (selectedStrings.Contains(nvi.ToString()))
                            {
                                if (withCheckboxes)
                                {
                                    lvi.Checked = true;
                                }
                                else
                                {
                                    lvi.Selected = true;
                                }
                            }
                        }
                        else
                        {
                            NameValueItem nvi = new NameValueItem();
                            nvi.Name  = o.ToString();
                            nvi.Value = o.ToString();

                            ListViewItem lvi = new ListViewItem(o.ToString());
                            lvi.Tag      = nvi;
                            lvi.ImageKey = o.ToString();
                            listview.Items.Add(lvi);

                            if (selectedStrings.Contains(nvi.ToString()))
                            {
                                if (withCheckboxes)
                                {
                                    lvi.Checked = true;
                                }
                                else
                                {
                                    lvi.Selected = true;
                                }
                            }
                        }
                    }

                    //if only one item is available, go to the next wizard page, if there is only 1 visible control on the wizard page
                    if (listview.Items.Count == 1)
                    {
                        int controlcount = 0;
                        foreach (Control control in this.WizardPage.Controls)
                        {
                            if (control.Visible)
                            {
                                if (control.GetType() == typeof(Panel))
                                {
                                    //ignore the button panel
                                }
                                else
                                {
                                    controlcount++;
                                }
                            }
                        }
                        if (controlcount == 1)
                        {
                            //I'm the only one control on the wizard page
                            if (this.WizardPage.Wizard.NextPage != null)
                            {
                                this.WizardPage.Wizard.OnNext();

                                //this.WizardPage.Wizard.GotoPage(this.WizardPage.Wizard.NextPageFromPage(this.WizardPage));
                            }
                        }
                    }
                }
            }

            base.SetValue(newValue);
        }
 void listview_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     bool isValid = false;
     if (listview.CheckBoxes)
     {
         return;
     }
     else
     {
         if (listview.SelectedItems.Count > 0)
         {
             if (this.ValueEditor.ValueType == typeof(NameValueItem[]))
             {
                 NameValueItem[] items = new NameValueItem[listview.SelectedItems.Count];
                 for (int i = 0; i < listview.SelectedItems.Count; i++)
                 {
                     isValid = true;
                     items[i] = listview.SelectedItems[i].Tag as NameValueItem;
                 }
                 this.InternalSetValue(items);
                 return;
             }
             else
             {
                 object x = listview.SelectedItems[0].Tag;
                 if (x is NameValueItem)
                 {
                     NameValueItem nvi = x as NameValueItem;
                     if (this.ValueEditor.ValueType == typeof(NameValueItem))
                     {
                         this.InternalSetValue(nvi);
                         return;
                     }
                     else
                     {
                         this.InternalSetValue(nvi.Value);
                         return;
                     }
                 }
                 this.InternalSetValue(x.ToString());
                 return;
             }
         }
     }
     if (!isValid)
     {
         this.InternalSetValue(null);
     }
 }
 private bool NodeExists(NameValueItem nvitem)
 {
   foreach (TreeNode node in treeView.Nodes)
   {
     if (node.Tag != null)            
     {
       if ((((NameValueItem)node.Tag).Name == nvitem.Name) && (((NameValueItem)node.Tag).Value == nvitem.Value))
       {
         return true;
       }
     }
   }
   return false;
 }
        void textbox_Leave(object sender, EventArgs e)
        {
            string currentTextValue = textbox.Text;

            if (currentTextValue == "")
            {
                UpdateValue(null);
            }

            //text could be
            //convert the value to namevalueitem
            if (this.ExpectedType == "NameValueItem")
            {
                //is the current value in format "0x01 (Item)", then we extract the name and value part
                if (currentTextValue.Contains("("))
                {
                    try
                    {
                        string value = currentTextValue.Substring(0, currentTextValue.IndexOf("(") - 1);
                        string name = currentTextValue.Substring(currentTextValue.IndexOf("(") + 1, currentTextValue.LastIndexOf(")") - currentTextValue.IndexOf("(") - 1);
                        NameValueItem newitem = new NameValueItem("", name, value);

                        //has the user changed the existing value
                        if (this.Value is NameValueItem)
                        {
                            NameValueItem existingItem = this.Value as NameValueItem;
                            if (existingItem.Value == newitem.Value)
                            {
                                //value has not changed, 
                                //do not update,
                                return;
                            }
                        }

                        UpdateValue(newitem);
                        return;
                    }
                    catch (Exception)
                    {
                        NameValueItem newitem = new NameValueItem("", textbox.Text, textbox.Text);
                        UpdateValue(newitem);
                        return;
                    }
                }

                NameValueItem newTextitem = new NameValueItem("", textbox.Text, textbox.Text);
                UpdateValue(newTextitem);
                return;
            }
            else
            {
                UpdateValue(textbox.Text);
                return;
            }
        }
        public virtual NameValueItem GetNameValueItem(XmlNode node, XmlDocument resDocument, ProjectItem item)
        {
            try
              {
            string title = "";
            string value = "";
            string group = "";
            string description = "";

            if (_name == "")
            {
              //keine attribute angegeben, wir können nur den innerText nehmen
              title = node.InnerText;
              value = node.InnerText;
            }
            else
            {
            title = GetNodeAttribute(node,_name);
            value = GetNodeAttribute(node,_value);

            if (fixedGroupName != "")
            {
            group = fixedGroupName;
            }
            else if (_group != "")
            {
            group = GetNodeAttribute(node,_group);
            }

              if (_description != "")
              {
              description = GetNodeAttribute(node,_description);
              }
            }

            //wenn resourcen drin sind
            if (title.StartsWith("$Resources:"))
            {
              title = GetResourceValue(title);
            }
            if (description.StartsWith("$Resources:"))
            {
              description = GetResourceValue(description);
            }
            if (group.StartsWith("$Resources:"))
            {
              group = GetResourceValue(group);
            }

            NameValueItem nvitem = new NameValueItem();
            nvitem.ItemType = node.Name;
            nvitem.Name = title;
            nvitem.Value = value;
            nvitem.Group = group;
            nvitem.Description = description;

            return nvitem;
              }
              catch (Exception)
              {
              }
              return null;
        }
							public void RunTestCase_FeatureAssocation1()
				{
				    					Dictionary<string, object> arguments = new Dictionary<string, object>();
					object argObject = null;
					argObject = @"FeatureAssocation1";
						arguments.Add("FeatureStaplingName", argObject);					
					
						argObject = new NameValueItem("Asset Library","Asset Library","4BCCCD62-DCAF-46dc-A7D4-E38277EF33F4");
						arguments.Add("FeatureStaplingFeature", argObject);					
					
						List<NameValueItem> tempArray = new List<NameValueItem>();
							tempArray.Add(new NameValueItem("SPS#0","SPS#0","SPS#0"));
										tempArray.Add(new NameValueItem("SPS#1","SPS#1","SPS#1"));
																	argObject = tempArray.ToArray();
							
						arguments.Add("FeatureStaplingSiteTemplates", argObject);					
					
											RunRecipeWithSpecifiedParameters(arguments);

					//add expected results to parent test
									}