private void UploadImagesAndSavePost() { this.Focus(); //hide the keyboard ApplicationBar.IsVisible = false; //hide the application bar App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.UploadingMedia); //fire off the worker rpcs if (_mediaUploadRPCs.Count > 0) { UploadFileRPC item = _mediaUploadRPCs.First() as UploadFileRPC; item.ExecuteAsync(); } }
private void OnUploadMediaRPCCompleted(object sender, XMLRPCCompletedEventArgs <Media> args) { UploadFileRPC rpc = sender as UploadFileRPC; rpc.Completed -= OnUploadMediaRPCCompleted; lock (_syncRoot) { _mediaUploadRPCs.Remove(rpc); if (args.Cancelled) { return; } if (args.Items.Count == 0 || args.Error != null) { //uh oh, media upload problem App.WaitIndicationService.KillSpinner(); //Move UIThread.Invoke(() => { ApplicationBar.IsVisible = true; if (!_messageBoxIsShown) { _messageBoxIsShown = true; String msg = args.Error != null ? args.Error.Message : _localizedStrings.Prompts.MediaError; MessageBoxResult result = MessageBox.Show(msg, _localizedStrings.Prompts.MediaError, MessageBoxButton.OK); _messageBoxIsShown = false; } }); this.emptyImagesUploadingQueue(); return; } else { //Image uploaded correctly. Upload the next picture in the list if (_mediaUploadRPCs.Count > 0) { UploadFileRPC item = _mediaUploadRPCs.First() as UploadFileRPC; item.ExecuteAsync(); return; } App.WaitIndicationService.KillSpinner(); SavePost(); } }//end lock }