Click here to Skip to main content
15,898,588 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: background worker Pin
arkiboys15-Feb-11 2:40
arkiboys15-Feb-11 2:40 
GeneralRe: background worker PinPopular
Ian Shlasko15-Feb-11 3:16
Ian Shlasko15-Feb-11 3:16 
GeneralRe: background worker Pin
musefan15-Feb-11 3:44
musefan15-Feb-11 3:44 
GeneralRe: background worker Pin
Ian Shlasko15-Feb-11 4:19
Ian Shlasko15-Feb-11 4:19 
GeneralRe: background worker Pin
musefan15-Feb-11 4:54
musefan15-Feb-11 4:54 
GeneralRe: background worker Pin
Ian Shlasko15-Feb-11 4:58
Ian Shlasko15-Feb-11 4:58 
GeneralRe: background worker Pin
Pete O'Hanlon15-Feb-11 5:19
mvePete O'Hanlon15-Feb-11 5:19 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 3:50
professionalTesic Goran16-Feb-11 3:50 
Hello Ian,

Could I please you to help me with my problem?

I have this code in big method in my Silverlight application that uses WCF service:

private void F()
{
        // WCF service
	DatabaseServiceClient client = new DatabaseServiceClient();

	// First async
        client.GetSubsystemsByTestRunIDCompleted +=
          new EventHandler<GetSubsystemsByTestRunIDCompletedEventArgs>(client_GetSubsystemsByTestRunIDCompleted);
        client.GetSubsystemsByTestRunIDAsync(testRunID);

	// I want to use lstSubsystems list returned from first async in foreach loop
        treeAdditionalInfo.Items.Clear();
        foreach (string subsystemName in lstSubsystems)
        {
          TreeViewItem subsystemItem = new TreeViewItem();
          subsystemItem.Header = subsystemName;
          subsystemItem.FontSize = 14;
          treeAdditionalInfo.Items.Add(subsystemItem);
        }

	// Second async
        List<KeyValuePair<string, List<TestLogSmall>>> lstFormsAndActions =
          client.GetFormsAndActions(testRunID).ToList();
        client.GetFormsAndActionsCompleted +=
          new EventHandler<GetFormsAndActionsCompletedEventArgs>(client_GetFormsAndActionsCompleted);
        client.GetFormsAndActionsAsync(testRunID);

        ...
}


The code in first 2 callbacks is this:

private void client_GetSubsystemsByTestRunIDCompleted(
  object sender, GetSubsystemsByTestRunIDCompletedEventArgs e)
{
  lstSubsystems = new List<string>();
  if (e.Error == null && e.Result != null)
    lstSubsystems = e.Result;
}

private void client_GetFormsAndActionsCompleted(
  object sender, GetFormsAndActionsCompletedEventArgs e)
{
  lstFormsAndActions = new List<KeyValuePair<string, List<TestLogSmall>>>();
  if (e.Result != null)
    lstFormsAndActions = e.Result;
}


I need to get the list after this call:

client.GetSubsystemsByTestRunIDAsync(testRunID);


And to get the list after this call as well:

client.GetFormsAndActionsAsync(testRunID);


How can I do that? What should I write?

Thank you in advance.
GeneralRe: background worker Pin
Ian Shlasko16-Feb-11 5:29
Ian Shlasko16-Feb-11 5:29 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:37
professionalTesic Goran16-Feb-11 21:37 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:52
mvePete O'Hanlon16-Feb-11 21:52 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 7:38
mvePete O'Hanlon16-Feb-11 7:38 
GeneralRe: background worker Pin
Tesic Goran16-Feb-11 21:24
professionalTesic Goran16-Feb-11 21:24 
GeneralRe: background worker Pin
Pete O'Hanlon16-Feb-11 21:50
mvePete O'Hanlon16-Feb-11 21:50 
QuestionMVVM Question Pin
_Maxxx_14-Feb-11 0:14
professional_Maxxx_14-Feb-11 0:14 
AnswerRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:22
mvePete O'Hanlon14-Feb-11 0:22 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 0:37
professional_Maxxx_14-Feb-11 0:37 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 0:42
mvePete O'Hanlon14-Feb-11 0:42 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:51
professional_Maxxx_14-Feb-11 13:51 
AnswerRe: MVVM Question Pin
lmoelleb14-Feb-11 1:47
lmoelleb14-Feb-11 1:47 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 5:13
mvePete O'Hanlon14-Feb-11 5:13 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 13:36
professionalMycroft Holmes14-Feb-11 13:36 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 13:58
professional_Maxxx_14-Feb-11 13:58 
GeneralRe: MVVM Question Pin
Mycroft Holmes14-Feb-11 14:06
professionalMycroft Holmes14-Feb-11 14:06 
AnswerRe: MVVM Question Pin
SledgeHammer0114-Feb-11 15:03
SledgeHammer0114-Feb-11 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.