Exemplo n.º 1
0
        public virtual void Initialize(DeviceManager devices)
        {

            _deviceManager = devices;







            //RETRIEVE EXISTING SOLUTIONS

            //var foundSolution = AppDatabase.Current.RetrieveSolutionsByGrouping(_sessionID);

            _solution = new Solution();
            _solution.ScaleX = 1;
            _solution.ScaleY = 1;



            //if (foundSolution != null)
            //{

            //    _solution = foundSolution;
            //    //_globalTranslationX = _solution.TranslationX;
            //    //_globalTranslationY = _solution.TranslationY;
            //    //_globalTranslationZ = _solution.TranslationZ;
            //    //_globalRotationX = _solution.RotationX;
            //    //_globalRotationY = _solution.RotationY;
            //    //_globalScaleX = _solution.ScaleX;
            //    //_globalScaleY = _solution.ScaleY;

            //    ////RETRIEVE EXISTING PROJECTS
            //    //var found = AppDatabase.Current.RetrieveProjectsByGrouping(_solution.AggregateId);
            //    //if (found != null && found.Count > 0)
            //    //{
            //    //    foreach (Project p in found)
            //    //    {
            //    //        CreateD3DDto(p);
            //    //    }
            //    //}

            //    //CreateD3DDto("\\Assets\\BackgroundDefault001.jpg");
            //}

            clock = new Stopwatch();
            clock.Start();

        }
Exemplo n.º 2
0
        public async void PushToCloud(Solution solution)
        {
            if (!AppService.IsConnected()) return;

            try{
                if (solution.MSId != 0)
                {
                    int id = solution.Id;
                    solution.Id = solution.MSId;
                    solution.MSId = id;
                    await mstSolution.UpdateAsync(solution);
                    solution.Id = id;
                }
                else
                {
                    solution.Id = 0;
                    await mstSolution.InsertAsync(solution);
                    AppDatabase.Current.UpdateSolutionField(solution.AggregateId, "MSId", solution.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 async void AddUpdateSolution(Solution solution)
        {
            LoggingService.LogInformation("writing to db 'Solution'", "AppDatabase.AddUpdateSolution");
            var found = RetrieveSolution(solution.AggregateId);

            if (found != null && found.Count() > 0)
            {
                this.SqliteDb.Update(solution);
                //await mstSolution.UpdateAsync(solution);
            }
            else
            {
                var newId = this.SqliteDb.Insert(solution);
                //await mstSolution.InsertAsync(solution);

            }

            Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("updating ...") { Identifier = "DB", SourceId = "Solution" });

            Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("") { Identifier = "AGGREGATE", AggregateId = solution.AggregateId, Action = "UPDATED" });

        }