문제

배경: 3-4 주에서 경험을 Silverlight3/C#/.물에 대한 3days 가치가 있으로 RIA 서비스는 개념입니다.(의 대부분은 나의 이전 질문 날짜 이유를 설명해야한)

동이 시험의 구현 Microsoft RIA 서비스 Silverlight3.이것은 부분의 증명의 개념을 내가 할 일을 위해 클라이언트입니다.그래서 그것의 아주 기본입니다.내가 있는 방법을 알아 냈을 구축 Silverlight3 를 사용하여 프로젝트 리아의 서비스 등등.그래서 전달하고 돌아온 문자열과 int 의 문제 없습니다.

하지만 내가 필요로 돌아 ArrayList 내 도메인에 대해 서비스 등을 내 SL3 클라이언트입니다.하지만 그것은 보인다 다시 전달 ArrayList 과 같은 허용되지 않습니다.고 내의 제한된 지식 C#하지 않습에 도움을 하는 빠른 유형 주물/convertions/등이 있습니다.이 서버쪽 기능을 가져오는 배열하는 반환해야 합 SL3 클라이언트,그래서 나는 뭔가를 보내는 클라이언트 측.

질문: 사람이 무엇을 알 수행하여야 합 ArrayList(c#)을 수 DomainService 등을 반환하는 함수를 호출하면 클라이언트/SL3 기능입니까?

[참고: 대부분의 내 모든 시도 끝에 오류가:"서비스 가동'라는 이름 myFunctionName'준수하지 않 필요한 서명이 있습니다.모두 돌아와 매개변수 유형이어야 합 엔터티를 입력 또는 하나의 미리 정의된 직렬화 형식입니다."]

을 주시기 바랍 요청을 모든 정보는 당신이 느끼는 것이 적절할 수 있습니다.사전에 감사합니다.

도움이 되었습니까?

해결책

죄송하지 않는 게시하는 방법을 지속적으로 연구하는 발견했다.보스 던졌다 더 많은 작업에서 나올 수 있다.:) 하시기 바랍 나의 솔루션이 되지 않을 수도 있습니다 좋지만 이후 내 지식에 SL 및 RIA 서비스는 그래서 새로 나는 그것이 수 있는 것은 허용된다.처음에는 다시 전달하는 오히려 복잡한 배열에서 제공되는 코드를 우리의 클라이언트,하지만 시간 및 노력 감금을 얻을 바로 변환하고 목록을 반환합니다.에 도움이 되기를 바랍니다 일부는 방법입니다.

클라이언트 측면:Silverlight 코드 MainPage.xaml.cs 나는 전화 목록을 검색하의 데이터 서버에서 측면에 표시하려면 드롭다운 목록입니다.

// Function called on load of the SL interface
// 'slayer' is an object of the Domain Service Class server-side
// 'this.gidSessionNumber' is just a number used in the demo to represent a session
public void loadPaymentTypeComboBox()
{
    InvokeOperation<IEnumerable<string>> comboList = sLayer.getPaymentTypeCombo(this.gidSessionNumber);
    comboList.Completed += new EventHandler(popPaymentCombo_complete);
}//function loadAllComboBoxes

// Event handler assigned
public void popPaymentCombo_complete(object sender, EventArgs e)
{
    InvokeOperation<IEnumerable<string>> obj = (InvokeOperation<IEnumerable<string>>)sender;
    string[] list = obj.Value.ToArray();

    // 'paymentTypeDropdown' is the name of the specific comboBox in the xaml file
    paymentTypeDropdown.IsEnabled = true;

    // Assign the returned arrayList as itemSource to the comboBox
    paymentTypeDropdown.ItemsSource = list;
}

도메인에서 서비스 클래스가 관련된 기능:

    [ServiceOperation]
    public List<string> getPaymentTypeCombo(string gidNumber)
    {
        // Build objects from libraries provided by our client
        SDT.Life.LifeCO.clsSystemCreator.CreateSysObjects(gidNumber);
        this.lobjSys = SDT.Life.LifeCO.clsSystemCreator.GetSysObject(gidNumber);

        // Rtrieve the ArrayList from the client's code       
        clsTextList comboList= this.lobjSys.lstPaymentType_PaymentQueue;

        // Get the length of the returned list
        int cnt= (int)comboList.Count();

        // Create the List<string> which will be populated and returned
        List<string> theList= new List<string>();

        // Copy each element from the clsTextList to the List<string>
        for (int i = 0; i < cnt;i++)
        {
            string status= comboList.Item(i).Description;
            theList.Add(status);
        }

        // return the newly populated List<string>
        return theList;
    }//end function getPaymentTypeCombo

다른 팁

지 않는지 확인할 수 있습 return ArrayList.나는 당신을 생각해야에 대한 반환페이를 대신하는 서비스를 만들 것입니다 인식하는 방법으로 읽는 방법입니다.

목록이 있는 경우 또는다하고자하는 바인딩하는 ItemControl 다음과 같 콤보 상자 설정할 수 있습니다 ItemsSource 에 ItemControl.사용 DisplayPath 숙박 시설에 ItemControl 속성을 설정하려면 원하는 표시 또는 사용 DataTemplate.

<ComboBox>
  <ComboBox.ItemTemplate>
    <DataTemplate>
      <StackPanel Orientation="Horizontal">
        <TextBlock Text={"Binding Path=Property1"}/>
        <TextBlock Text={"Binding Path=Property2"}/>
        <TextBlock Text={"Binding Path=Property3"}/>
      </StackPanel>
    </DataTemplate>
  </ComboBox.ItemTemplate>
</ComboBox>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top