0

単純なPOCOオブジェクトを含むドメインサービスクラスと、2つの変数aとbを含むクラス、およびそれらを合計するメソッドがあります。

public class DomainService1 : DomainService
    {
        abc obj = new abc(10, 20);
        public int sum1()
        {
            return (obj.a + obj.b); 

        }

    }
    public class abc {
        public int a { get; set; }
        public int b { get; set; }


        public abc(int c, int d)
        {
            a = c;
            d = b;

        }

        }
}

学びたいのですが、SilverlightのmainPageでこのwcf riaサービスに電話をかけるにはどうすればよいですか?

4

1 に答える 1

1

次の方法で、Silverlight 側でサービスを呼び出すことができます。

DomainService1 domainService = new DomainService1();
domainService.sum1((op) => 
{
    //op.Value has the result
}, null);

また

DomainService1 domainService = new DomainService1();
domainService.sum1(Sum1Completed, null);

(...)

void Sum1Completed(InvokeOperation<int> op)
{
    //op.Value has the result
}
于 2012-06-06T18:08:17.760 に答える