Esempio n. 1
0
 /// <summary>
 /// Create a new Binding
 /// </summary>
 /// <param name="nm">The name of this Binding</param>
 /// <param name="ttype">The type of target this Binding has</param>
 /// <param name="btype">To what this Binding binds</param>
 /// <param name="fset">The Filterset defining this Binding</param>
 /// <param name="target">To where this Binding binds</param>
 public Binding(string nm, TargetType ttype, BindingType btype, FilterSet fset, string target)
 {
     this.Name        = nm;
     this.Target      = target;
     this.TargetType  = ttype;
     this.BindingType = btype;
     this.filterSet   = fset;
     this.IsValid     = true;
 }
Esempio n. 2
0
 public void Dispose()
 {
     if (tool != null)
     {
         tool.Dispose();
     }
     this.tool = null;
     this.filterSet.Dispose();
     this.filterSet = null;
 }
Esempio n. 3
0
        /// <summary>
        /// Creates a new Binding
        /// </summary>
        /// <param name="xmlnode">The XmlNode this Binding is defined in</param>
        public Binding(XmlNode xmlnode)
        {
            string  btype = xmlnode.Attributes["type"].Value;
            string  nm    = xmlnode.SelectSingleNode("Name").InnerText;
            XmlNode tnode = xmlnode.SelectSingleNode("Target");
            string  ttype = tnode.Attributes["type"].Value;
            string  tval  = tnode.InnerText;

            this.Enabled = xmlnode.Attributes["enabled"].Value == "1";

            this.Name = nm;
            switch (btype.ToUpper())
            {
            case "GRAPHICS": this.BindingType = BindingType.GRAPHICS; break;

            case "PALETTE": this.BindingType = BindingType.PALETTE; break;

            default: MainWindow.ShowError("Invalid Binding: " + nm + " has an invalid value for BindingType: " + btype); return;
            }
            this.Target = tval;
            switch (ttype.ToUpper())
            {
            case "METHOD": this.TargetType = TargetType.METHOD; break;

            case "LUA": this.TargetType = TargetType.LUA; break;

            default: MainWindow.ShowError("Invalid Binding: " + nm + " has an invalid value for TargetType: " + ttype); return;
            }
            XmlNode fsetnode = xmlnode.SelectSingleNode("FilterSet");

            if (fsetnode == null)
            {
                MainWindow.ShowError("Invalid Binding: " + nm + " does not have a FilterSet.");
                return;
            }
            this.filterSet = new FilterSet(fsetnode);

            this.IsValid = true;
        }