コード例 #1
0
 /// <summary>
 /// Creates an HTMLObject from a master object
 /// </summary>
 /// <param name="mo">Master object</param>
 public HTMLObject(MasterObject mo) : base("MasterObject")
 {
     this.Add(new Func <IDictionary <string, dynamic> >(() => {
         return(new Dictionary <string, dynamic>()
         {
             { "MasterObject", mo.Clone() }
         });
     }));
 }
コード例 #2
0
        /// <summary>
        /// Make output
        /// </summary>
        /// <param name="f1">function for master object</param>
        /// <param name="f2">function for tool</param>
        /// <returns>output</returns>
        public StringBuilder Output(Func <MasterObject, string> f1, Func <Tool, string> f2)
        {
            StringBuilder output = new StringBuilder();

            if (this.Exists("MasterObject"))
            {
                MasterObject obj = this.Get("MasterObject") as MasterObject;
                output.Append(f1(obj));
            }
            else if (this.Exists("Tool"))
            {
                Tool obj = this.Get("Tool") as Tool;
                output.Append(f2(obj));
            }
            return(output);
        }