Beispiel #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Tag is string)
            {
                propertyGrid1.SelectedObject = null;
                return;
            }

            object o = treeView1.SelectedNode.Tag;

            if (treeView1.SelectedNode.Parent != null)
            {
                objectLinkEdit1.ActionContext = treeView1.SelectedNode.Parent.Text;
            }

            EditorGrammarAttribute attrib = o.GetType().GetCustomAttribute <EditorGrammarAttribute>();

            if (attrib != null)
            {
                objectLinkEdit1.Grammer = attrib.Grammar;
            }
            else
            {
                objectLinkEdit1.Grammer = "No Grammar Found";
            }

            objectLinkEdit1.Object = o;


            propertyGrid1.SelectedObject = o;
        }
Beispiel #2
0
        private void actionList_SelectedValueChanged(object sender, EventArgs e)
        {
            SelectedAction = DotaActionFactory.CreateNewAction(actionList.SelectedItem as string);
            EditorGrammarAttribute attrib = SelectedAction.GetType().GetCustomAttribute <EditorGrammarAttribute>();

            if (attrib != null)
            {
                actionGrammerEditor1.Grammer = attrib.Grammar;
            }
            actionGrammerEditor1.Object = SelectedAction;
        }
Beispiel #3
0
        private void BuildActionPanel()
        {
            if (Object == null)
            {
                Grammer             = "No Object Selected";
                linkLabel1.LinkArea = new LinkArea(0, 0);
                return; //Skip if object is null
            }


            linkLabel1.Links.Clear();
            if (Grammer == null)
            {
                EditorGrammarAttribute attrib = Object.GetType().GetCustomAttribute <EditorGrammarAttribute>();
                if (attrib != null)
                {
                    Grammer = attrib.Grammar;
                }
                else
                {
                    Grammer = "No Grammer Set";
                }
            }

            //Find each % and get the positions to create links
            int ind   = Grammer.IndexOf('%', 0);
            int count = 0;

            while (ind != -1)
            {
                int start = ind;
                int end   = Grammer.IndexOf(' ', start);
                int len   = end == -1 ? Grammer.Length - start : end - start;

                linkLabel1.Links.Add(start - count, len - 1, Grammer.Substring(start + 1, len - 1)); //Shif the region back one because we remove the % signs.

                ind = Grammer.IndexOf('%', start + len);

                count++;
            }


            linkLabel1.Text = Grammer.Replace("%", "");

            UpdateLinkTexts();
        }