/// <summary> /// Saves the project asynchronously. /// </summary> /// <param name="project">The project.</param> public void SaveProjectAsync(Project project) { if (!this.isSaving) { this.isSaving = true; DataServiceClient client = this.CreateDataServiceClient(); RCE.Services.Contracts.Project dataProject = DataServiceTranslator.ConvertToDataServiceProject(project); client.SaveProjectCompleted += (sender, args) => { this.isSaving = false; if (args.Error != null) { client.Abort(); this.logger.Log(this.GetType().Name, args.Error); if (args.Error.GetType() == typeof(Exception)) { throw args.Error; } return; } this.OnSaveProjectCompleted(new DataEventArgs <bool>(args.Result)); }; client.SaveProjectAsync(dataProject); } }
/// <summary> /// Saves the project asynchronously. /// </summary> /// <param name="project">The project.</param> public void SaveProjectAsync(Project project) { if (!this.isSaving) { this.isSaving = true; DataServiceClient client = this.CreateDataServiceClient(); RCE.Services.Contracts.Project dataProject = DataServiceTranslator.ConvertToDataServiceProject(project); string projectId = null; if (HtmlPage.Document.QueryString.TryGetValue("projectId", out projectId)) { dataProject.HighlightId = Guid.Parse(projectId); } client.SaveProjectCompleted += (sender, args) => { this.isSaving = false; if (args.Error != null) { client.Abort(); this.logger.Log(this.GetType().Name, args.Error); if (args.Error.GetType() == typeof(Exception)) { throw args.Error; } return; } this.OnSaveProjectCompleted(new DataEventArgs <bool>(args.Result)); }; client.SaveProjectAsync(dataProject); } }