public void StartLoading(string senderName, string password) { // get file url from web service FlashCardServiceClient flashCardsService = new FlashCardServiceClient(); flashCardsService.GetFileUriCompleted += (s, args) => { string fileUri = args.Result; Uri uri = new Uri(fileUri, UriKind.RelativeOrAbsolute); // Download the zip package. _webClient = new WebClient(); _webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted); _webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged); _webClient.OpenReadAsync(uri); }; flashCardsService.GetFileUriAsync(senderName, password); }
public void StartLoading() { IsBusy = true; WaitIndicatorText = string.Format(DownloadingDeckString, 0); WebClient webClient; // get file url from web service FlashCardServiceClient flashCardsService = new FlashCardServiceClient(); flashCardsService.GetFileUriCompleted += (s, args) => { if (args.Error == null) { string fileUri = args.Result; if (!string.IsNullOrEmpty(fileUri)) { Uri uri = new Uri(fileUri, UriKind.RelativeOrAbsolute); // Download the zip package. webClient = new WebClient(); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged); webClient.OpenReadAsync(uri); } else { ReportStatus(DeckNotFoundString); } } else { ReportStatus(NetworkErrorString); } }; flashCardsService.GetFileUriAsync(SenderName, Password); }