private async Task <bool> SaveSolutionAsync(string fileLocation, TranslatorSolution solution) { if (mProcessItems.SetIsProcessingSolution(true, mSaveSolutionProcessID) == false) { throw new Exception(string.Format(LocultApp.Local.Strings.STR_BLOCKED_SOLUTION_TASK, mProcessItems.CurrentProcessId)); } try { var modelExt = new PersistSolutionModelInXML(); var result = await modelExt.SaveSolutionAsync(solution, fileLocation); var settings = GetService <ISettingsManager>(); settings.SessionData.SetLastActiveSolution(fileLocation); return(result); } finally { if (mProcessItems.SetIsProcessingSolution(false, mSaveSolutionProcessID) == false) { ViewException.SetExceptionForDisplay(new Exception(string.Format(Local.Strings.STR_FAILED_RESET_OF_SOLUTION_TASK, mProcessItems.CurrentProcessId))); } } }
/// <summary> /// editPage.Solution.Root.ItemPathName /// </summary> /// <param name="filePathName"></param> /// <returns></returns> private async void SaveSolution(string filePathName, TranslatorSolution solutionModel, SolutionViewModel solutionViewModel = null) { try { // Copy solution and compute relative paths var copy = solutionModel.CopySolution(filePathName); // save data to persistence this.IsProcessing = true; if (mProcessItems.SetIsProcessingSolution(true, mSaveSolutionProcessID) == false) { throw new Exception(string.Format(Local.Strings.STR_BLOCKED_SOLUTION_TASK, mProcessItems.CurrentProcessId)); } try { var modelExt = new PersistSolutionModelInXML(); var result = await modelExt.SaveSolutionAsync(copy, filePathName); if (solutionViewModel != null) { solutionViewModel.Root.SolutionIsDirty_Reset(); } } finally { if (mProcessItems.SetIsProcessingSolution(false, mSaveSolutionProcessID) == false) { ViewException.SetExceptionForDisplay(new Exception(string.Format(Local.Strings.STR_FAILED_RESET_OF_SOLUTION_TASK, mProcessItems.CurrentProcessId))); } } } catch (System.Exception exp) { ViewException.SetExceptionForDisplay(exp); } finally { this.IsProcessing = false; } }