Example #1
0
        private async Task getData()
        {
            try
            {
                IsBusy         = true;
                _defaultSounds = await KaamlotWebService.GetSoundList();

                if (_defaultSounds != null)
                {
                    await SynchronizedDB();
                }
                else
                {
                    using (var context = new KaamDBContext())
                    {
                        _defaultSounds = context.SoundTable.ToList();
                    }
                }

                SearchText = "";
                IsBusy     = false;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #2
0
        private async Task SynchronizedDB()
        {
            try
            {
                using (var context = new KaamDBContext())
                {
                    //context.RemoveRange(context.SoundTable);
                    _defaultSounds = await KaamlotWebService.GetSoundList();

                    // var dataList = await KaamlotWebService.GetSoundList();

                    /*
                     * foreach (var data in dataList)
                     * {
                     *  if (!context.SoundTable.Any(w => w.Title == data.Title))
                     *  {
                     *      context.SoundTable.Add(data);
                     *  }
                     * }*/
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }