예제 #1
0
        public static async void store(Tracker originalTracker)
        {
            ObservableCollection<TvShow> tracker = originalTracker.tracker;
            if (tracker != null && tracker.Count != 0)
            {
                StorageFolder temp = ApplicationData.Current.LocalFolder;
                StorageFile fil = await temp.CreateFileAsync("tracker.txt", CreationCollisionOption.ReplaceExisting);

                await Windows.Storage.FileIO.WriteTextAsync(fil, JsonConvert.SerializeObject(tracker));
            }
        }
        private async void LoadLists()
        {

            StatusBar bar = StatusBar.GetForCurrentView();
            await bar.ProgressIndicator.ShowAsync();
            bar.ProgressIndicator.Text = "Getting Queue";
            await bar.ShowAsync();

            //Execute commands before loading
            await api.executeCommands();
            
            //Load Queue
            q = new Queue();
            queue.ItemsSource = q;
            await q.download();
            

            bar.ProgressIndicator.Text = "Getting Calendar";

            List<Episode> cal = await api.getCalendar();
            if (cal != null)
            {
                var result =
                    from ep in cal
                    group ep by ep.airdate
                    into grp
                    orderby grp.Key
                    select grp;
                calendar.Source = result;
            }


            bar.ProgressIndicator.Text = "Getting Tracker";

            //Load Tracker
            Tracker trackerO = new Tracker();
            tracker.ItemsSource = trackerO.getTracker();
            await trackerO.load();

            foreach (TvShow show in trackerO.getTracker())
            {
                imageLoader.Source = show.Image;
            }

            bar.ProgressIndicator.Text = "Done";
            await bar.HideAsync();

            SharedCode.Memory.store(q);
            SharedCode.Memory.store(trackerO);
            SharedCode.Memory.store(cal);
        }