private async void UploadAction()
{
lock (_exportLock)
{
if (IsSending)
{
ServiceLocator.NotifictionService.ShowMessageBox(
AppResourcesHelper.Get("Main_Sending"),
AppResourcesHelper.Get("Export_Busy"),
CancelExportCallback, MessageBoxOptions.Ok);
return;
}
IsSending = true;
}
try
{
//await CurrentProgram.SetProgramNameAndRenameDirectory(ProgramName);
//CurrentProgram.Description = ProgramDescription;
//await App.SaveContext(CurrentProgram);
var message = new GenericMessage<string>(ProgramName);
Messenger.Default.Send(message, ViewModelMessagingToken.UploadProgramStartedListener);
Task uploadTask = ServiceLocator.ProgramExportService.ExportToPocketCodeOrgWithNotifications(
ProgramName, Context.CurrentUserName, Context.CurrentToken);
this.GoBackAction();
await Task.Run(() => uploadTask);
}
finally
{
ServiceLocator.DispatcherService.RunOnMainThread(() =>
{
lock (_exportLock) { IsSending = false; }
});
}
}