예제 #1
0
        public void SetComposeDelegate(ComposeDelegate del, ReleaseDelegate destroy = null)
        {
            VerifyParameters(del);

            var ctx = DelegateProxies.CreateMultiUserData(del, destroy, this);

            HarfBuzzApi.hb_unicode_funcs_set_compose_func(
                Handle, DelegateProxies.ComposeProxy, ctx, DelegateProxies.ReleaseDelegateProxyForMulti);
        }
예제 #2
0
 public Line(int address, int datLocation, int boxHeight, int boxWidth, byte[] header, byte[] body, byte[] footer, Func <byte[], string> parseBody, ComposeDelegate compose)
 {
     Address                    = address;
     Body                       = body;
     ComposeDelegate            = compose;
     BoxHeight                  = boxHeight;
     BoxWidth                   = boxWidth;
     DialogAddressTableLocation = datLocation;
     Footer                     = footer;
     Header                     = header;
     Text                       = parseBody(body);
     Translation                = new Translation(address);
 }
예제 #3
0
        static void Main(string[] args)
        {

            /*********Simple Delegate*********/

            BookDB bookDB = new BookDB();
            bookDB.AddBook(new Book("Title 1", "Author1", true, 0.1));
            bookDB.AddBook(new Book("Title 2", "Author2", false, 0.2));
            bookDB.AddBook(new Book("Title 3", "Author3", true, 0.1));
            bookDB.AddBook(new Book("Title 4", "Author4", false, 0.2));
            bookDB.AddBook(new Book("Title 5", "Author5", true, 0.1));

            PriceCalculator calculator = new PriceCalculator();

            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(calculator.PrintPrice));
            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));

            calculator.PrintPriceTotal();
            Console.ReadLine();




            /*********Compose Delegate*********/
            
            ComposeDelegate a, b, c, d;

            // Create the delegate object a that references 
            // the method Hello:
            a = new ComposeDelegate(Hello);
            // Create the delegate object b that references 
            // the method Goodbye:
            b = new ComposeDelegate(Goodbye);
            // The two delegates, a and b, are composed to form c: 
            c = a + b;
            // Remove a from the composed delegate, leaving d, 
            // which calls only the method Goodbye:
            d = c - a;

            Console.WriteLine("Invoking delegate a:");
            a("A");
            Console.WriteLine("Invoking delegate b:");
            b("B");
            Console.WriteLine("Invoking delegate c:");
            c("C");
            Console.WriteLine("Invoking delegate d:");
            d("D");

            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            /*********Simple Delegate*********/

            BookDB bookDB = new BookDB();

            bookDB.AddBook(new Book("Title 1", "Author1", true, 0.1));
            bookDB.AddBook(new Book("Title 2", "Author2", false, 0.2));
            bookDB.AddBook(new Book("Title 3", "Author3", true, 0.1));
            bookDB.AddBook(new Book("Title 4", "Author4", false, 0.2));
            bookDB.AddBook(new Book("Title 5", "Author5", true, 0.1));

            PriceCalculator calculator = new PriceCalculator();

            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(calculator.PrintPrice));
            bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));

            calculator.PrintPriceTotal();
            Console.ReadLine();



            /*********Compose Delegate*********/

            ComposeDelegate a, b, c, d;

            // Create the delegate object a that references
            // the method Hello:
            a = new ComposeDelegate(Hello);
            // Create the delegate object b that references
            // the method Goodbye:
            b = new ComposeDelegate(Goodbye);
            // The two delegates, a and b, are composed to form c:
            c = a + b;
            // Remove a from the composed delegate, leaving d,
            // which calls only the method Goodbye:
            d = c - a;

            Console.WriteLine("Invoking delegate a:");
            a("A");
            Console.WriteLine("Invoking delegate b:");
            b("B");
            Console.WriteLine("Invoking delegate c:");
            c("C");
            Console.WriteLine("Invoking delegate d:");
            d("D");

            Console.ReadLine();
        }