public static async Task <int> GetRandomSpreekwoordAndSaveImageToFile()
        {
            SpreekwoordenWrapper spreekwoordInstance = await SpreekwoordenWrapper.GetInstance();

            List <Spreekwoord> spreekwoorden = new List <Spreekwoord>();

            if (!spreekwoordInstance.ChangeLockscreen)
            {
                return(0);
            }

            if (spreekwoordInstance.SourceIsRandom)
            {
                spreekwoorden.AddRange(await Datahandler.GetRandomSpreekwoorden());
            }

            if (spreekwoordInstance.SourceIsList)
            {
                spreekwoorden.AddRange(spreekwoordInstance.MyItems);
            }

            if (spreekwoorden.Count == 0)
            {
                return(0);
            }

            Random      random = new Random();
            Spreekwoord s      = spreekwoorden[random.Next(0, spreekwoorden.Count)];

            await GetSpreekwoordenTile(s.ID);

            return(s.ID);
        }
        public async Task LoadData()
        {
            SpreekwoordInstance = await SpreekwoordenWrapper.GetInstance();

            MyItemsPivotItem = MyItems;

            if (SpreekwoordInstance.MyItems.Count == 0)
            {
                SpreekwoordenPivot.Items.Remove(MyItems);
            }

            this.DataContext = SpreekwoordInstance;
            LoadingControl.SetLoadingStatus(false);

            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            await SpreekwoordInstance.GetRandomWoorden();

            LoadingControl.SetLoadingStatus(false);

            if (SpreekwoordInstance.ChangeLockscreen)
            {
                //NotificationHandler.Run("SpreekwoordenBackgroundTaskW.BackgroundTask", "ImageService", (uint)SpreekwoordInstance.IntervalArray[SpreekwoordInstance.SelectedInterval]);
            }

            int ID = await Task.Run(() => Datahandler.GetRandomSpreekwoordAndSaveImageToFile());
            //await LockScreen.SetImageFileAsync(await ApplicationData.Current.LocalFolder.GetFileAsync("Tegeltje" + ID + ".jpg"));
        }
        private static async Task Load()
        {
            if (instance == null)
            {
                try
                {
                    StorageFile sFile = await localFolder.GetFileAsync(FileName);

                    string FileAsText = await FileIO.ReadTextAsync(sFile);

                    instance           = JsonConvert.DeserializeObject <SpreekwoordenWrapper>(FileAsText);
                    instance.Searching = false;
                }
                catch (Exception)
                {
                }

                if (instance == null)
                {
                    instance = new SpreekwoordenWrapper();
                }
            }
        }
        private static async Task Load()
        {
            if (instance == null)
            {
                try
                {
                    StorageFile sFile = await localFolder.GetFileAsync(FileName);
                    string FileAsText = await FileIO.ReadTextAsync(sFile);
                    instance = JsonConvert.DeserializeObject<SpreekwoordenWrapper>(FileAsText);
                    instance.Searching = false;
                }
                catch (Exception)
                {

                }

                if (instance == null)
                {
                    instance = new SpreekwoordenWrapper();
                }
            }
        }