public async Task <ExtractProgramResult> ExtractProgram(CancellationToken taskCancellationToken)
        {
            ExtractProgramResult _extractResult = new ExtractProgramResult {
                Status = ExtractProgramStatus.Success
            };

            try
            {
                if (_programStream == null && _onlineProgramHeader == null)
                {
                    throw new Exception(
                              "SetProgramStream or SetDownloadHeader have to be called before calling StartImportProgram.");
                }

                if (_programStream == null && _onlineProgramHeader == null)
                {
                    throw new Exception("SetProgramStream and SetDownloadHeader cannot be used together.");
                }

                // old simple portable downloader
                var cancellationTokenSource = new CancellationTokenSource();
                if (_onlineProgramHeader != null)
                {
                    _programStream = await Task.Run(() => ServiceLocator.WebCommunicationService.DownloadAsync(
                                                        _onlineProgramHeader.DownloadUrl, _onlineProgramHeader.ProjectName, cancellationTokenSource.Token), taskCancellationToken);
                }
                // new downloader
                //if (_onlineProgramHeader != null)
                //{
                //    await Task.Run(() => ServiceLocator.WebCommunicationService.DownloadAsyncAlternativ(
                //        _onlineProgramHeader.DownloadUrl, _onlineProgramHeader.ProjectName), taskCancellationToken);
                //}
                //using (var storage = StorageSystem.GetStorage())
                //{
                //    var stream = await storage.OpenFileAsync(Path.Combine(StorageConstants.TempProgramImportZipPath, _onlineProgramHeader.ProjectName + ".catrobat"),
                //            StorageFileMode.Open, StorageFileAccess.Read);
                //    await ServiceLocator.ZipService.UnzipCatrobatPackageIntoIsolatedStorage(
                //       stream, StorageConstants.TempProgramImportPath);
                //}

                if (_cancellationTokenSource.Token.IsCancellationRequested == false)
                {
                    await ServiceLocator.ZipService.UnzipCatrobatPackageIntoIsolatedStorage(
                        _programStream, StorageConstants.TempProgramImportPath);
                }
            }
            catch (Exception)
            {
                _extractResult.Status = ExtractProgramStatus.Error;
            }

            using (var storage = StorageSystem.GetStorage())
            {
                await storage.DeleteDirectoryAsync(StorageConstants.TempProgramImportZipPath);
            }
            return(_extractResult);
        }
        public async Task TryImportWithStatusNotifications()
        {
            _cancellationTokenSource = new CancellationTokenSource();
            Debug.WriteLine("Starting with ExtractProgram");
            ExtractProgramResult extractionResult = await ServiceLocator.ProgramImportService.ExtractProgram(_cancellationTokenSource.Token);

            if (_cancellationTokenSource.Token.IsCancellationRequested == true)
            {
                await CleanUpImport();

                return;
            }
            if (extractionResult.Status == ExtractProgramStatus.Error)
            {
                ServiceLocator.NotifictionService.ShowToastNotification(
                    AppResourcesHelper.Get("Import_ProgramDamaged"),
                    AppResourcesHelper.Get("Import_CatrobatDamagedText"),
                    ToastDisplayDuration.Long);
                return;
            }

            Debug.WriteLine("Starting with CheckProgram");
            var validateResult = await ServiceLocator.ProgramValidationService.CheckProgram(StorageConstants.TempProgramImportPath);

            if (_cancellationTokenSource.Token.IsCancellationRequested == true)
            {
                await CleanUpImport();

                return;
            }

            switch (validateResult.State)
            {
            case ProgramState.Valid:
                _programName = validateResult.ProgramHeader.ProjectName;
                break;

            case ProgramState.Damaged:
                ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                        AppResourcesHelper.Get("Import_ProgramDamaged"),
                                                                        ToastDisplayDuration.Long);
                break;

            case ProgramState.VersionTooOld:
                ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                        AppResourcesHelper.Get("Import_ProgramOutdated"),
                                                                        ToastDisplayDuration.Long);
                break;

            case ProgramState.VersionTooNew:
                ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                        AppResourcesHelper.Get("Import_AppTooOld"),
                                                                        ToastDisplayDuration.Long);
                break;

            case ProgramState.ErrorInThisApp:
                ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                        AppResourcesHelper.Get("Import_GeneralError"),
                                                                        ToastDisplayDuration.Long);
                break;

            case ProgramState.Unknown:
                ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                        AppResourcesHelper.Get("Import_GeneralError"),
                                                                        ToastDisplayDuration.Long);
                break;

            case ProgramState.FilesMissing:
                ServiceLocator.NotifictionService.ShowMessageBox(AppResourcesHelper.Get("Import_Canceled"),
                                                                 AppResourcesHelper.Get("Import_FilesMissing"), MissingFilesCallback, MessageBoxOptions.Ok);
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Debug.WriteLine("Starting with AcceptTempProgram");
            await ServiceLocator.ProgramImportService.AcceptTempProgram();

            var localProgramsChangedMessage = new MessageBase();

            Messenger.Default.Send(localProgramsChangedMessage,
                                   ViewModelMessagingToken.LocalProgramsChangedListener);

            ServiceLocator.NotifictionService.ShowToastNotification("",
                                                                    AppResourcesHelper.Get("Import_ProgramAdded"),
                                                                    ToastDisplayDuration.Long,
                                                                    ToastTag.ImportFin);

            Debug.WriteLine("Finished");
        }