public async void PushToCloud(Project project) { if (!AppService.IsConnected()) return; try { if (project.MSId != 0) { int id = project.Id; project.Id = project.MSId; project.MSId = id; await mstProject.UpdateAsync(project); project.Id = id; } else { project.Id = 0; await mstProject.InsertAsync(project); AppDatabase.Current.UpdateProjectField(project.AggregateId, "MSId", project.Id, false); } Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
public Shell() { //RenderOn = true; EnableClear = true; _renderTree = new List<RenderDTO>(); clock = new Stopwatch(); _sessionID = AppDatabase.Current.RetrieveInstanceAppState(ModernCSApp.Services.AppDatabase.AppSystemDataEnums.UserSessionID).Value; _project = new Project(); _project.ScaleX = 1.0f; _project.ScaleY = 1.0f; _project.ScaleZ = 1.0f; _project.IsRenderable = true; Messenger.Default.Register<GeneralSystemWideMessage>(this, DoGeneralSystemWideMessageCallback); }
public void AddUpdateProject(Project project) { LoggingService.LogInformation("writing to db 'Project'", "AppDatabase.AddUpdateProject"); var found = RetrieveProject(project.AggregateId); if (found != null && found.Count() > 0) { this.SqliteDb.Update(project); //await mstProject.UpdateAsync(project); } else { var newId = this.SqliteDb.Insert(project); //await mstProject.InsertAsync(project); } Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("updating ...") { Identifier = "DB", SourceId = "Project" }); Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("") { Identifier = "AGGREGATE", AggregateId = project.AggregateId, Action = "UPDATED" }); }